[FS] axll-s | velocímetro (progress.inc)

21 de fev. de 2014.
Velocímetro
Eai, bom fiz esse código para por no meu gamemode (que vou postar aqui em breve) e decidi
compartilhar com vocês, como não tem muito oque falar vou por imagens e vocês digam oque
acharam do velocímetro.






pawn Code:
//axll #include    < a_samp   > #include    < progress > new PlayerBar:  velocimetro_bar[MAX_PLAYERS]; new PlayerText: velocimetro_veiculo_nome[MAX_PLAYERS]; new PlayerText: velocimetro_fundo_box[MAX_PLAYERS]; new PlayerText: velocimetro_kmh[MAX_PLAYERS]; new PlayerText: velocimetro_lataria[MAX_PLAYERS]; new PlayerText: velocimetro_box_kmh[MAX_PLAYERS]; new PlayerText: velocimetro_gas_quant[MAX_PLAYERS]; new PlayerText: velocimetro_bar_textd[MAX_PLAYERS]; new VehicleNames[][] = {     "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-350","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","Hotring Racer","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","Monster","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","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer","Trailer","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","Luggage Trailer","Stair Trailer","Boxville","Farm Plow","Utility Trailer" }; public OnFilterScriptInit() {     SetTimer("TimerVel", 100, true);     return true; } public OnPlayerConnect(playerid) {     velocimetro_bar[playerid] = CreatePlayerProgressBar(playerid, 482.00, 310.00, 146.50, 45.20, -8372074, 0.0);     velocimetro_veiculo_nome[playerid] = CreatePlayerTextDraw(playerid, 418.666595, 291.199829, "@");     PlayerTextDrawLetterSize(playerid, velocimetro_veiculo_nome[playerid], 0.449999, 1.600000);     PlayerTextDrawAlignment(playerid, velocimetro_veiculo_nome[playerid], 1);     PlayerTextDrawColor(playerid, velocimetro_veiculo_nome[playerid], -5963521);     PlayerTextDrawSetShadow(playerid, velocimetro_veiculo_nome[playerid], 1);     PlayerTextDrawSetOutline(playerid, velocimetro_veiculo_nome[playerid], 0);     PlayerTextDrawBackgroundColor(playerid, velocimetro_veiculo_nome[playerid], 51);     PlayerTextDrawFont(playerid, velocimetro_veiculo_nome[playerid], 3);     PlayerTextDrawSetProportional(playerid, velocimetro_veiculo_nome[playerid], 1);     velocimetro_fundo_box[playerid] = CreatePlayerTextDraw(playerid, 632.222229, 310.122222, "usebox");     PlayerTextDrawLetterSize(playerid, velocimetro_fundo_box[playerid], 0.000000, 4.605801);     PlayerTextDrawTextSize(playerid, velocimetro_fundo_box[playerid], 416.666656, 0.000000);     PlayerTextDrawAlignment(playerid, velocimetro_fundo_box[playerid], 1);     PlayerTextDrawColor(playerid, velocimetro_fundo_box[playerid], 0);     PlayerTextDrawUseBox(playerid, velocimetro_fundo_box[playerid], true);     PlayerTextDrawBoxColor(playerid, velocimetro_fundo_box[playerid], 102);     PlayerTextDrawSetShadow(playerid, velocimetro_fundo_box[playerid], 0);     PlayerTextDrawSetOutline(playerid, velocimetro_fundo_box[playerid], 0);     PlayerTextDrawFont(playerid, velocimetro_fundo_box[playerid], 0);     velocimetro_kmh[playerid] = CreatePlayerTextDraw(playerid, 427.555450, 310.115661, "@");     PlayerTextDrawLetterSize(playerid, velocimetro_kmh[playerid], 0.791333, 4.173510);     PlayerTextDrawAlignment(playerid, velocimetro_kmh[playerid], 1);     PlayerTextDrawColor(playerid, velocimetro_kmh[playerid], -1523963137);     PlayerTextDrawSetShadow(playerid, velocimetro_kmh[playerid], 0);     PlayerTextDrawSetOutline(playerid, velocimetro_kmh[playerid], 0);     PlayerTextDrawBackgroundColor(playerid, velocimetro_kmh[playerid], 51);     PlayerTextDrawFont(playerid, velocimetro_kmh[playerid], 3);     PlayerTextDrawSetProportional(playerid, velocimetro_kmh[playerid], 1);     velocimetro_lataria[playerid] = CreatePlayerTextDraw(playerid, 419.111083, 355.413452, "@");     PlayerTextDrawLetterSize(playerid, velocimetro_lataria[playerid], 0.288666, 0.758754);     PlayerTextDrawAlignment(playerid, velocimetro_lataria[playerid], 1);     PlayerTextDrawColor(playerid, velocimetro_lataria[playerid], -1);     PlayerTextDrawSetShadow(playerid, velocimetro_lataria[playerid], 0);     PlayerTextDrawSetOutline(playerid, velocimetro_lataria[playerid], 1);     PlayerTextDrawBackgroundColor(playerid, velocimetro_lataria[playerid], 51);     PlayerTextDrawFont(playerid, velocimetro_lataria[playerid], 1);     PlayerTextDrawSetProportional(playerid, velocimetro_lataria[playerid], 1);     velocimetro_box_kmh[playerid] = CreatePlayerTextDraw(playerid, 420.222229, 355.420013, "usebox");     PlayerTextDrawLetterSize(playerid, velocimetro_box_kmh[playerid], 0.000000, -5.460370);     PlayerTextDrawTextSize(playerid, velocimetro_box_kmh[playerid], 478.888916, 0.000000);     PlayerTextDrawAlignment(playerid, velocimetro_box_kmh[playerid], 1);     PlayerTextDrawColor(playerid, velocimetro_box_kmh[playerid], 0);     PlayerTextDrawUseBox(playerid, velocimetro_box_kmh[playerid], true);     PlayerTextDrawBoxColor(playerid, velocimetro_box_kmh[playerid], 102);     PlayerTextDrawSetShadow(playerid, velocimetro_box_kmh[playerid], 0);     PlayerTextDrawSetOutline(playerid, velocimetro_box_kmh[playerid], 0);     PlayerTextDrawFont(playerid, velocimetro_box_kmh[playerid], 0);     velocimetro_gas_quant[playerid] = CreatePlayerTextDraw(playerid, 419.222229, 365.373443, "@");     PlayerTextDrawLetterSize(playerid, velocimetro_gas_quant[playerid], 0.288666, 0.758754);     PlayerTextDrawAlignment(playerid, velocimetro_gas_quant[playerid], 1);     PlayerTextDrawColor(playerid, velocimetro_gas_quant[playerid], -1);     PlayerTextDrawSetShadow(playerid, velocimetro_gas_quant[playerid], 0);     PlayerTextDrawSetOutline(playerid, velocimetro_gas_quant[playerid], 1);     PlayerTextDrawBackgroundColor(playerid, velocimetro_gas_quant[playerid], 51);     PlayerTextDrawFont(playerid, velocimetro_gas_quant[playerid], 1);     PlayerTextDrawSetProportional(playerid, velocimetro_gas_quant[playerid], 1);     velocimetro_bar_textd[playerid] = CreatePlayerTextDraw(playerid, 481.333312, 352.426666, "LD_SPAC:white");     PlayerTextDrawLetterSize(playerid, velocimetro_bar_textd[playerid], 0.000000, 0.000000);     PlayerTextDrawTextSize(playerid, velocimetro_bar_textd[playerid], 149.333358, 1.493338);     PlayerTextDrawAlignment(playerid, velocimetro_bar_textd[playerid], 1);     PlayerTextDrawColor(playerid, velocimetro_bar_textd[playerid], 255);     PlayerTextDrawSetShadow(playerid, velocimetro_bar_textd[playerid], 0);     PlayerTextDrawSetOutline(playerid, velocimetro_bar_textd[playerid], 0);     PlayerTextDrawFont(playerid, velocimetro_bar_textd[playerid], 4);     return true; } forward TimerVel(); public TimerVel() {     new _string[128], Float:health, vehicleid;     for(new i = 0; i < MAX_PLAYERS; i++)     {         if(IsPlayerInAnyVehicle(i))         {             MostrarVelocimetro(i);             vehicleid = GetPlayerVehicleID(i), GetVehicleHealth(vehicleid, health);             GetVehicleName(GetVehicleModel(vehicleid), _string, sizeof(_string));             format(_string, sizeof(_string), "%s", _string), PlayerTextDrawSetString(i, velocimetro_veiculo_nome[i], _string);             format(_string, sizeof(_string), "%d", GetVehicleVelocityEx(i)), PlayerTextDrawSetString(i, velocimetro_kmh[i], _string);             format(_string, sizeof(_string), "Lataria %.2f", health), PlayerTextDrawSetString(i, velocimetro_lataria[i], _string);             format(_string, sizeof(_string), "Gasolina 100"), PlayerTextDrawSetString(i, velocimetro_gas_quant[i], _string);             SetPlayerProgressBarValue(i, velocimetro_bar[i], GetVehicleVelocityEx(i));             UpdatePlayerProgressBar(i, velocimetro_bar[i]);         }         else OcultarVelocimetro(i);             }     return true; } stock MostrarVelocimetro(playerid) {     ShowPlayerProgressBar(playerid, velocimetro_bar[playerid]);     SetPlayerProgressBarMaxValue(playerid, velocimetro_bar[playerid], 210);     PlayerTextDrawShow(playerid, velocimetro_veiculo_nome[playerid]);     PlayerTextDrawShow(playerid, velocimetro_fundo_box[playerid]);     PlayerTextDrawShow(playerid, velocimetro_kmh[playerid]);     PlayerTextDrawShow(playerid, velocimetro_lataria[playerid]);     PlayerTextDrawShow(playerid, velocimetro_box_kmh[playerid]);     PlayerTextDrawShow(playerid, velocimetro_gas_quant[playerid]);     PlayerTextDrawShow(playerid, velocimetro_bar_textd[playerid]); } stock OcultarVelocimetro(playerid) {     HidePlayerProgressBar(playerid, velocimetro_bar[playerid]);     SetPlayerProgressBarValue(playerid, velocimetro_bar[playerid], 0);     PlayerTextDrawHide(playerid, velocimetro_veiculo_nome[playerid]);     PlayerTextDrawHide(playerid, velocimetro_fundo_box[playerid]);     PlayerTextDrawHide(playerid, velocimetro_kmh[playerid]);     PlayerTextDrawHide(playerid, velocimetro_lataria[playerid]);     PlayerTextDrawHide(playerid, velocimetro_box_kmh[playerid]);     PlayerTextDrawHide(playerid, velocimetro_gas_quant[playerid]);     PlayerTextDrawHide(playerid, velocimetro_bar_textd[playerid]); } stock GetVehicleVelocityEx(playerid) {     new Float:Velocity[3], Float:fl;     GetVehicleVelocity(GetPlayerVehicleID(playerid),Velocity[0],Velocity[1],Velocity[2]);     fl = floatsqroot(floatpower(Velocity[0], 2) + floatpower(Velocity[1], 2) + floatpower(Velocity[2], 2)) * 160;     return floatround(fl); } stock GetVehicleName(modelid, name[], namesize) {     if(modelid < 400 || modelid > 611) return 0;     modelid -= 400;     for(new i, len = strlen(VehicleNames[modelid]); i < len && i < namesize; i++)     name[i] = VehicleNames[modelid][i];     return 1; }

0 comentários:

Postar um comentário