25.04.2012, 00:38
Galera, olha esse Filterscript que eu estou usando, eu baixei da internet e queria fazer algumas modificaзхes para o meu servidor, podem ver os creditos nгo retirei nada, mas a respeito do FS, a gasolina desce de 100% para 0% muito rбpidamente, por exemplo, da Grove Street atй o Aeroporto de LS a gasolina jб esta em 15%.
Vejam o code
Acho que o problema estб nessa parte mas nгo tenho certeza.
Por favor, ajudem, й essencial para o servidor.
Obrigado
Vejam o code
pawn Код:
/* traduzido por http://www.MundoSAMP.com */
// Vehicle System 1.0 Beta © 2010 Johny C. (design, ideas) & Luka P. (scripting)
// Contributors: Betamaster (Vehicle Name List), Slice (Speed Cap)
/* traduzido por http://www.MundoSAMP.com */
#include "a_samp.inc"
/* traduzido por http://www.MundoSAMP.com */
#define FUEL_UPDATE_TIME (5000)
/* traduzido por http://www.MundoSAMP.com */
forward Float:GetVehicleVelocityX(vehicleid); stock Float:GetVehicleVelocityX(vehicleid){new Float:velocity_X, Float:velocity_dump_Y, Float:velocity_dump_Z;GetVehicleVelocity(vehicleid, velocity_X, velocity_dump_Y, velocity_dump_Z);velocity_dump_Y = 0.00;velocity_dump_Z = 0.00;return velocity_X;}
forward Float:GetVehicleVelocityY(vehicleid); stock Float:GetVehicleVelocityY(vehicleid){new Float:velocity_dump_X, Float:velocity_Y, Float:velocity_dump_Z;GetVehicleVelocity(vehicleid, velocity_dump_X, velocity_Y, velocity_dump_Z);velocity_dump_X = 0.00;velocity_dump_Z = 0.00;return velocity_Y;}
forward Float:GetVehicleVelocityZ(vehicleid); stock Float:GetVehicleVelocityZ(vehicleid){new Float:velocity_dump_X, Float:velocity_dump_Y, Float:velocity_Z;GetVehicleVelocity(vehicleid, velocity_dump_X, velocity_dump_Y, velocity_Z);velocity_dump_X = 0.00;velocity_dump_Y = 0.00;return velocity_Z;}
/* traduzido por http://www.MundoSAMP.com */
#define GetVehicleSpeed_P(%0) floatmul(floatsqroot(floatadd(floatpower(GetVehicleVelocityX(GetPlayerVehicleID(%0)), 2), floatadd(floatpower(GetVehicleVelocityY(GetPlayerVehicleID(%0)), 2), floatpower(GetVehicleVelocityZ(GetPlayerVehicleID(%0)), 2)))), 200)
#define GetVehicleSpeed_V(%0) floatmul(floatsqroot(floatadd(floatpower(GetVehicleVelocityX(%0), 2), floatadd(floatpower(GetVehicleVelocityY(%0), 2), floatpower(GetVehicleVelocityZ(%0), 2)))), 200);
/* traduzido por http://www.MundoSAMP.com */
enum E_VEHICLE_INFO { bool:vehicle_processed, Float:vehicle_fuel, FuelUpdateTimer, Float:vehicle_health }
new Text:VehicleText[MAX_PLAYERS][8], Float:LastSpeed[MAX_PLAYERS], VehicleInfo[MAX_VEHICLES][E_VEHICLE_INFO], Float:g_fSpeedCap[MAX_PLAYERS] = {0.0, ...}, bool:textdraws_processed[MAX_PLAYERS];
/* traduzido por http://www.MundoSAMP.com */
forward PlayerVehicleFuelUpdate(playerid);
forward SetPlayerSpeedCap(playerid, Float:value);
forward DisablePlayerSpeedCap(playerid);
/* traduzido por http://www.MundoSAMP.com */
static VehicleList[212][] =
{
{"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"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 1"},{"Previon"},{"Coach"},
{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},{"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"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"},{"ZR-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 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 LA"},{"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 Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},{"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},{"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},{"Trailer 3"},{"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"}
};
/* traduzido por http://www.MundoSAMP.com */
static Float:FuelStationCoords[][3] =
{
{2146.7766,2747.4424,10.8203},{2638.5972,1106.7181,10.8203},{1597.3271,2197.7712,10.8203},{608.5480,1699.3431,6.9922},{618.5945,1684.5210,6.9922},{-1470.1311,1863.6323,32.6328},{-737.2454,2742.9482,47.2266},{656.9113,-564.4317,16.510},{2202.2349,2474.3494,10.5258},{614.9333,1689.7418,6.6968},{-1328.8250,2677.2173,49.7665},{70.3882,1218.6783,18.5165},{2113.7390,920.1079,10.5255},{-1327.7218,2678.8723,50.0625},{-2409.5752,976.3114,45.2969},{-2026.0743,156.6390,28.7872},{-2244.5063,-2561.0781,31.9219},
{-1603.3645,-2709.4622,48.3874},{-1609.7147,-2717.6572,48.3874},{-88.9507,-1164.7794,2.3085},{-93.0625,-1173.2089,2.3244},{1003.7032,-937.5828,42.3281},{1940.6816,-1770.7999,13.3906},{1940.0111,-1776.4730,13.3906},{1381.7468,459.1537,20.3452},{-1680.0511,408.4660,7.1797},{-1672.9927,415.2118,7.1797},{-730.05,2744.22,47.22}
};
/* traduzido por http://www.MundoSAMP.com */
public SetPlayerSpeedCap(playerid, Float:value) { if(0 <= playerid < sizeof(g_fSpeedCap)) g_fSpeedCap[playerid] = value; }
public DisablePlayerSpeedCap(playerid) { if(0 <= playerid < sizeof(g_fSpeedCap)) g_fSpeedCap[playerid] = 0.0; }
/* traduzido por http://www.MundoSAMP.com */
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/abastecer", cmdtext, true) == 0)
{
new bool:found = false;
for(new i=0; i < sizeof(FuelStationCoords); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 6.5, FuelStationCoords[i][0], FuelStationCoords[i][1], FuelStationCoords[i][2]))
{
found = true;
}
}
if(!found) SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Vocк precisa estar em um posto de gasolina para usar este comando.");
else if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Vocк precisa estar em um veiculo para usar este comando.");
else
{
new Float:cost = ((100.00 - VehicleInfo[GetPlayerVehicleID(playerid)][vehicle_fuel]) * 100);
if(GetPlayerMoney(playerid) < cost)
{
new szOutput[128]; format(szOutput, sizeof(szOutput), "SERVER: Vocк nгo tem dinheiro para abastecer seu veiculo ($%i).", floatround(cost));
SendClientMessage(playerid, 0xFFFFFFFF, szOutput);
}
else
{
GivePlayerMoney(playerid, -(floatround(cost)));
VehicleInfo[GetPlayerVehicleID(playerid)][vehicle_fuel] = 100.00;
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Seu veiculo foi re-abastecido.");
}
}
return 1;
}
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & 16) && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && VehicleInfo[GetPlayerVehicleID(playerid)][vehicle_fuel] < 1)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, true);
DisablePlayerSpeedCap(playerid);
}
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger)
{
if(VehicleInfo[vehicleid][vehicle_processed] == false)
{
VehicleInfo[vehicleid][vehicle_processed] = true;
VehicleInfo[vehicleid][vehicle_fuel] = 100.00;
}
else
{
if(VehicleInfo[vehicleid][vehicle_fuel] == 0.00)
{
SetPlayerSpeedCap(playerid, 0.001);
PutPlayerInVehicle(playerid, vehicleid, 0);
TogglePlayerControllable(playerid, false);
GameTextForPlayer(playerid, "~r~Sem combustivel!", 1000, 4);
}
}
VehicleInfo[vehicleid][FuelUpdateTimer] = SetTimerEx("PlayerVehicleFuelUpdate", FUEL_UPDATE_TIME, 1, "i", playerid);
}
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
public OnPlayerExitVehicle(playerid, vehicleid)
{
DisablePlayerSpeedCap(playerid);
return KillTimer(VehicleInfo[vehicleid][FuelUpdateTimer]);
}
/* traduzido por http://www.MundoSAMP.com */
public PlayerVehicleFuelUpdate(playerid)
{
new const vehicleid = GetPlayerVehicleID(playerid);
new Float:memory[3]={0.00,0.00,0.00 }, result_speed=0;
GetVehicleVelocity(vehicleid,memory[0],memory[1],memory[2]);
result_speed = floatround(floatround(floatsqroot(((memory[0]*memory[0])+(memory[1]*memory[1]))+(memory[2]*memory[2]))*(136.666667),floatround_round)*(1.609344));
if(result_speed)
{
new _random = random(100); while(_random < 50) _random = random(100); new val[4]; format(val, sizeof(val), "0.%i", _random);
if(floatsub(VehicleInfo[vehicleid][vehicle_fuel], floatstr(val)) > 0.00)
{
VehicleInfo[vehicleid][vehicle_fuel] = floatsub(VehicleInfo[vehicleid][vehicle_fuel], floatstr(val));
new string[128], Float:health; GetVehicleHealth(GetPlayerVehicleID(playerid), health);
format(string, sizeof(string), "~r~Nome do veiculo: ~w~%s~r~ Lataria:~w~ %.2f\%% ~r~Combustivel: ~w~%.2f\%%", VehicleList[(GetVehicleModel(GetPlayerVehicleID(playerid)) - 400)], health / 1000 * 100, VehicleInfo[GetPlayerVehicleID(playerid)][vehicle_fuel]);
TextDrawHideForPlayer(playerid, VehicleText[playerid][0]);
TextDrawSetString(VehicleText[playerid][0], string);
TextDrawShowForPlayer(playerid, VehicleText[playerid][0]);
}
else
{
VehicleInfo[vehicleid][vehicle_fuel] = 0.00;
SetPlayerSpeedCap(playerid, 0.001);
TogglePlayerControllable(playerid, false);
GameTextForPlayer(playerid, "~r~Sem combustivel!", 1000, 4);
}
}
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
public OnPlayerUpdate(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:speed = GetVehicleSpeed_P(playerid);
if(speed != LastSpeed[playerid])
{
new szOutput[9];
format(szOutput, sizeof(szOutput), "%ikm/h", floatround(speed));
TextDrawHideForPlayer(playerid, VehicleText[playerid][1]);
TextDrawSetString(VehicleText[playerid][1], szOutput);
TextDrawShowForPlayer(playerid, VehicleText[playerid][1]);
LastSpeed[playerid] = speed;
}
new string[128], Float:health; GetVehicleHealth(GetPlayerVehicleID(playerid), health);
format(string, sizeof(string), "~r~Nome do veiculo: ~w~%s~r~ Lataria:~w~ %.2f\%% ~r~Combustivel: ~w~%.2f\%%", VehicleList[(GetVehicleModel(GetPlayerVehicleID(playerid)) - 400)], health / 1000 * 100, VehicleInfo[GetPlayerVehicleID(playerid)][vehicle_fuel]);
if(textdraws_processed[playerid] == false)
{
CreateTextdraws(playerid);
}
TextDrawHideForPlayer(playerid, VehicleText[playerid][0]);
TextDrawSetString(VehicleText[playerid][0], string);
TextDrawShowForPlayer(playerid, VehicleText[playerid][0]);
}
}
static s_iVehicle;
if(g_fSpeedCap[playerid] != 0.0 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
s_iVehicle = GetPlayerVehicleID(playerid);
if(s_iVehicle)
{
static Float:s_fX, Float:s_fY, Float:s_fZ, Float:s_fVX, Float:s_fVY, Float:s_fVZ;
GetVehiclePos(s_iVehicle, s_fX, s_fY, s_fZ );
GetVehicleVelocity(s_iVehicle, s_fVX, s_fVY, s_fVZ );
if(!IsPlayerInRangeOfPoint(playerid, g_fSpeedCap[playerid] + 0.05, s_fX + s_fVX, s_fY + s_fVY, s_fZ + s_fVZ))
{
static Float:s_fLength;
s_fLength = floatsqroot((s_fVX * s_fVX) + (s_fVY * s_fVY) + (s_fVZ * s_fVZ));
s_fVX = (s_fVX / s_fLength) * g_fSpeedCap[playerid];
s_fVY = (s_fVY / s_fLength) * g_fSpeedCap[playerid];
s_fVZ = (s_fVZ / s_fLength) * g_fSpeedCap[playerid];
if(s_iVehicle)
{
SetVehicleVelocity(s_iVehicle, s_fVX, s_fVY, s_fVZ);
}
else
{
SetPlayerVelocity(playerid, s_fVX, s_fVY, s_fVZ);
}
}
}
}
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i=0; i <= 7; i++)
{
TextDrawShowForPlayer(playerid, VehicleText[playerid][i]);
new string[128], Float:health;
GetVehicleHealth(GetPlayerVehicleID(playerid), health);
format(string, sizeof(string), "~r~Nome do veiculo: ~w~%s~r~ Lataria:~w~ %.2f\%% ~r~Combustivel: ~w~%.2f\%%", VehicleList[(GetVehicleModel(GetPlayerVehicleID(playerid)) - 400)], health / 1000 * 100, VehicleInfo[GetPlayerVehicleID(playerid)][vehicle_fuel]);
TextDrawHideForPlayer(playerid, VehicleText[playerid][0]);
TextDrawSetString(VehicleText[playerid][0], string);
TextDrawShowForPlayer(playerid, VehicleText[playerid][0]);
VehicleInfo[GetPlayerVehicleID(playerid)][vehicle_health] = health;
}
}
else
{
for(new i=0; i <= 7; i++)
{
TextDrawHideForPlayer(playerid, VehicleText[playerid][i]);
}
}
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
public OnFilterScriptExit()
{
for(new i=0; i < MAX_PLAYERS; i++)
{
for(new j=0; j <= 7; j++)
{
TextDrawDestroy(VehicleText[i][j]);
}
}
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
public OnPlayerDisconnect(playerid, reason)
{
for(new i=0; i <= 7; i++)
{
TextDrawDestroy(VehicleText[playerid][i]);
}
LastSpeed[playerid] = 0.00;
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
public OnPlayerConnect(playerid)
{
textdraws_processed[playerid] = false;
CreateTextdraws(playerid);
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
stock CreateTextdraws(playerid)
{
VehicleText[playerid][0] = TextDrawCreate(330.000000, 435.000000, "~r~Nome do veiculo: ~w~name~r~ Lataria:~w~ health ~r~Combustivel: ~w~fuel");
TextDrawAlignment(VehicleText[playerid][0], 2);
TextDrawBackgroundColor(VehicleText[playerid][0], 255);
TextDrawFont(VehicleText[playerid][0], 1);
TextDrawLetterSize(VehicleText[playerid][0], 0.340000, 1.000000);
TextDrawColor(VehicleText[playerid][0], -1);
TextDrawSetOutline(VehicleText[playerid][0], 1);
TextDrawSetProportional(VehicleText[playerid][0], 1);
TextDrawUseBox(VehicleText[playerid][0], 1);
TextDrawBoxColor(VehicleText[playerid][0], 100);
TextDrawTextSize(VehicleText[playerid][0], 713.000000, 860.000000);
VehicleText[playerid][1] = TextDrawCreate(321.000000, 409.000000, "000km/h");
TextDrawAlignment(VehicleText[playerid][1], 2);
TextDrawBackgroundColor(VehicleText[playerid][1], 255);
TextDrawFont(VehicleText[playerid][1], 1);
TextDrawLetterSize(VehicleText[playerid][1], 0.440000, 2.399999);
TextDrawColor(VehicleText[playerid][1], -1);
TextDrawSetOutline(VehicleText[playerid][1], 0);
TextDrawSetProportional(VehicleText[playerid][1], 1);
TextDrawSetShadow(VehicleText[playerid][1], 1);
TextDrawUseBox(VehicleText[playerid][1], 1);
TextDrawBoxColor(VehicleText[playerid][1], 100);
TextDrawTextSize(VehicleText[playerid][1], 163.000000, -131.000000);
VehicleText[playerid][2] = TextDrawCreate(259.000000, 433.000000, "_");
TextDrawBackgroundColor(VehicleText[playerid][2], 255);
TextDrawFont(VehicleText[playerid][2], 1);
TextDrawLetterSize(VehicleText[playerid][2], 0.500000, -0.200000);
TextDrawColor(VehicleText[playerid][2], -1);
TextDrawSetOutline(VehicleText[playerid][2], 0);
TextDrawSetProportional(VehicleText[playerid][2], 1);
TextDrawSetShadow(VehicleText[playerid][2], 1);
TextDrawUseBox(VehicleText[playerid][2], 1);
TextDrawBoxColor(VehicleText[playerid][2], 255);
TextDrawTextSize(VehicleText[playerid][2], -45.000000, 0.000000);
VehicleText[playerid][3] = TextDrawCreate(386.000000, 433.000000, "_");
TextDrawBackgroundColor(VehicleText[playerid][3], 255);
TextDrawFont(VehicleText[playerid][3], 1);
TextDrawLetterSize(VehicleText[playerid][3], 0.500000, -0.200000);
TextDrawColor(VehicleText[playerid][3], -1);
TextDrawSetOutline(VehicleText[playerid][3], 0);
TextDrawSetProportional(VehicleText[playerid][3], 1);
TextDrawSetShadow(VehicleText[playerid][3], 1);
TextDrawUseBox(VehicleText[playerid][3], 1);
TextDrawBoxColor(VehicleText[playerid][3], 255);
TextDrawTextSize(VehicleText[playerid][3], 648.000000, 0.000000);
VehicleText[playerid][4] = TextDrawCreate(259.000000, 409.000000, "_");
TextDrawBackgroundColor(VehicleText[playerid][4], 255);
TextDrawFont(VehicleText[playerid][4], 1);
TextDrawLetterSize(VehicleText[playerid][4], 0.500000, 2.200000);
TextDrawColor(VehicleText[playerid][4], -1);
TextDrawSetOutline(VehicleText[playerid][4], 0);
TextDrawSetProportional(VehicleText[playerid][4], 1);
TextDrawSetShadow(VehicleText[playerid][4], 1);
TextDrawUseBox(VehicleText[playerid][4], 1);
TextDrawBoxColor(VehicleText[playerid][4], 255);
TextDrawTextSize(VehicleText[playerid][4], 253.000000, 0.000000);
VehicleText[playerid][5] = TextDrawCreate(388.500000, 407.000000, "_");
TextDrawBackgroundColor(VehicleText[playerid][5], 255);
TextDrawFont(VehicleText[playerid][5], 1);
TextDrawLetterSize(VehicleText[playerid][5], 0.500000, -0.100000);
TextDrawColor(VehicleText[playerid][5], -1);
TextDrawSetOutline(VehicleText[playerid][5], 0);
TextDrawSetProportional(VehicleText[playerid][5], 1);
TextDrawSetShadow(VehicleText[playerid][5], 1);
TextDrawUseBox(VehicleText[playerid][5], 1);
TextDrawBoxColor(VehicleText[playerid][5], 255);
TextDrawTextSize(VehicleText[playerid][5], 253.000000, 24.000000);
VehicleText[playerid][6] = TextDrawCreate(386.000000, 408.000000, "_");
TextDrawBackgroundColor(VehicleText[playerid][6], 255);
TextDrawFont(VehicleText[playerid][6], 1);
TextDrawLetterSize(VehicleText[playerid][6], 0.500000, 2.599999);
TextDrawColor(VehicleText[playerid][6], -1);
TextDrawSetOutline(VehicleText[playerid][6], 0);
TextDrawSetProportional(VehicleText[playerid][6], 1);
TextDrawSetShadow(VehicleText[playerid][6], 1);
TextDrawUseBox(VehicleText[playerid][6], 1);
TextDrawBoxColor(VehicleText[playerid][6], 255);
TextDrawTextSize(VehicleText[playerid][6], 385.000000, 0.000000);
VehicleText[playerid][7] = TextDrawCreate(676.000000, 448.000000, "_");
TextDrawBackgroundColor(VehicleText[playerid][7], 255);
TextDrawFont(VehicleText[playerid][7], 1);
TextDrawLetterSize(VehicleText[playerid][7], 0.500000, -0.200000);
TextDrawColor(VehicleText[playerid][7], -1);
TextDrawSetOutline(VehicleText[playerid][7], 0);
TextDrawSetProportional(VehicleText[playerid][7], 1);
TextDrawSetShadow(VehicleText[playerid][7], 1);
TextDrawUseBox(VehicleText[playerid][7], 1);
TextDrawBoxColor(VehicleText[playerid][7], 255);
TextDrawTextSize(VehicleText[playerid][7], -45.000000, 0.000000);
textdraws_processed[playerid] = true;
return 1;
}
/* traduzido por http://www.MundoSAMP.com */
pawn Код:
public PlayerVehicleFuelUpdate(playerid)
{
new const vehicleid = GetPlayerVehicleID(playerid);
new Float:memory[3]={0.00,0.00,0.00 }, result_speed=0;
GetVehicleVelocity(vehicleid,memory[0],memory[1],memory[2]);
result_speed = floatround(floatround(floatsqroot(((memory[0]*memory[0])+(memory[1]*memory[1]))+(memory[2]*memory[2]))*(136.666667),floatround_round)*(1.609344));
if(result_speed)
{
new _random = random(100); while(_random < 50) _random = random(100); new val[4]; format(val, sizeof(val), "0.%i", _random);
if(floatsub(VehicleInfo[vehicleid][vehicle_fuel], floatstr(val)) > 0.00)
{
VehicleInfo[vehicleid][vehicle_fuel] = floatsub(VehicleInfo[vehicleid][vehicle_fuel], floatstr(val));
new string[128], Float:health; GetVehicleHealth(GetPlayerVehicleID(playerid), health);
format(string, sizeof(string), "~r~Nome do veiculo: ~w~%s~r~ Lataria:~w~ %.2f\%% ~r~Combustivel: ~w~%.2f\%%", VehicleList[(GetVehicleModel(GetPlayerVehicleID(playerid)) - 400)], health / 1000 * 100, VehicleInfo[GetPlayerVehicleID(playerid)][vehicle_fuel]);
TextDrawHideForPlayer(playerid, VehicleText[playerid][0]);
TextDrawSetString(VehicleText[playerid][0], string);
TextDrawShowForPlayer(playerid, VehicleText[playerid][0]);
}
else
{
VehicleInfo[vehicleid][vehicle_fuel] = 0.00;
SetPlayerSpeedCap(playerid, 0.001);
TogglePlayerControllable(playerid, false);
GameTextForPlayer(playerid, "~r~Sem combustivel!", 1000, 4);
}
}
return 1;
}
Obrigado