SA-MP Forums Archive
DestroyObject - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: DestroyObject (/showthread.php?tid=550906)



DestroyObject - nezo2001 - 15.12.2014

This is the CreateObject code :
PHP код:
CMD:cbarrier(playerid,params[])
{
        new 
Float:xFloat:yFloat:z;
        new 
Float:a;
    
GetPlayerPos(playeridxyz);
    
GetPlayerFacingAngle(playerida);
    
CreateObject(1422x+5,y,z,0,0,a); // change the object id
    
SendClientMessage(playerid, -1"You have spawned a barrier.");
    return 
1;

And the DestroyObject code:
PHP код:
CMD:rbarrier(playerid,params[])
{
DestroyObject(1422); // change the object id
SendClientMessage(playerid, -1"You have removed a barrier");
return 
1;

The CreateObject command works but the DestroyObject one doesn't work.
Please Help !!


Re: DestroyObject - Schneider - 15.12.2014

You have to use the actual id of the object to destroy it, not the model-id.

pawn Код:
new Object1;

Object1 = CreateObject(blablabla);

DestroyObject(Object1);



Re: DestroyObject - nezo2001 - 15.12.2014

Another thing how to prevent player from making more than one object untill he removed the other ??


Re: DestroyObject - Arastair - 15.12.2014

I thought i told you already


Re: DestroyObject - nezo2001 - 15.12.2014

Yea but there was a problem in DestroyObject as i said and you didn't tell me about max object but thank you btw