SA-MP Forums Archive
Robbery Failed - 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: Robbery Failed (/showthread.php?tid=635713)



Robbery Failed - Cyboorg - 12.06.2017

I used the code when the player is out of checkpoint of,the robbery must fail.

PHP код:
case FBI_ROB:
        {
            if(
IsRobbingFBI{playerid} == true)
            {
                
KillTimer(fbitimer{playerid});
                
IsRobbingFBI{playerid} = false;
                
GameTextForPlayer(playerid,"~r~Robbery Failed"30005);
                
SendClientMessage(playerid,RED,"You have left the checkpoint and failed the robbery.");
            }
            else
            {
                
IsRobbingFBI{playerid} = false;
            }
        } 
But the robbery won't stop even if i go out of checkpoint and i step in any other checkpoint? what's the problem ?


Re: Robbery Failed - Amads - 12.06.2017

Use https://sampwiki.blast.hk/wiki/IsPlayerInCheckpoint


Re: Robbery Failed - Cyboorg - 12.06.2017

Where to put it,and how?


Re: Robbery Failed - Amads - 12.06.2017

Код:
if(IsRobbingFBI{playerid} == true && IsPlayerInCheckpoint(playerid) == true)



Re: Robbery Failed - Cyboorg - 12.06.2017

Quote:

C:\Users\Desktop\SERVER\gamemodes\LVCNR.pwn(8378) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

Warning

Not working...


Re: Robbery Failed - Vince - 12.06.2017

Timer ids are not reused so your fbitimer variable will eventually go out of bounds. Use a normal array for that. Also not enough context. Is there anything above the switch that may be blocking execution? And have you tried printing checkpoint ids to see if the match?


Re: Robbery Failed - Cyboorg - 12.06.2017

All lines
Quote:

public OnCheckpointEXIT(playerid, checkpointid)
{
switch(checkpointid)
{
case CELLCP_1:
{
IsInCellCP{playerid} = false;
IsInCellCP1{playerid} = false;
}
case CELLCP_2:
{
IsInCellCP{playerid} = false;
IsInCellCP2{playerid} = false;
}
case CELLCP_3:
{
IsInCellCP{playerid} = false;
IsInCellCP3{playerid} = false;
}
case CELLCP_4:
{
IsInCellCP{playerid} = false;
IsInCellCP4{playerid} = false;
}
case CELLCP_5:
{
IsInCellCP{playerid} = false;
IsInCellCP5{playerid} = false;
}
case CELLCP_6:
{
IsInCellCP{playerid} = false;
IsInCellCP6{playerid} = false;
}
case NV_UNI_CP3:
{
if(IsRobbingUNI{playerid} == true)
{
KillTimer(unitimer{playerid});
IsRobbingUNI{playerid} = false;
GameTextForPlayer(playerid,"~r~Robbery Failed", 3000, 5);
SendClientMessage(playerid,RED,"You have left the checkpoint and failed the robbery.");
}
else
{
IsRobbingUNI{playerid} = false;
}
}
case FBI_ROB:
{
if(IsRobbingFBI{playerid} == true)
{
KillTimer(fbitimer{playerid});
IsRobbingFBI{playerid} = false;
GameTextForPlayer(playerid,"~r~Robbery Failed", 3000, 5);
SendClientMessage(playerid,RED,"You have left the checkpoint and failed the robbery.");
}
else
{
IsRobbingFBI{playerid} = false;
}
}

case CIA_CP3:
{
if(IsRobbingCIA{playerid} == true)
{
KillTimer(ciatimer{playerid});
IsRobbingCIA{playerid} = false;
GameTextForPlayer(playerid,"~r~Robbery Failed", 3000, 5);
SendClientMessage(playerid,RED,"You have left the checkpoint and failed the robbery.");
}
else
{
IsRobbingCIA{playerid} = false;
}
}


}

return 1;
}