Siren help - 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: Siren help (
/showthread.php?tid=396008)
Siren help -
UnknownGamer - 28.11.2012
pawn Код:
if(!strcmp(cmd,"/siren", true))
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3 || IsAFreecop(playerid))
{
new SirenObject[MAX_VEHICLES];
new VID = GetPlayerVehicleID(playerid);
if (sirenstatus == 0)
{
SirenObject[VID] = CreateObject(19419, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000);
sirenstatus = 1;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Undercover, Siren added!");
return 1;
}
else if(sirenstatus == 1)
{
DestroyObject(SirenObject[VID]);
sirenstatus = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Undercover, Siren removed!");
return 1;
}
}
return 1;
}
Anybody spot the error, where i do siren to remove it, and it doesn't remove? It adds okay, but doesn't remove.
Re: Siren help -
park4bmx - 28.11.2012
Make the
sirenstatus for all playerids!
It's getting mixed up with other playerid becouse it's public variable
Re: Siren help -
UnknownGamer - 28.11.2012
Can you correct it for me, im clueless.
Re: Siren help -
park4bmx - 28.11.2012
Couple more things wrong
pawn Код:
//top of script
new sirenstatus[MAX_PLAYERS];
new SirenObject[MAX_VEHICLES];//also outside of the cmd becouse it will forget the id
if(!strcmp(cmd,"/siren", true))
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3 || IsAFreecop(playerid))
{
new VID = GetPlayerVehicleID(playerid);
if (sirenstatus[playerid] == 0)
{
SirenObject[VID] = CreateObject(19419, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, 0.009999, -0.019999, 0.944999, 0.000000, 0.000000, 0.000000);
sirenstatus[playerid] = 1;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Undercover, Siren added!");
return 1;
}
else if(sirenstatus[playerid] == 1)
{
DestroyObject(SirenObject[VID]);
sirenstatus[playerid] = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Undercover, Siren removed!");
return 1;
}
}
return 1;
}