ColAndreas dynamic objects
#1

How do I properly create and destroy ColAndreas dynamic objects with assigned IDs?

PHP Code:
// 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 
Reply
#2

CA_DestroyObject_DC -> check object type from ColAndreas Table -> DestroyObject/DestroyDynamicObject

PHP Code:
stock CA_DestroyObject_DC(index)
{
    
// Out of bounds
    
if(index || index >= MAX_CA_OBJECTS) return -1;
    
#if defined _Y_ITERATE_LOCAL_VERSION
        
if(Iter_Contains(CA_Objectsindex))
        {
            new 
next;
            
Iter_SafeRemove(CA_Objectsindexnext);
            if(
CA_ObjectList[index][ObjectType] == OBJECT_TYPE_OBJECTDestroyObject(CA_ObjectList[index][ObjectID]);
            
#if defined STREAMER_TYPE_OBJECT
            
else if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_DYNAMICDestroyDynamicObject(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_OBJECTDestroyObject(CA_ObjectList[index][ObjectID]);
        
#if defined STREAMER_TYPE_OBJECT
        
else if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_DYNAMICDestroyDynamicObject(CA_ObjectList[index][ObjectID]);
        
#endif
        
CA_ObjectList[index][ObjectUsed] = false;
        
CA_DestroyObject(CA_ObjectList[index][ColdAndreadsID]);
        return 
1;
    }
    
#endif
    
return -1;

Reply
#3

Quote:
Originally Posted by AbyssMorgan
View Post
...
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.
Reply
#4

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

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


5 Errors

Reply
#5

Update streamer
Reply
#6

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.
Reply
#7

Quote:
Originally Posted by Pottus
View Post
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
Reply
#8

Quote:
Originally Posted by AbyssMorgan
View Post
Update streamer
Allright, no errors now
But the problem with objects not appearing still persists
Reply
#9

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:
PHP Code:
CA_GetObjectID(index); 
https://github.com/Pottus/ColAndreas/pull/30

Also check your logs about plugin errors.
Reply
#10

Quote:
Originally Posted by AbyssMorgan
View Post
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().
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)