#1

I don't understand why if I do /siren while onfoot it says "You are not in a vehicle" then when i'm inside a vehicle then I do /siren it says "Siren Deactivated"?


So its like I already activated the siren while onfoot? even it says You are not in a vehicle?


Код:
CMD:siren(playerid, params[])
{
	if(pInfo[playerid][Donator] >= 1)
    {
        if(IsSiren[playerid] == 0)
        {
            IsSiren[playerid] = 1;
            if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, white, "{FF0000}>> You are not in a vehicle");
            if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, white, "{FF0000}>> You must be the driver to use this Command");
            new VID = GetPlayerVehicleID(playerid);
            if(Siren[VID] == 1) return SendClientMessage(playerid, white, "{FF0000}>> This vehicle already has a Siren");
            Siren[VID] = 1;
            GameTextForPlayer(playerid,"~y~Siren ~g~~n~Activated",2000,3);
            SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
            AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
        }
        else
        {
            IsSiren[playerid] = 0;
            if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, white, "{FF0000}>> You are not in a vehicle");
            if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, white, "{FF0000}>> You must be the driver to use this Command");
            new VID = GetPlayerVehicleID(playerid);
            if(Siren[VID] == 0)
            Siren[VID] = 0;
            GameTextForPlayer(playerid,"~y~Siren ~r~~n~Deactivated",2000,3);
            DestroyObject(SirenObject[VID]);
        }
    }
    else return ShowPlayerDialog(playerid, DIALOG_NOVIP, DIALOG_STYLE_MSGBOX, "{09F7DF}NONE-VIP Members", "\nYou must be at least VIP Level 1 (Bronze)", "Close", "");
    return 1;
}
Reply
#2

Try this buddy:


PHP код:
CMD:siren(playeridparams[])
{
    if(
pInfo[playerid][Donator] >= 1)
    {
        if(
IsSiren[playerid] == 0)
        {
            
IsSiren[playerid] = 1;
            if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridwhite"{FF0000}>> You are not in a vehicle");
            if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridwhite"{FF0000}>> You must be the driver to use this Command");
            new 
VID GetPlayerVehicleID(playerid);
            if(
Siren[VID] == 1) return SendClientMessage(playeridwhite"{FF0000}>> This vehicle already has a Siren");
            
Siren[VID] = 1;
            
GameTextForPlayer(playerid,"~y~Siren ~g~~n~Activated",2000,3);
            
SirenObject[VID] = CreateObject(1864610.010.010.0000);
            
AttachObjectToVehicle(SirenObject[VID], VID, -0.430.00.7850.00.10.0);
        }
        else
        {
            
IsSiren[playerid] = 0;
            if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridwhite"{FF0000}>> You are not in a vehicle");
            if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridwhite"{FF0000}>> You must be the driver to use this Command");
            new 
VID GetPlayerVehicleID(playerid);
            if(
Siren[VID] == 0)
            
Siren[VID] = 0;
            
GameTextForPlayer(playerid,"~y~Siren ~r~~n~Deactivated",2000,3);
            
DestroyObject(SirenObject[VID]);
        }
    }
        else return 
ShowPlayerDialog(playeridDIALOG_NOVIPDIALOG_STYLE_MSGBOX"{09F7DF}NONE-VIP Members""\nYou must be at least VIP Level 1 (Bronze)""Close""");
    return 
1;

Reply
#3

@UP: Nope

pawn Код:
IsSiren[playerid] = X;
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, white, "{FF0000}>> You are not in a vehicle");
Switch those lines (there are two instances of them, with X = 0 and 1)
Reply
#4

Quote:
Originally Posted by thomaswilliams
Посмотреть сообщение
Try this buddy:


PHP код:
CMD:siren(playeridparams[])
{
    if(
pInfo[playerid][Donator] >= 1)
    {
        if(
IsSiren[playerid] == 0)
        {
            
IsSiren[playerid] = 1;
            if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridwhite"{FF0000}>> You are not in a vehicle");
            if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridwhite"{FF0000}>> You must be the driver to use this Command");
            new 
VID GetPlayerVehicleID(playerid);
            if(
Siren[VID] == 1) return SendClientMessage(playeridwhite"{FF0000}>> This vehicle already has a Siren");
            
Siren[VID] = 1;
            
GameTextForPlayer(playerid,"~y~Siren ~g~~n~Activated",2000,3);
            
SirenObject[VID] = CreateObject(1864610.010.010.0000);
            
AttachObjectToVehicle(SirenObject[VID], VID, -0.430.00.7850.00.10.0);
        }
        else
        {
            
IsSiren[playerid] = 0;
            if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridwhite"{FF0000}>> You are not in a vehicle");
            if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridwhite"{FF0000}>> You must be the driver to use this Command");
            new 
