Siren command is defective
#1

I have made a siren command but when I type it , it puts the siren on my car and then when another player types it it takes the siren off the car how can I make it so it will only take it off the car if they're in my car and also so they can place more than one siren in the whole map here is the code
pawn Код:
CMD:siren(playerid, params[])
{
    if(!IsValidObject(myobject))
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 560 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 415 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 541)
        {
            myobject = CreateObject(18646,0,0,-1000,0,0,0,100);
            AttachObjectToVehicle(myobject, GetPlayerVehicleID(playerid), 0.449999,0.000000,0.599999,0.000000,0.000000,0.000000);
         }
    }
    else
    {
        DestroyObject(myobject);
    }
    return 1;
}
Reply
#2

new myobject[MAX_PLAYERS];
And on creation/destruction: myobject[playerid]

So each player has his own siren.
Reply
#3

MAX_PLAYER array.
pawn Код:
new myobject[MAX_PLAYERS];

myobject[playerid] = CreateObject(...);

DestroyObject(myobject[playerid]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)