Robbery Failed
#1

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

Use https://sampwiki.blast.hk/wiki/IsPlayerInCheckpoint
Reply
#3

Where to put it,and how?
Reply
#4

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

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

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?
Reply
#7

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

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)