Deleting Objects
#1

Hello
I am a N00b Scripter and am learning so please dont judge me on my scripting.
I am using a map that Luke™ on the forums had created.
Its called Don't Fall.

I wanna have it so I can do /createhd and it creates the objects and then /deletehd and it deletes all of the objects!

The Object IDs are the ones Im trying to delete but how do I delete all of the Ids?
Heres my /deletehd script!

References:
http://forum.sa-mp.com/index.php?topic=123515.0

if(strcmp(cmd, "/deletehd", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if (GetPlayerState(playerid) == 2)
{
DestroyObject(3374);
DestroyObject(16120);
DestroyObject(8355);
}
else
{
DestroyObject(3374);
DestroyObject(16120);
DestroyObject(8355);
}
SendClientMessage(playerid, COLOR_GRAD1, "You have removed the High Drop");
SetPlayerInterior(playerid,0);
PlayerInfo[playerid][pInt] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command !");
}
}
return 1;
}
Reply
#2

LOL you guys are funny.


Its totally possible...first you cannot destroy an object by its object id. Create a variable to store the object information. Then destroy the variable like so....

[EDIT] forgot to say make sure you declare the variable as a global!!!
pawn Код:
new Object1; // Top of the script with the other global variables

Object1 = CreateObject(id, x, y, z, rx, ry, rz);

DestroyObject(Object1);
Reply
#3

Quote:
Originally Posted by .•[XpoweR
•. ]
lol ur funny too D:

create object then destroy in the same time lol...
What?!?! I was showing him an example of HOW TO destroy an object not give him the exact code to copy into his script. Even if he is a beginner I think he can see now from what I showed him what he needs to do in his script. I cannot give him the exact working code because well I don't have all objects etc. What I showed was exactly how to store the objects information into a variable that CAN be destroyed which is what he asked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)