Detect if a Player has left their Position.
#1

Once again, I need help. I was how I would detect when a person types /holdup if he moves 5.0+ radius away before he's robbed the store/house. I'll Kill the timer. Help? <3
Reply
#2

Can you explain a little more please?
Reply
#3

I walk up the the 24/7.
I type /holdup.
The Timer has been Activated.
If I move 5.0 radius (I duno wtf I'm saying here) away from the place where /holdup was put.
The timer will be killed, therefore meaning you failed to rob the store.
Reply
#4

Untested, but somethign like this.
pawn Код:
//top
new Timer[MAX_PLAYERS];

//onplayercommandtext
if(strcmp(cmdtext, "/holdup", true) == 0)
{
  new Float:x, Float:y, Float:z;
  GetPlayerPos(playerid, x, y, z);
  SendClientMessage(playerid, color, "Don't move from this position or the robbery will fail!");
  Timer[playerid] = SetTimerEx("LeftArea", 500, 1, "ifff", playerid, x, y, z);
  return 1;
}

//after main()
forward LeftArea(playerid, Float:X, Float:Y, Float:Z);
public  LeftArea(playerid, Float:X, Float:Y, Float:Z)
{
  if(!PlayerToPoint(5, playerid, X, Y, Z);
  {
   KillTimer(Timer[playerid]);
   SendClientMessage(playerid, color, "You left the area! The robbery is a bust!");
   //your code for stoping, w/e
  }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)