SA-MP Forums Archive
Undercover command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Undercover command (/showthread.php?tid=327946)



Undercover command - [LHT]Bally - 23.03.2012

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 ?


Re: Undercover command - Faisal_khan - 23.03.2012

Hope this works for you:
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;
        }
    }