SetTimer Help plS
#1

Hi guys., When I use SetTimer when End Time Get Money And Score Not To Robber Player and Get Them To all Players!
Any Fix It Plsss Thank You :X This is CoDe <3

Код:
#include <a_samp>
#include <zcmd>

#define COLOR_WHITE 0xFFFFFFAA

forward robtimer(playerid);
forward waittimer();

new robpossible;

public OnFilterScriptInit()
{
	robpossible = 1;
	return 1;
}

//Command(s)
CMD:robbank(playerid, params[])
{
	if(robpossible == 1) //If the bank can be robbed we continue below
	{
		if(IsPlayerInRangeOfPoint(playerid, 3.0, 2309.1899,-8.4444,26.7422))
		{
		    robpossible = 0; //Then we set the bank so it cannot be robbed
		    SetTimer("waittimer", 300000, false); //Normal Mode 5 minutes

		    SetTimer("robtimer", 60000, false);
	
		    SendClientMessage(playerid, COLOR_WHITE, "You are robbing the bank, the police has been notified!");
            SendClientMessage(playerid, COLOR_WHITE, "You gotta stay 30 seconds in the bank in order to rob it!");
		 }
	} else {
	    SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now!");
	}
	return 1;
}

//Functions
public robtimer(playerid)
{
	new string[128];//We are defining a new string for the formatted message that we are displaying later on.
    new cash = random(200000);
	GivePlayerMoney(playerid, cash);
	new cash = random(200000);
	GivePlayerMoney(playerid, cash);' we give the player
	format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
	SendClientMessage(playerid, COLOR_WHITE, string);
}

public waittimer()
{
	robpossible = 1; //With this we make the bank available for robbery again, and we display a friendly message to all players.
	SendClientMessageToAll(COLOR_WHITE, "The bank is now available for robbery!");
}
__________________________________________________ _

RapGoD
Reply
#2

It Should Be:

Код:
new string[128];
new cash = random(200000);
GiverPlayerMoney(playerid, cash);
new cash = random(200000);
GivePlayerMoney(playerid, cash);
format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
SendClientMessage(playerid, COLOR_WHITE, string);
Reply
#3

Timer.
Код:
SetTimerEx("robtimer", 60000, false, "i", playerid);
Callback.
Код:
public robtimer(playerid)
{
	new string[128];//We are defining a new string for the formatted message that we are displaying later on.
	new cash = random(200000);
	GivePlayerMoney(playerid, cash);
	format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
	SendClientMessage(playerid, COLOR_WHITE, string);
	return 1;
}
Quote:

You gotta stay 30 seconds in the bank in order to rob it!

Код:
SetTimer("robtimer", 60000, false);
I think 60000 milliseconds is not 30 seconds.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)