Chek if player is in the range of prison cell
#1

Hello, I'm using this prison: https://sampforum.blast.hk/showthread.php?tid=167522
I want to check if player is still in the prison cell after I jail him.
Because with AirBrk they flee from the prison.
I want to check if player is still in the prison cell and if he's not there, to teleport him again into the prison cell.
For example, to check whether the player is up to 5 meters away from specified coordinates or something like that?
Is that possible?
Reply
#2

Still thinking about that...
Reply
#3

Yes, check this out:
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

I can make an example:
pawn Код:
// Set a timer in OnGamemodeInit that's like about 3 seconds or so, and in the "public":
if(IsPlayerInJail) // Replace with your variable to check if the player is in prison
{
    if(!IsPlayerInRangeOfPoint(playerid, {Range}, {X-Coordinate of point}, {Y-Coordinate of point}, {Z-Coordinate of point})) // With a " ! " to check if the player is NOT in range of point.
// Then put in the range (how far the player can be before the function gets activated)
// Then put in the coordinates of the "point"
    {
        SetPlayerPos(playerid, x, y, z) // Replace X Y and Z with the X-Y-Z coordinates you want the player teleported to if he gets far enough from the point you set above
    }
    return 1;
}
Unless airbreaking in your server is allowed, i would recommend sending a ClientMessage to all admins that he might be airbreaking too.
Reply
#4

I'll try this example in my gamemode.
But how I can disable airbreaking?
Reply


Forum Jump:


Users browsing this thread: