0.3c Timer, 1 = 1 second?
#1

I am making a server gamemode and in that script I added a "SetTimerEx" function.

And, in the interval part, I used "1000" in it (which means 1 second) and in the loop part is "true".

In the function, I added if the timer already repeated for 60 times (1 minute), the timer will be killed/stopped.

And I tested it and it doesn't work! And then, I wait for few times until somehow I see that timer runs every long seconds (I think it's exactly 1000 seconds).

And then, I changed it into "1" in the interval and tested it and it works! It runs every 1 second.

But the problem is, I asked somebody else to test, his ID is ID 1 and mine is 0. When he use the command to run the timer and the timer ran very fast (I think it's 1 milisecond) and suddenly the timer killed/stopped (because it's already 60 times) and the other function there also ran.

Well, is it a bug?
Reply
#2

Give the code..
Reply
#3

FunctionName = You function name.
1000 = 1 second.
False / True = dependes of your script, give it to us.
pawn Код:
SetTimerEx("FunctionName", 1000, false, "i", playerid);
Reply
#4

Quote:
Originally Posted by EliranPesahov
Посмотреть сообщение
FunctionName = You function name.
1000 = 1 second.
False / True = dependes of your script, give it to us.
pawn Код:
SetTimerEx("FunctionName", 1000, false, "i", playerid);
Lol, that's not the problem. The problem is, i used:

pawn Код:
SetTimerEx("FunctionName", 1, true, "i", playerid);
And it runs every 1 second if my ID ingame is 0.
But if my ID in game is not 0, it runs every 1 milisecond.
Reply
#5

Just post the function.
Reply
#6

That sounds so stupid..
Reply
#7

Quote:
Originally Posted by VirSpectorX
Посмотреть сообщение
And it runs every 1 second if my ID ingame is 0.
But if my ID in game is not 0, it runs every 1 milisecond.
Me too, in my server if i am the id 0 some functions works, else it doesn't works.

Код:
public LimiteSuperato(playerid)
{
  new Velocita[MAX_PLAYERS];
  Velocita[playerid] = GetPlayerSpeed(playerid,true);
  for(new i=0;i<MAX_PLAYERS;i++)
  {
    if(GetPlayerTeam(playerid) != 8 && Velocita[playerid] > 100 && IsPlayerNearPlayer(50,playerid,i))
    {
      ReportCrime(playerid,COLOR_YELLOW,1,"Eccesso di velocitа.",MODE_COPS_IN_AREA);
    }
  }

  if(Velocita[playerid] > 800 && !IsPlayerNPC(playerid))
  {
	new string[256];
	new name[24];
	GetPlayerName(playerid,name,sizeof(name));
	format(string,sizeof(string),"%s(ID %d) и stato bannato per speed-hack %d km/h.", name, playerid, Velocita[playerid]);
    BanEx(playerid,"SpeedHack");
  }
  return 1;
}

stock ReportCrime(playerid,colore,stelle,motivo[],modo)
{
  new string[256];
  new string2[256];
  new string3[256];
  new name[24];
  GetPlayerName(playerid,name,sizeof(name));
  format(string,sizeof(string),"Hai commesso un crimine: %s",motivo);
  SendClientMessage(playerid,colore,string);
  format(string2,sizeof(string2),"A tutte le unitа: Sospetto: %s - Crimine: %s", name, motivo);
  format(string3,sizeof(string3),"A le unitа piu vicine: Sospetto: %s - Crimine: %s", name, motivo);
  SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid) + stelle);
  SetPlayerColor(playerid,colore);
  for(new i=0;i<MAX_PLAYERS;i++)
  {
	if(GetPlayerTeam(i) == 8)
	{
	  if(modo == MODE_ALL_COPS) SendClientMessage(i,COLOR_BLUE,string2);
	  if(modo == MODE_COPS_IN_AREA)
	  {
		if(IsPlayerNearPlayer(50,playerid,i))
		{
	      SendClientMessage(i,COLOR_BLUE,string3);
		}

	  }

    }

  }
  return 1;
}

GetPlayerSpeed(playerid,bool:kmh) // by misco
{
    new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
    if(IsPlayerInAnyVehicle(playerid)) 	GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz);
	else 								GetPlayerVelocity(playerid,Vx,Vy,Vz);
    rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
    return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}
PS: The client MSGs are in Italian...
What's wrong in this script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)