How to make it so that when a player who has skin type 280 types /undercover in his car that he gets a police light on the roof , and when he types off duty or change skin the light goes away ?
pawn Код:
new bool:pLightStatus[MAX_PLAYERS];//global variable
new pLightObject[MAX_PLAYERS];//global variable
//if(!strcmp(cmdtext,"/undercover",true)) IF you dont use zcmd uncomment this line and ...
CMD:undercover(playerid) // ... and delete this one
{
new v = GetPlayerVehicleID(playerid);
if(!pLightStatus[playerid])
{
pLightObject[playerid] = CreateObject(18646, 0.0001, 0.0200, -16.0000, 0, 0, 0);
AttachObjectToVehicle(pLightObject[playerid], v, -0.34, -0.17, 0.64, -2.00, 0.00, 4.00);
pLightStatus[playerid] = true;
return 1;
}
else
{
DestroyObject(pLightObject[playerid]);
pLightStatus[playerid] = false;
return 1;
}
}