[Ajuda] radar causando rt
#1

Coloquei meu sistema de radar em uma verificaзгo do velocнmetro, e toda vez que passo ao lado da uma travada no servidor. Alguйm sabe porquк isto esta causando ?

PHP код:
task Velocimetro[500]()
{
    foreach(new 
iPlayer)
    {
        if(!
gPlayerLogged[i])continue;
        if(
IsPlayerInAnyVehicle(i))
           {
               new 
Float:_hp;
            new 
playervehicle;
            new 
_v GetPlayerVehicleID(i);
            if ( (
playervehicle GetPlayerVehicleID(i)) != INVALID_VEHICLE_ID)
            {
                new 
string_velo[15];
                
format(string_velosizeof (string_velo), "%02d km/h"GetVehicleSpeed(playervehicle));
                
PlayerTextDrawSetString(itextPlayerVelocimetro[1][i], string_velo);
                
GetVehicleHealth(_v_hp);
                  
format(string_velosizeof (string_velo), "%.0f%%"_hp/10);
                
PlayerTextDrawSetString(itextPlayerVelocimetro[3][i], string_velo);
                
format(string_velosizeof (string_velo), "%02d Litros"Gas[playervehicle]);
                
PlayerTextDrawSetString(itextPlayerVelocimetro[2][i], string_velo);
            }
            if(
GetPlayerState(i) == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(i)) ^ 510 && GetVehicleModel(GetPlayerVehicleID(i)) ^ 481 && GetVehicleModel(GetPlayerVehicleID(i)) ^ 509)
            {
                for(new 
u120; ++ u)
                {
                    if(
IsPlayerInRangeOfPoint(i40.0RADAR[u][rPosX], RADAR[u][rPosY], RADAR[u][rPosZ]))
                    {
                        if(
GetPlayerVehicleSpeed(i) > RADAR[u][rSpeed])
                        {
                            
SendClientMessageEx(i, -1"MULTADO!");
                        }
                    }
                }
               }
        }
    }
    return 
true;

Reply
#2

Deve ta sendo chamada a cada 500ms menos de 1s, e nгo tem um tempo definido para prox detecзгo, entгo ele fica chamando em 500s.

edit: e tambйm o loop foreach vai verificar cada player atй chegar em vocк e vai verificar todos os radar...

Crie um timer apenas para o player e me diga o que mudou.
Reply
#3

Testa aн men, eu nгo testei.

Codigo:

task Velocimetro[500](playerid)
{
if(!gPlayerLogged[playerid]) continue;

if(IsPlayerInAnyVehicle(playerid))
{
static Float:_hp;
static playervehicle;
new _v = GetPlayerVehicleID(playerid);

if ( (playervehicle = GetPlayerVehicleID(playerid)) != INVALID_VEHICLE_ID)
{
static string_velo[15];

format(string_velo, sizeof (string_velo), "%02d km/h", GetVehicleSpeed(playervehicle));
PlayerTextDrawSetString(playerid, textPlayerVelocimetro[1][playerid], string_velo);

GetVehicleHealth(_v, _hp);

format(string_velo, sizeof (string_velo), "%.0f%%", _hp/10);
PlayerTextDrawSetString(playerid, textPlayerVelocimetro[3][playerid], string_velo);

format(string_velo, sizeof (string_velo), "%02d Litros", Gas[playervehicle]);
PlayerTextDrawSetString(playerid, textPlayerVelocimetro[2][playerid], string_velo);
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) ^ 510 && GetVehicleModel(GetPlayerVehicleID(playerid)) ^ 481 && GetVehicleModel(GetPlayerVehicleID(playerid)) ^ 509)
{
if(IsPlayerInRangeOfPoint(playerid, 40.0, RADAR[u][rPosX], RADAR[u][rPosY], RADAR[u][rPosZ]))
{
if(GetPlayerVehicleSpeed(playerid) > RADAR[u][rSpeed])
{
SendClientMessageEx(playerid, -1, "MULTADO!");
}
}
}
}
return true;
}
Reply
#4

Quando for usar task com parвmetros, tem que usar ptask.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)