16.06.2016, 05:12
Hey guys. So i was wondering how can i make if player leaves area for robbank robbering will be interrupted
new RobCheck[MAX_PLAYERS];
RobCheck[playerid] = SetTimerEx("RobCheck[playerid]", 3000, 1, "d", playerid);
forward RobCheck(forward); public RobCheck(playerid) { if(PlayerVariable[playerid][pRob] == 1) { if(IsPlayerInRangeOfPoint(playerid, 30.0, x,y,z)) { SendClientMessage(playerid, COLOR_WHITE,"Rob Accepted."); } else { SendClientMessage(playerid, COLOR_WHITE, " You are far away from the rob point. Rob Failed."); PlayerVariable[playerid][pRob] = 0; KillTimer(RobCheck[playerid]); } } return 1; }
KillTimer(RobCheck[playerid]);
You can use a timer which is verifying if that player is in a range of a point.
Then, you are using the rob variable. For example: Код HTML:
new RobCheck[MAX_PLAYERS]; Код HTML:
RobCheck[playerid] = SetTimerEx("RobCheck[playerid]", 3000, 1, "d", playerid); Код HTML:
forward RobCheck(forward); public RobCheck(playerid) { if(PlayerVariable[playerid][pRob] == 1) { if(IsPlayerInRangeOfPoint(playerid, 30.0, x,y,z)) { SendClientMessage(playerid, COLOR_WHITE,"Rob Accepted."); } else { SendClientMessage(playerid, COLOR_WHITE, " You are far away from the rob point. Rob Failed."); PlayerVariable[playerid][pRob] = 0; KillTimer(RobCheck[playerid]); } } return 1; } Код HTML:
KillTimer(RobCheck[playerid]); |
forward RobCheck(forward); public RobCheck(playerid) { if(PlayerVariable[playerid][pRob] == 1) { if(!IsPlayerInRangeOfPoint(playerid, r, x,y,z)) { SendClientMessage(playerid, COLOR_RED, "You exited the bank! Rob failed!"); PlayerVariable[playerid][pRob] = 0; KillTimer(RobCheck[playerid]); } } return 1; }
new RobAmount[MAX_PLAYERS]; forward RobCheck(forward); public RobCheck(playerid) { if(PlayerVariable[playerid][pRob] == 1) { if(IsPlayerInRangeOfPoint(playerid, 30.0, x,y,z)) { new amount = 1000+random(5000); RobAmount[playerid] += amount; } else { SendClientMessage(playerid, COLOR_WHITE, " You are far away from the rob point. Rob Failed."); PlayerVariable[playerid][pRob] = 0; KillTimer(RobCheck[playerid]); } } return 1; }