PDA

View Full Version : ColAndreas dynamic objects


Amads
19/07/2017, 06:16 PM
How do I properly create and destroy ColAndreas dynamic objects with assigned IDs?

// top of the gamemode
new Object[500];

// somewhere else in the code
Object[0] = CA_CreateDynamicObject_DC(blah blah); // DOESN'T WORK FOR ME (NO OBJECT)
CA_CreateDynamicObject_DC(blah blah); // WORKS, BUT I NEED AN ID ASSIGNED

// what function should I use to destroy those objects?
CA_DestroyObject_DC(Object[0]); // will this work? there's no 'Dynamic' in its name

AbyssMorgan
19/07/2017, 06:21 PM
CA_DestroyObject_DC -> check object type from ColAndreas Table -> DestroyObject/DestroyDynamicObject


stock CA_DestroyObject_DC(index)
{
// Out of bounds
if(index < 0 || index >= MAX_CA_OBJECTS) return -1;
#if defined _Y_ITERATE_LOCAL_VERSION
if(Iter_Contains(CA_Objects, index))
{
new next;
Iter_SafeRemove(CA_Objects, index, next);
if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_OBJECT) DestroyObject(CA_ObjectList[index][ObjectID]);
#if defined STREAMER_TYPE_OBJECT
else if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_DYNAMIC) DestroyDynamicObject(CA_ObjectList[index][ObjectID]);
#endif
CA_DestroyObject(CA_ObjectList[index][ColdAndreadsID]);
return next;
}
#else
if(CA_ObjectList[index][ObjectUsed])
{
if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_OBJECT) DestroyObject(CA_ObjectList[index][ObjectID]);
#if defined STREAMER_TYPE_OBJECT
else if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_DYNAMIC) DestroyDynamicObject(CA_ObjectList[index][ObjectID]);
#endif
CA_ObjectList[index][ObjectUsed] = false;
CA_DestroyObject(CA_ObjectList[index][ColdAndreadsID]);
return 1;
}
#endif
return -1;
}

Amads
19/07/2017, 06:28 PM
...

Allright, thanks for clearing that up.
Still, there's a problem with creating those objects, as they seem to be created only when I don't assign any ID to them.

Amads
19/07/2017, 09:37 PM
Also, for some reason I get the following errors after updating the include...

C:\path\PAWNO\include\colandreas.inc(407) : warning 202: number of arguments does not match definition
C:\path\PAWNO\include\colandreas.inc(407) : warning 202: number of arguments does not match definition
C:\path\PAWNO\include\colandreas.inc(405) : warning 203: symbol is never used: "priority"
C:\path\PAWNO\include\colandreas.inc(405) : warning 203: symbol is never used: "areaid"
C:\path\PAWNO\include\colandreas.inc(474) : warning 202: number of arguments does not match definition
C:\path\PAWNO\include\colandreas.inc(474) : warning 202: number of arguments does not match definition
C:\path\PAWNO\include\colandreas.inc(451) : warning 203: symbol is never used: "priority"
C:\path\PAWNO\include\colandreas.inc(451) : warning 203: symbol is never used: "areaid"
C:\path\PAWNO\include\colandreas.inc(1041) : error 010: invalid function or declaration
C:\path\PAWNO\include\colandreas.inc(1044) : error 021: symbol already defined: "CA_CreateObject_DC"
C:\path\PAWNO\include\colandreas.inc(1042) : error 010: invalid function or declaration
C:\path\PAWNO\include\colandreas.inc(1042 -- 1047) : error 021: symbol already defined: "CA_DestroyObject_DC"
C:\path\PAWNO\include\colandreas.inc(1042 -- 1047) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.

AbyssMorgan
19/07/2017, 09:50 PM
Update streamer

Pottus
20/07/2017, 01:04 AM
It would be nice if someone cleaned up ColAndreas a bit at some point I don't really have time to get into it these days.

AbyssMorgan
20/07/2017, 06:50 AM
It would be nice if someone cleaned up ColAndreas a bit at some point I don't really have time to get into it these days.

I can do it :)

Amads
20/07/2017, 09:21 AM
Update streamer

Allright, no errors now :)
But the problem with objects not appearing still persists :(

AbyssMorgan
20/07/2017, 09:47 AM
CA_CreateDynamicObject_DC - create dynamic object, create collision object, return index
CA_DestroyObject_DC(index) - destroy object from index

If you need a streamer object id to use the function SetDynamicObjectMaterial, ModeDynamicObject you need wait for:

CA_GetObjectID(index);

https://github.com/Pottus/ColAndreas/pull/30

Also check your logs about plugin errors.

Amads
20/07/2017, 05:18 PM
...

I've managed to deal with the problem with a workaround, creating normal DynamicObject and CA_CreateObject collision separately.

But, there is no happy end yet :(
Everything works fine on localhost, but when I've uploaded everything on a hosting, the server won't launch. I'm using colandreas_static.so, because there are some linux libraries missing.

Here's the server log:
[19:02:20] Loading Map.
[19:02:19] Loaded 5 plugins.

[19:02:19] *********************
[19:02:19] v1.4.0
[19:02:19] ColAndreas Loaded
[19:02:19] *********************
[19:02:19] Loaded collision data.
[19:02:16] *********************
[19:02:16] ** [uL]Pottus **
[19:02:16] ** [uL]Slice **
[19:02:16] ** [uL]Chris42O **
[19:02:16] ** Created By: **
[19:02:16] *********************
[19:02:16] Loading plugin: ColAndreas_static.so
[19:02:16] Loaded.

*** Streamer Plugin v2.9.1 by Incognito loaded ***

[19:02:16]
[19:02:16] Loading plugin: streamer.so
[19:02:16] Loaded.

The server freezes on CA_Init(); function. (I've tried it on a clean lvdm gamemode).
I've also tried older ColAndreas versions to the same effect.

Pottus
20/07/2017, 10:30 PM
I can do it :)

Cool the main issue is updating the way objects are created I would like to remove all the _SC _DC functions and just make them one for CreateObject() CreateDynamicObject().

Amads
21/07/2017, 04:00 PM
bump, see last reply on the previous page

Amads
22/07/2017, 04:11 PM
aaand bump

// kinda 'fixed', ColAndreas loads correctly when StrickenKid's MySQL Plugin is loaded. Why? Hell if I know, but it works now.
//// aand it's not working again. uh.