Robbing bank
#1

I have a problem with my /robbank command. When someone robs the bank and leaves the bank before it's done he still is robbing it. I want it too end when he leaves the bank. This is how the code is now:

Код:
	if(strcmp(cmd, "/robbank", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(robbing[playerid] == 1)
			{
				SendClientMessage(playerid, COLOR_GREY, " You are already robbing the bank, please slow down");
				return 1;
			}
			if(alreadyrobbed[playerid] == 1)
			{
			    SendClientMessage(playerid, COLOR_WHITE, "You already robbed the bank! Wait 1 hour.");
			    return 1;
   			}
			if(PlayerInfo[playerid][pFMember] == 255)
	        {
	            SendClientMessage(playerid, COLOR_GREY, " You are not in a family");
	            return 1;
			}
			if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2308.8071,-13.2485,26.7422))
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You are not at the bank !");
	            return 1;
	        }
					SendClientMessage(playerid, COLOR_WHITE, " You started to rob the bank, This will take 10 minutes");
					SetTimerEx("bankrob", 600000, false, "i", playerid);
					robbing[playerid] = 1;
					LoopingAnim(playerid,"ped", "ARRESTgun", 4.0, 0, 1, 1, 1, 0);
                    SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
					SendClientMessageToAll(COLOR_WHITE, " The bank is currently getting robbed.");
					SendClientMessageToAll(COLOR_WHITE, " We are currently waiting for the cops");
					SendClientMessageToAll(COLOR_WHITE, " We will report more when we get more information");
					SendClientMessageToAll(COLOR_ORANGE, "||----------Latest News----------||");
					return 1;
				}
   			}
Reply
#2

Find OnPlayerInteriorChange callback, and put this into it:
pawn Код:
if(oldinterior == [bank interior])
{
    if(robbing[playerid] == 1)
    {
        //your code to stop bank robbing
        robbing[playerid] = 0;
    }
}
Change "[bank interior]" to real bank's interior.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)