Leaving checkpoint
#1

Hello guys i made a robbery command but i was wondering how to make if a player is leaving during the robbery the robbery stops and says Robbery failed you have left the checkpoint

Here is my code:

pawn Код:
if(IsPlayerInDynamicCP(playerid,Checkpoint[5]))
    {
       SetPVarInt(playerid, "RobbingCityHall", 30);
       SetPVarInt(playerid, "CityHallRobbedRecently", 1);
       IncreaseWantedLevel(playerid,4);
       @Robbing1(playerid);
       format(string,sizeof(string),"%s(%d) Has started a robbery at Los Santos City Hall he is wanted level to: %d",GetName(playerid),playerid,GetPlayerWantedLevel(playerid));
       SendClientMessageToAll(COLOR_ORANGE,string);
       return 1;
    }
    else
    {
       SendClientMessage(playerid,COLOR_ERROR,"You are not in any checkpoint!");
    }
Reply
#2

i think you should try
negation of if(IsPlayerInRangeOfPoint .............
and set it to be like a 5point radius, and if he leaves you can cancel the robbery and display text to him informing him of the same.
cheers
Reply
#3

Can you post a code or something cause it dosent help
Reply
#4

Use this callback.

OnPlayerLeaveCheckpoint

https://sampwiki.blast.hk/wiki/OnPlayerLeaveCheckpoint

EDIT: If you‘r using Streamer use callback:

pawn Код:
public OnPlayerLeaveDynamicCP(playerid, checkpointid);
{
return 1;
}
Reply
#5

I am testing it right now if it will work i will edit this post
Reply
#6

Just put your code after that comment

pawn Код:
public OnPlayerLeaveDynamicCP(playerid, checkpointid);
{
    if(checkpointid == Checkpoint[5])
    {
        // Left robbery CP
    }
    return 1;
}
good luck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)