Siren help
#1

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.
Reply
#2

Make the sirenstatus for all playerids!
It's getting mixed up with other playerid becouse it's public variable
Reply
#3

Can you correct it for me, im clueless.
Reply
#4

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;
    }
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)