Why this timer aint wrking
#1

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.
Reply
#2

Kill the timer in your forwarded callback!
Reply
#3

I am killing it OnGameModeExit.
Reply
#4

Anyone?
Reply
#5

Quote:
Originally Posted by aco_SRBIJA
Посмотреть сообщение
Anyone?
Are you sure u using SetTimerEx with a specified playerid?
Reply
#6

pawn Код:
forward NitroLimiter();
public NitroLimiter()
You don't need a playerid parameter because you're looping through all players in the timer.
Reply
#7

GamerZ, I use only SetTimer.


2KY, testing.
Reply
#8

After those tests, it's same. How It would be if I SetTimer make SetTimerEx?
Reply
#9

ANyone?
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)