Objects
#1

I have used CreatePlayerObject to create some objects for any player that connects to my server, but I also want to make a command that will destroy all of those objects at the same time. Do I need to add all the CreatePlayerObject functions to an array or something?
Reply
#2

i did it this way once; (BTW: other players wont see your playerobject as you have it)
pawn Код:
new FreeRoamObjects[MAX_OBJECTS];

CreatePlayerFreeroamObject(playerid, modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ)
{
    new FreeO = CreatePlayerObject(playerid, modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ);
    FreeRoamObjects[FreeO] = 1;
    return FreeO;
}

stock DestroyFreeroamItems(playerid)
{
    RemovePlayerMapIcon( playerid,0);
    for(new o=0;o<MAX_OBJECTS; o++)
    {
    if(FreeRoamObjects[o] ==1)
    {
    DestroyPlayerObject(playerid,o);
    }
    }
}
Hope you understand any of it...anyway..instead of CreateObject you can use CreatePlayerFreeroamObject
If you use that DestroyFreeroamItems(playerid) will destroy every CreatePlayerFreeroamObject for that player.
You can simply create them again.

Have fun!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)