SA-MP Forums Archive
Leaving checkpoint - 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: Leaving checkpoint (/showthread.php?tid=477052)



Leaving checkpoint - DarkLored - 21.11.2013

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!");
    }



Re: Leaving checkpoint - RayDcosta - 21.11.2013

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


Re: Leaving checkpoint - DarkLored - 21.11.2013

Can you post a code or something cause it dosent help


Re: Leaving checkpoint - CrossOv3r - 21.11.2013

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



Re: Leaving checkpoint - DarkLored - 22.11.2013

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


AW: Leaving checkpoint - Littl3j0hNy - 22.11.2013

Just put your code after that comment

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