VID GetPlayerVehicleID(playerid);
            if(
Siren[VID] == 0)
            
Siren[VID] = 0;
            
GameTextForPlayer(playerid,"~y~Siren ~r~~n~Deactivated",2000,3);
            
DestroyObject(SirenObject[VID]);
        }
    }
        else return 
ShowPlayerDialog(playeridDIALOG_NOVIPDIALOG_STYLE_MSGBOX"{09F7DF}NONE-VIP Members""\nYou must be at least VIP Level 1 (Bronze)""Close""");
    return 
1;

Doesn't work still the same.

I don't know why but siren activates even im not in a vehicle.
Reply
#5

Quote:
Originally Posted by Misiur
Посмотреть сообщение
@UP: Nope

pawn Код:
IsSiren[playerid] = X;
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, white, "{FF0000}>> You are not in a vehicle");
Switch those lines (there are two instances of them, with X = 0 and 1)
Man this works but when I do /siren again it says "This vehicle already has a Siren" it should remove my siren after I do /siren again.
Reply
#6

Move them further down:
pawn Код:
CMD:siren(playerid, params[])
{
    if(pInfo[playerid][Donator] >= 1)
    {
        if(!IsSiren[playerid])
        {
            if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, white, "{FF0000}>> You are not in a vehicle");
            if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, white, "{FF0000}>> You must be the driver to use this Command");
            new VID = GetPlayerVehicleID(playerid);
            if(Siren[VID] == 1) return SendClientMessage(playerid, white, "{FF0000}>> This vehicle already has a Siren");
            Siren[VID] = 1;
            IsSiren[playerid] = 1;
            GameTextForPlayer(playerid,"~y~Siren ~g~~n~Activated",2000,3);
            SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
            AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
        }
        else
        {
            if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, white, "{FF0000}>> You are not in a vehicle");
            if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, white, "{FF0000}>> You must be the driver to use this Command");
            new VID = GetPlayerVehicleID(playerid);
            if(Siren[VID] == 0) return SendClientMessage(playerid, white, "{FF0000}>> There should be something");
            Siren[VID] = 0;
            IsSiren[playerid] = 0;
            GameTextForPlayer(playerid,"~y~Siren ~r~~n~Deactivated",2000,3);
            DestroyObject(SirenObject[VID]);
        }
    }
    else return ShowPlayerDialog(playerid, DIALOG_NOVIP, DIALOG_STYLE_MSGBOX, "{09F7DF}NONE-VIP Members", "\nYou must be at least VIP Level 1 (Bronze)", "Close", "");
    return 1;
}
Reply
#7

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Move them further down:
pawn Код:
CMD:siren(playerid, params[])
{
    if(pInfo[playerid][Donator] >= 1)
    {
        if(!IsSiren[playerid])
        {
            if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, white, "{FF0000}>> You are not in a vehicle");
            if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, white, "{FF0000}>> You must be the driver to use this Command");
            new VID = GetPlayerVehicleID(playerid);
            if(Siren[VID] == 1) return SendClientMessage(playerid, white, "{FF0000}>> This vehicle already has a Siren");
            Siren[VID] = 1;
            IsSiren[playerid] = 1;
            GameTextForPlayer(playerid,"~y~Siren ~g~~n~Activated",2000,3);
            SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
            AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
        }
        else
        {
            if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, white, "{FF0000}>> You are not in a vehicle");
            if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, white, "{FF0000}>> You must be the driver to use this Command");
            new VID = GetPlayerVehicleID(playerid);
            if(Siren[VID] == 0) return SendClientMessage(playerid, white, "{FF0000}>> There should be something");
            Siren[VID] = 0;
            IsSiren[playerid] = 0;
            GameTextForPlayer(playerid,"~y~Siren ~r~~n~Deactivated",2000,3);
            DestroyObject(SirenObject[VID]);
        }
    }
    else return ShowPlayerDialog(playerid, DIALOG_NOVIP, DIALOG_STYLE_MSGBOX, "{09F7DF}NONE-VIP Members", "\nYou must be at least VIP Level 1 (Bronze)", "Close", "");
    return 1;
}
OMG Thanks man! Its all working fine now. +rep man. nice to meet you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)