[Pedido] Velocimetro
#1

Queria um Velocimetro , que marcase somente a Velocidade do carro/moto/aviгo/helicoptero , Se possivel , passa ai , Tentei achar no Search , mas achei so completo mas eu quero um que Registre somente a velocidade do veiculo
Reply
#2

Crie o textdraw do jeito q vc quiser e use este codigo q acabei de fazer,

Vc sу vai precisar salvar o textdraw na variavel TextdrawSpeedometer.

pawn Код:
new Iterator:Driver<MAXPLAYERS>;//topo do GM
new Text:TextdrawSpeedometer;
forward SpeedometerUpdate

//ongamemodeinit
SetTimer("SpeedometerUpdate", TEMPO Q VC QUISER, true);

//public OnPlayerStateChange
    if(newstate == PLAYER_STATE_DRIVER)
    {
        Iter_Add(Driver, playerid);
        TextDrawSetString(TextdrawSpeedometer, "000");
        TextDrawShowForPlayer(playerid, TextdrawSpeedometer);
    }
    else if(oldstate == PLAYER_STATE_DRIVER)
    {
        Iter_Remove(Driver, playerid);
        TextDrawHideForPlayer(playerid, TextdrawSpeedometer);
    }

public SpeedometerUpdate()
{
    new pharrel[5];
    foreach(Driver, i)
    {
        if(!IsPlayerConnected(i)) Iter_Remove(Driver, i);
        format(pharrel, 4, "%03d", floatround(GetVehicleSpeed(GetPlayerVehicleID(playerid)]));
        TextDrawSetString(TextdrawSpeedometer, pharrel);
    }
    return 1;
}

stock Float:GetVehicleSpeed(vehicleid)
{
    new Float:speed_x,Float:speed_y,Float:speed_z,Float:temp_speed;
    GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
    temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
    floatround(temp_speed,floatround_round); return temp_speed;
}
VAI PRECISAR DA INCLUDE FOREACH!
Reply
#3

Quote:
Originally Posted by Pharrel
Посмотреть сообщение
Crie o textdraw do jeito q vc quiser e use este codigo q acabei de fazer,

Vc sу vai precisar salvar o textdraw na variavel TextdrawSpeedometer.

pawn Код:
new Iterator:Driver<MAXPLAYERS>;//topo do GM
new Text:TextdrawSpeedometer;
forward SpeedometerUpdate

//ongamemodeinit
SetTimer("SpeedometerUpdate", TEMPO Q VC QUISER, true);

//public OnPlayerStateChange
    if(newstate == PLAYER_STATE_DRIVER)
    {
        Iter_Add(Driver, playerid);
        TextDrawSetString(TextdrawSpeedometer, "000");
        TextDrawShowForPlayer(playerid, TextdrawSpeedometer);
    }
    else if(oldstate == PLAYER_STATE_DRIVER)
    {
        Iter_Remove(Driver, playerid);
        TextDrawHideForPlayer(playerid, TextdrawSpeedometer);
    }

public SpeedometerUpdate()
{
    new pharrel[5];
    foreach(Driver, i)
    {
        if(!IsPlayerConnected(i)) Iter_Remove(Driver, i);
        format(pharrel, 4, "%03d", floatround(GetVehicleSpeed(GetPlayerVehicleID(playerid)]));
        TextDrawSetString(TextdrawSpeedometer, pharrel);
    }
    return 1;
}

stock Float:GetVehicleSpeed(vehicleid)
{
    new Float:speed_x,Float:speed_y,Float:speed_z,Float:temp_speed;
    GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
    temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
    floatround(temp_speed,floatround_round); return temp_speed;
}
VAI PRECISAR DA INCLUDE FOREACH!
Obrigado cara, aprendi sobre Iter_Add e Iter_Remove, й como se fosse uma vбriavel, sу que para foreach, ele seta a variбvel para cada player que entrar em um veнculo e faz o loop somente nos players que tem esse variбvel, vlw. REPpatu
Reply
#4

Quote:
Originally Posted by Los
Посмотреть сообщение
Obrigado cara, aprendi sobre Iter_Add e Iter_Remove, й como se fosse uma vбriavel, sу que para foreach, ele seta a variбvel para cada player que entrar em um veнculo e faz o loop somente nos players que tem esse variбvel, vlw. REPpatu
o_O

vlw
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)