16.09.2013, 23:02
Hello.
I made this command and went inside the server to test it. When my friend came online we noticed that when the other puts on his siren the other ones dissapears. Here is the code..
I made this command and went inside the server to test it. When my friend came online we noticed that when the other puts on his siren the other ones dissapears. Here is the code..
pawn Код:
if(!strcmp(cmd,"/siren",true))
{
if(IsACop(playerid))
{
new carid = GetPlayerVehicleID(playerid);
new x_nr[24];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /siren [type]");
SendClientMessage(playerid, COLOR_GREY, "Types: Inside, Roof, Off.");
return 1;
}
if(!strcmp(x_nr,"inside",true))
{
DestroyObject(SirenObject[carid]);
SirenObject[carid] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[carid], carid, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
Siren[carid] = 1;
format(string, sizeof(string), "* Law Enforcer puts the siren on the dashboard.");
ProxDetector(30.0, playerid, string, COLOR_RLRPGBLUE,COLOR_RLRPGBLUE,COLOR_RLRPGBLUE,COLOR_RLRPGBLUE,COLOR_RLRPGBLUE);
return 1;
}
if(!strcmp(x_nr,"roof",true))
{
DestroyObject(SirenObject[carid]);
SirenObject[carid] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[carid], carid, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
Siren[carid] = 1;
format(string, sizeof(string), "* Law Enforcer puts the siren on the roof.");
ProxDetector(30.0, playerid, string, COLOR_RLRPGBLUE,COLOR_RLRPGBLUE,COLOR_RLRPGBLUE,COLOR_RLRPGBLUE,COLOR_RLRPGBLUE);
return 1;
}
if(!strcmp(x_nr,"off",true))
{
if(Siren[carid] == 1)
{
Siren[carid] = 0;
DestroyObject(SirenObject[carid]);
format(string, sizeof(string), "* Law Enforcer takes down the siren.");
ProxDetector(30.0, playerid, string, COLOR_RLRPGBLUE,COLOR_RLRPGBLUE,COLOR_RLRPGBLUE,COLOR_RLRPGBLUE,COLOR_RLRPGBLUE);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1,"This vehicle does not have a siren on!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use this command.");
return 1;
}
return 1;
}