[Ajuda] Velocнmetro quando alguйm da G
#10

Quote:
Originally Posted by Nork
Посмотреть сообщение
Alguйm?
pawn Код:
// so arrumei este filterscript pra ver se vocк desconfiar e
// comeзar a criar seus proprios projetos que isto seja de liзгo !!!

// й tambйm vai estudar "pawno"


#include            a_samp
new Text:Textdraw0[MAX_PLAYERS];
new Text:Textdraw1[MAX_PLAYERS];
new TimerVelocimetro[MAX_PLAYERS];

public OnFilterScriptInit()
{
    for(new x = 0; x < MAX_PLAYERS; x++)
    {
        Textdraw0[x] = TextDrawCreate(548.000000, 350.000000, "");// Velocidade
        TextDrawBackgroundColor(Textdraw0[x], 255);
        TextDrawFont(Textdraw0[x], 2);
        TextDrawLetterSize(Textdraw0[x], 0.569999, 3.999998);
        TextDrawColor(Textdraw0[x], -1);
        TextDrawSetOutline(Textdraw0[x], 0);
        TextDrawSetProportional(Textdraw0[x], 1);
        TextDrawSetShadow(Textdraw0[x], 1);

        Textdraw1[x] = TextDrawCreate(600.000000, 350.000000, "Km/h");// KM
        TextDrawBackgroundColor(Textdraw1[x], 255);
        TextDrawFont(Textdraw1[x], 2);
        TextDrawLetterSize(Textdraw1[x], 0.210000, 1.300000);
        TextDrawColor(Textdraw1[x], -1);
        TextDrawSetOutline(Textdraw1[x], 0);
        TextDrawSetProportional(Textdraw1[x], 1);
        TextDrawSetShadow(Textdraw1[x], 1);
    }
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}
public OnPlayerConnect(playerid)
{
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(TimerVelocimetro[playerid]);
    return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        TimerVelocimetro[playerid] = SetTimerEx("AtualizarVelocimetro", 1000, true, "d", playerid);
    }
    else if(oldstate == PLAYER_STATE_DRIVER)
    {
        KillTimer(TimerVelocimetro[playerid]);
        TextDrawHideForPlayer(playerid, Textdraw0[playerid]);
        TextDrawHideForPlayer(playerid, Textdraw1[playerid]);
    }
    return 1;
}
forward AtualizarVelocimetro(playerid);
public AtualizarVelocimetro(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new Velo[30];

        format(Velo, 30, "%i", GetPlayerSpeed(playerid));
        TextDrawSetString(Textdraw0[playerid], Velo);
        TextDrawShowForPlayer(playerid, Textdraw0[playerid]);

        TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
    }
    return 1;
}
stock GetPlayerSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
    GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 100.3;
    return floatround(ST[3]);
}
Reply


Messages In This Thread
Velocнmetro quando alguйm da G - by Nork - 06.03.2014, 13:51
Re: Velocнmetro quando alguйm da G - by smiir - 06.03.2014, 13:56
Re: Velocнmetro quando alguйm da G - by Nork - 06.03.2014, 14:00
Re: Velocнmetro quando alguйm da G - by Nork - 06.03.2014, 14:13
Re: Velocнmetro quando alguйm da G - by smiir - 06.03.2014, 14:15
Re: Velocнmetro quando alguйm da G - by DannielCooper - 06.03.2014, 14:26
Re: Velocнmetro quando alguйm da G - by Nork - 06.03.2014, 14:27
Re: Velocнmetro quando alguйm da G - by Nork - 06.03.2014, 14:51
Re: Velocнmetro quando alguйm da G - by smiir - 06.03.2014, 14:59
Re: Velocнmetro quando alguйm da G - by Dieguinho - 06.03.2014, 15:19

Forum Jump:


Users browsing this thread: 3 Guest(s)