Why this timer aint wrking -
aco_SRBIJA - 02.03.2012
hai,
I would like if some help me.
I have defined all nicely, no errors, no warnings, but not working. It's supposed to make Nlimit array goes more when nitr is off, and goes down when Nitro is on. I have defined that OnPlayerKeyStateChange. Nitro is supposed to stop when LMB is released, and it do. But, this timer is looking like being ignored. Here's code
Код:
forward NitroLimiter(playerid);
public NitroLimiter(playerid)
{
new string[56],component;
component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_NITRO);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (IsPlayerInAnyVehicle(i) && (component == 1008 || component == 1009 || component == 1010))
{
if (Nlimit[i] > 20) Nlimit[i] = 20;
if (Usingnitro[i] == 0) Nlimit[i]++,SendClientMessage(playerid,-1,"Nlimit goes more");
else Nlimit[i]--;
format(string,sizeof(string),"Nlimit is: %d",Nlimit[i]);
SendClientMessage(i ,-1,string);
}
}
}
}
I have done this by myself, have not copied from someone or stolen. This is my own work, so I know whta I did, and where errors should be where should not. Timer is defined as: NitroLimit = SetTimer("Nitrolimiter",1000,1);
Every array and vars is defined as it should be.
Re: Why this timer aint wrking -
Twisted_Insane - 02.03.2012
Kill the timer in your forwarded callback!
Re: Why this timer aint wrking -
aco_SRBIJA - 02.03.2012
I am killing it OnGameModeExit.
Re: Why this timer aint wrking -
aco_SRBIJA - 02.03.2012
Anyone?
Re: Why this timer aint wrking -
Gamer_Z - 02.03.2012
Quote:
Originally Posted by aco_SRBIJA
Anyone?
|
Are you sure u using SetTimerEx with a specified playerid?
Re: Why this timer aint wrking -
2KY - 02.03.2012
pawn Код:
forward NitroLimiter();
public NitroLimiter()
You don't need a playerid parameter because you're looping through all players in the timer.
Re: Why this timer aint wrking -
aco_SRBIJA - 02.03.2012
GamerZ, I use only SetTimer.
2KY, testing.
Re: Why this timer aint wrking -
aco_SRBIJA - 02.03.2012
After those tests, it's same. How It would be if I SetTimer make SetTimerEx?
Re: Why this timer aint wrking -
aco_SRBIJA - 02.03.2012
ANyone?
Re: Why this timer aint wrking -
DRIFT_HUNTER - 02.03.2012
Kako radi copy + paste....
pawn Код:
//U fs ili gm init
SetTimer("Nitrolimiter",1000,1);
//Bilo gde u scripti samo da nije u nekoj funkciji
forward NitroLimiter();
public NitroLimiter()
{
new string[56],component;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
component = GetVehicleComponentInSlot(GetPlayerVehicleID(i), CARMODTYPE_NITRO);
if (IsPlayerInAnyVehicle(i) && (component == 1008 || component == 1009 || component == 1010))
{
if (Nlimit[i] > 20) Nlimit[i] = 20;
if (Usingnitro[i] == 0) Nlimit[i]++,SendClientMessage(i,-1,"Nlimit goes more");
else Nlimit[i]--;
format(string,sizeof(string),"Nlimit is: %d",Nlimit[i]);
SendClientMessage(i ,-1,string);
}
}
}
}
E da ovo za boju -1 neznam oce li da radi