25.06.2013, 16:14
Hello, I'm editing a basic bank filterscript. What/where can I add to my script so that if the player leaves the point(the bank), it does not give him the money and returns a message saying "You left the bank!"?
Any help would be greatly appreciated! Thanks!
Heres the code:
Any help would be greatly appreciated! Thanks!
Heres the code:
pawn Code:
#include <a_samp>
#include <zcmd>
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_PURPLE 0xC2A2DAAA
forward robtimer(playerid);
forward waittimer();
new robpossible;
public OnFilterScriptInit()
{
robpossible = 1;
return 1;
}
CMD:robbank(playerid, params[])
{
if(robpossible == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 50, 2144.2012,1640.6323,993.5761))
{
robpossible = 0;
SetTimer("waittimer", 30000, false);
SetTimer("robtimer", 5000, false);
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+4);
SendClientMessage(playerid, COLOR_WHITE, "You are now robbing the bank, the police have been notified!");
SendClientMessage(playerid, COLOR_WHITE, "You must stay in the bank for 5 minutes in order to rob it!");
SendClientMessageToAll(COLOR_PURPLE, "*** . . : : You may hear alarms and sirens screaming outside the bank in Mulholland: : . . ***");
}
} else {
SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now!");
}
return 1;
}
//quick bank teleport for testing
CMD:bank(playerid, params[])
{
SetPlayerPos(playerid, 2144.2012,1640.6323,993.5761);
SetPlayerInterior(playerid, 1);
return 1;
}
public robtimer(playerid)
{
new string[128];
new cash = random(85000);
GivePlayerMoney(playerid, cash);
format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
SendClientMessage(playerid, COLOR_WHITE, string);
}
public waittimer()
{
robpossible = 1;
}