SA-MP Forums Archive
[Ajuda] Velocimetro - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Velocimetro (/showthread.php?tid=482115)



Velocimetro - kaiohenrique - 19.12.2013

Queria Saber Como Aumentar A Velocidade Maxima Que Um Veiculo Pegue Estou Achando Pouco

Velocimetro Pego Da Net

Код:
#include            a_samp
 
new Text:Textdraw0[MAX_PLAYERS];
new Text:Textdraw1[MAX_PLAYERS];
new Text:Textdraw2[MAX_PLAYERS];
new Text:Textdraw3[MAX_PLAYERS];
new TimerVelocimetro[MAX_PLAYERS];
 
new vehName[][] ={
"Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster",
"Stretch","Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam",
"Esperanto","Taxi","Washington","Bobcat","Mr Whoopee","BF Injection","Hunter","Premier","Enforcer","Securicar","Banshee",
"Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie","Stallion","Rumpo",
"RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer",
"Turismo","Speeder","Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer",
"PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic","Sanchez","Sparrow","Patriot",
"Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR3 50","Walton","Regina","Comet","BMX",
"Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo",
"Greenwood","Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa",
"RC Goblin","Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT","Elegant",
"Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain","Nebula","Majestic",
"Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona",
"FBI Truck","Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight",
"Streak","Vortex","Vincent","Bullet","Clover","Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob",
"Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster A","Monster B","Uranus",
"Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight",
"Trailer","Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford",
"BF-400","Newsvan","Tug","Trailer A","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C",
"Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)","Police Car (LVPD)","Police Ranger",
"Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B",
"Stair Trailer","Boxville","Farm Plow","Utility Trailer"
};
 
// Striker Samp - Tudo Para Seu Servidor!
// www.strikersamp.blogspot.com
 
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");// 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);
 
    Textdraw2[x] = TextDrawCreate(519.000000, 389.000000, "");//Lataria
    TextDrawBackgroundColor(Textdraw2[x], 255);
    TextDrawFont(Textdraw2[x], 2);
    TextDrawLetterSize(Textdraw2[x], 0.220000, 1.800000);
    TextDrawColor(Textdraw2[x], -1);
    TextDrawSetOutline(Textdraw2[x], 0);
    TextDrawSetProportional(Textdraw2[x], 1);
    TextDrawSetShadow(Textdraw2[x], 1);
 
    Textdraw3[x] = TextDrawCreate(515.000000, 408.000000, "");// Veiculo
    TextDrawBackgroundColor(Textdraw3[x], 255);
    TextDrawFont(Textdraw3[x], 2);
    TextDrawLetterSize(Textdraw3[x], 0.280000, 1.500000);
    TextDrawColor(Textdraw3[x], -1);
    TextDrawSetOutline(Textdraw3[x], 0);
    TextDrawSetProportional(Textdraw3[x], 1);
    TextDrawSetShadow(Textdraw3[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)
    {
        TimerVelocimetro[playerid] = SetTimerEx("AtualizarVelocimetro", 100, true, "n", playerid);
    }
    else if(oldstate == PLAYER_STATE_DRIVER)
    {
        KillTimer(TimerVelocimetro[playerid]);
        TextDrawHideForPlayer(playerid, Textdraw0[playerid]);
        TextDrawHideForPlayer(playerid, Textdraw1[playerid]);
        TextDrawHideForPlayer(playerid, Textdraw2[playerid]);
        TextDrawHideForPlayer(playerid, Textdraw3[playerid]);
    }
    return 1;
}
forward AtualizarVelocimetro(playerid);
public AtualizarVelocimetro(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new Velo[30], Lat[30], Carronome[60];
       
        format(Velo, 30, "%i", GetPlayerSpeed(playerid));
        TextDrawSetString(Textdraw0[playerid], Velo);
        TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
 
        TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
   
        new Float:Vidacarro;
        new veh = GetPlayerVehicleID(playerid);
        GetVehicleHealth(veh, Vidacarro);
   
        if(Vidacarro >= 900 ||Vidacarro <= 1000)format(Lat, 30, "Lataria: Excelente");
        if(Vidacarro >= 800 ||Vidacarro <= 899)format(Lat, 30, "Lataria: Bom");
        if(Vidacarro >= 500 ||Vidacarro <= 799)format(Lat, 30, "Lataria: Medio");
        if(Vidacarro >= 300 ||Vidacarro <= 499)format(Lat, 30, "Lataria: Ruim");
        if(Vidacarro >= 100 ||Vidacarro <= 399)format(Lat, 30, "Lataria: Pessimo");
        TextDrawSetString(Textdraw2[playerid], Lat);
        TextDrawShowForPlayer(playerid, Textdraw2[playerid]);
 
        format(Carronome, 60, "Veiculo: %s", vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
        TextDrawSetString(Textdraw3[playerid], Carronome);
        TextDrawShowForPlayer(playerid, Textdraw3[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]);
}