SA-MP Forums Archive
need help with sirens - 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: need help with sirens (/showthread.php?tid=383460)



need help with sirens - fireboy - 07.10.2012

hello, i need some help with siren script.
how can i create /destroysiren command, who destroy the siren?

siren filterscript: http://pastebin.com/R4j5kVg0


thank you for your help.


Re: need help with sirens - rbush12 - 07.10.2012

Combine them together like this.

PHP код:
if(strcmp(cmd"/siren"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
IsACop(playerid) && PlayerInfo[playerid][pRank] >= 6)
            {
                new 
siren[65];
                new 
VID GetPlayerVehicleID(playerid);
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /siren [inside, roof, off]");
                    
SendClientMessage(playeridCOLOR_GREY"HINT: 'off' will remove the item from your vehicle.");
                    return 
1;
                }
                
strmid(sirentmp0strlen(cmdtext), 255);
                if(
strcmp(siren"inside"truestrlen(siren)) == 0)
                {
                    if(
Siren[VID] == 0)
                    {
                        
Siren[VID] = 1;
                        
SirenObject[VID] = CreateObject(1864610.010.010.0000);
                        
AttachObjectToVehicle(SirenObject[VID], VID0.00.750.2750.00.10.0);
                        
format(stringsizeof(string), "* Law Enforcer puts the siren on the dashboard.");
                        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    } else { return 
SendClientMessage(playeridCOLOR_GREY"This vehicle already has a siren!"); }
                }
                else if(
strcmp(siren"roof"truestrlen(siren)) == 0)
                {
                    if(
Siren[VID] == 0)
                    {
                        
Siren[VID] = 1;
                        
SirenObject[VID] = CreateObject(1864610.010.010.0000);
                        
AttachObjectToVehicle(SirenObject[VID], VID0.00.00.7850.00.10.0);
                        
format(stringsizeof(string), "* Law Enforcer puts the siren on the roof.");
                        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    } else { return 
SendClientMessage(playeridCOLOR_GREY"This vehicle already has a siren!"); }
                }
                else if(
strcmp(siren"off"truestrlen(siren)) == 0)
                {
                    if(
Siren[VID] == 1)
                    {
                     
Siren[VID] = 0;
                     
DestroyObject(SirenObject[VID]);
                     
format(stringsizeof(string), "* Law Enforcer takes down the siren.");
                     
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    } else { return 
SendClientMessage(playeridCOLOR_GREY"This vehicle doesn't have siren!"); }
                }
            } else { 
SendClientMessage(playeridCOLOR_GREY"   You are not part of a Team!"); }
        }
        return 
1;
    }