SetTimerEx("FunctionName", 1000, false, "i", playerid);
|
FunctionName = You function name.
1000 = 1 second. False / True = dependes of your script, give it to us. 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. |
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);
}