[SOLVED] SetTimer - OnGameModeInit -
kariok - 19.02.2011
This is my OnGameModeInit:
pawn Код:
public OnGameModeInit()
{
mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
mysql_debug(1); // Debugging enabled
DisableInteriorEnterExits();
ManualVehicleEngineAndLights();
ShowPlayerMarkers(0);
ResetObjectsOpen();
SetTimer("moneyfix", 500, true);
SetTimer("trailer", 1000, 1);
SetTimer("checkpoint", 1500, 1);
SetTimer("alarme", 2000, 1);
// NPCs
// NPCs
ConnectNPC("Policial","motorista1");
ConnectNPC("Mendigo","a1");
AddPlayerClass(0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0,0, 0, 0);
SetGameModeText("Brasil Country Roleplay");
print("=====================================================================");
AddVehiclesFromFile();
AddPickupFromFile();
AddLabelsFromFile();
AddMapIconFromFile();
AddBizFromFile();
AddObjectsFromFile();
AddFactionsFromFile();
print("=====================================================================\n");
return 1;
}
None of this Timers are working... Look at one of them, for example.
pawn Код:
forward moneyfix(playerid);
public moneyfix(playerid){
if(GetPlayerMoney(playerid)==PVar[playerid][pMoney]){
return 1;
}
else{
SendClientMessage(playerid, COLOR_GREY, "[INFO] Dinheiro nгo sincronizado, corrigindo o valor...");
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PVar[playerid][pMoney]);
}
return 0;
}
They were working before, something i added made them stop working, can you help me figuring out what?
Re: [Help] SetTimer - OnGameModeInit -
xRyder - 19.02.2011
Try to return public 'moneyfix(playerid)' as true?
Re: [Help] SetTimer - OnGameModeInit -
kariok - 19.02.2011
Sorry rider, i didn't understand what you are saying!
Moneyfix is already a public function, i tried both true and 1 on repeat but it still does not works.
Re: [Help] SetTimer - OnGameModeInit -
AK47317 - 19.02.2011
he meant
at the
Re: [Help] SetTimer - OnGameModeInit -
kariok - 19.02.2011
Still does not works.
I don't know what to do, i'm scripting this gamemode almost from scrap for almost 2 weeks, these timers were working nicely...
Re: [Help] SetTimer - OnGameModeInit -
xRyder - 19.02.2011
Edit: Ignore this post...fail... -.-"
Re: [Help] SetTimer - OnGameModeInit -
kariok - 20.02.2011
I've tried disabling all the possible other functions on OnGameModeInit but nothing... I also tried adding them to OnPlayerConnect and nothing...
Maybe do is it some other function that is blocking the timers? Maybe because of not having a "return 1;"?
Re: [Help] SetTimer - OnGameModeInit -
kariok - 20.02.2011
The problem is i'm using the playerid on the timers
like
public moneyfix(playerid);
How to add the playerid as a variable to the moneyfix function using SetTimer?
Re: [Help] SetTimer - OnGameModeInit - rjjj - 20.02.2011
To functions without parameters, you have to use
SetTimer.
Example:
pawn Код:
LoL(/*No Parameteres here*/) return 1;
And, to functions with parameters like moneyfix(
playerid), you have to use
SetTimerEx.
If you want to use SetTimer in OnGameModeInit callback, you have to do a loop to it checks all the players.
I hope that i have helped
Re: [Help] SetTimer - OnGameModeInit -
kariok - 20.02.2011
rjjj:
You helped a lot, that was exactly the problem!
I think i'll just add a loop on each of the timers