/robatm system help?
#1

I need help with this. When I execute the command all it gets to is the timer but when the timer finishes nothing happens... Can somebody tell me why? Or How to fix it? Do the publics need to be above the command? Maybe thats the problem.

Код:
new atmTimer[MAX_PLAYERS];
new atmRobbing[MAX_PLAYERS];
new atmPlayTimer[MAX_PLAYERS];

CMD:robatm(playerid, params[])
{
	if(IsAtATM(playerid))
	{
	    if(atmTimer[playerid] == 1)
	    return SendClientMessage(playerid, COLOR_GRAD1,"You can only rob an atm every 15 minutes!");
		new Float: x, Float: y, Float: z;
		GetPlayerPos(playerid, x, y, z);
		SetAllCopCheckpoint(x,y,z,10);
		SendRadioMessage(1, COLOR_DBLUE, "[Dispatch]: All units be advised. ATM Robbery in progress, Coords relayed on your GPS!");
		SendRadioMessage(2, COLOR_DBLUE, "[Dispatch]: All units be advised. ATM Robbery in progress, Coords relayed on your GPS!");
		SendRadioMessage(3, COLOR_DBLUE, "[Dispatch]: All units be advised. ATM Robbery in progress, Coords relayed on your GPS!");
		TogglePlayerControllable(playerid, 0);
		atmRobbing[playerid] = SetTimerEx("robbingatm",30000,false,"d", playerid);
		return 1;
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not at an ATM that can be robbed!");
		return 1;
	}
}

forward robbingatm(playerid);
public robbingatm(playerid)
{
	atmTimer[playerid] ++;
	new rrand = random(75000);
	GivePlayerMoney(playerid += rrand);
 	SendClientMessageEx(playerid,COLOR_GREEN,"You Robbed $%d From the ATM",rrand);
	TogglePlayerControllable(playerid, 1);
	atmPlayTimer[playerid] = SetTimerEx("antiatmrob", 900000,false,"d",playerid);
	return 1;
}

forward antiatmrob(playerid);
public antiatmrob(playerid)
{
	atmTimer[playerid] --;
	return 1;
}
Reply
#2

Try This out cuz atmTimer[playerid]--; wont work i think so.. so setting the variable directly to 0 might work

pawn Код:
new atmTimer[MAX_PLAYERS];
new atmRobbing[MAX_PLAYERS];
new atmPlayTimer[MAX_PLAYERS];

CMD:robatm(playerid, params[])
{
    if(IsAtATM(playerid))
    {
        if(atmTimer[playerid] == 1)
        return SendClientMessage(playerid, COLOR_GRAD1,"You can only rob an atm every 15 minutes!");
        new Float: x, Float: y, Float: z;
        GetPlayerPos(playerid, x, y, z);
        SetAllCopCheckpoint(x,y,z,10);
        SendRadioMessage(1, COLOR_DBLUE, "[Dispatch]: All units be advised. ATM Robbery in progress, Coords relayed on your GPS!");
        SendRadioMessage(2, COLOR_DBLUE, "[Dispatch]: All units be advised. ATM Robbery in progress, Coords relayed on your GPS!");
        SendRadioMessage(3, COLOR_DBLUE, "[Dispatch]: All units be advised. ATM Robbery in progress, Coords relayed on your GPS!");
        TogglePlayerControllable(playerid, 0);
        atmRobbing[playerid] = SetTimerEx("robbingatm",30000,false,"d", playerid);
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "You are not at an ATM that can be robbed!");
        return 1;
    }
}

forward robbingatm(playerid);
public robbingatm(playerid)
{
    atmTimer[playerid]  = 1;
    new rrand = random(75000);
    GivePlayerMoney(playerid += rrand);
    SendClientMessageEx(playerid,COLOR_GREEN,"You Robbed $%d From the ATM",rrand);
    TogglePlayerControllable(playerid, 1);
    atmPlayTimer[playerid] = SetTimerEx("antiatmrob", 900000,false,"d",playerid);
    return 1;
}

forward antiatmrob(playerid);
public antiatmrob(playerid)
{
    atmTimer[playerid] = 0;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)