Make this command toggle?
#2

I would just create a variable 'SirenStatus' and use that to store and determine the siren status.

Код:
new SirenStatus[MAX_PLAYERS] = false;

CMD:siren(playerid, params[]) 
{ 
    if(fInfo[playerid][fPolice] != 1) return SCM(playerid, COR_CINZA, "You are not a Police Officer."); 
    if(SirenStatus[playerid] == true) // Siren is already on
    {
    	SirenStatus[playerid] = false; // The siren is on, so we turn it off.
    	// Place code here to turn off the siren
        return SendClientMessage(playerid, COLOR_GREY, "You turned your siren off."); 
    }
    SirenStatus[playerid] = true; // The siren is off, so we turn it on.
    glob4 = GetPlayerVehicleID(playerid); 
    glob3 = CreateObject(18646, -0.7, 0.15, 0.85, 0.0, 0.0, 96.0, 0); 
    AttachObjectToVehicle(glob3, glob4, 0.014999, -0.379999, 0.914999, 0.000000, 0.000000, 0.000000); 
    SendClientMessage(playerid, COLOR_GREY, "You turned your siren on."); 
    return 1; 
}
Reply


Messages In This Thread
Make this command toggle? - by insus100 - 02.12.2017, 22:48
Re: Make this command toggle? - by MEW273 - 02.12.2017, 23:02
Re: Make this command toggle? - by insus100 - 02.12.2017, 23:12
Re: Make this command toggle? - by MEW273 - 02.12.2017, 23:15
Re: Make this command toggle? - by thefirestate - 02.12.2017, 23:16
Re: Make this command toggle? - by insus100 - 02.12.2017, 23:16
Re: Make this command toggle? - by thefirestate - 02.12.2017, 23:20
Re: Make this command toggle? - by insus100 - 02.12.2017, 23:26

Forum Jump:


Users browsing this thread: 3 Guest(s)