[Ajuda] Nгo ta descendo a gasolina
#1

oq tem de errado que nгo ta descendo o combustivel ?

Код:
#include a_samp
#include zcmd
#include sscanf2

new fuel;

new VehicleNames[][] = {
    "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel",
    "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
    "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam",
    "Esperanto", "Taxi", "Washington", "Bobcat", "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", "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", "Cropduster", "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", "Stratium",
    "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito",
    "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
    "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
    "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
    "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
    "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
    "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
    "Tiller", "Utility Trailer"
};

//Player Textdraws:

new PlayerText:v_velocidade [MAX_PLAYERS];
new PlayerText:v_gasolina[MAX_PLAYERS];
new PlayerText:v_nome[MAX_PLAYERS];
new PlayerText:v_progress_branco_gas[MAX_PLAYERS];
new PlayerText:v_progress_branco_velo[MAX_PLAYERS];
new PlayerText:v_progress_azul_velo[MAX_PLAYERS];
new PlayerText:v_progress_ver_velo[MAX_PLAYERS];
new PlayerText:v_progress_cinza_velo[MAX_PLAYERS];
new PlayerText:v_progress_cinza_gas[MAX_PLAYERS];

public OnFilterScriptInit() {
    SetTimer("a_velocimetro", 100, true);
    return true;
}

public OnPlayerConnect(playerid) {
    v_velocidade[playerid] = CreatePlayerTextDraw(playerid, 603.581237, 332.749847, "100");
    PlayerTextDrawLetterSize(playerid, v_velocidade[playerid], 0.439222, 1.424997);
    PlayerTextDrawAlignment(playerid, v_velocidade[playerid], 1);
    PlayerTextDrawColor(playerid, v_velocidade[playerid], -1138808065);
    PlayerTextDrawSetShadow(playerid, v_velocidade[playerid], 1);
    PlayerTextDrawSetOutline(playerid, v_velocidade[playerid], 0);
    PlayerTextDrawBackgroundColor(playerid, v_velocidade[playerid], -1);
    PlayerTextDrawFont(playerid, v_velocidade[playerid], 3);
    PlayerTextDrawSetProportional(playerid, v_velocidade[playerid], 1);

    v_gasolina[playerid] = CreatePlayerTextDraw(playerid, 603.644226, 347.750000, "100");
    PlayerTextDrawLetterSize(playerid, v_gasolina[playerid], 0.439222, 1.424997);
    PlayerTextDrawAlignment(playerid, v_gasolina[playerid], 1);
    PlayerTextDrawColor(playerid, v_gasolina[playerid], 121335295);
    PlayerTextDrawSetShadow(playerid, v_gasolina[playerid], 1);
    PlayerTextDrawSetOutline(playerid, v_gasolina[playerid], 0);
    PlayerTextDrawBackgroundColor(playerid, v_gasolina[playerid], -1);
    PlayerTextDrawFont(playerid, v_gasolina[playerid], 3);
    PlayerTextDrawSetProportional(playerid, v_gasolina[playerid], 1);

    v_nome[playerid] = CreatePlayerTextDraw(playerid, 507.939697, 305.499786, "Sultan");
    PlayerTextDrawLetterSize(playerid, v_nome[playerid], 0.398461, 2.090001);
    PlayerTextDrawAlignment(playerid, v_nome[playerid], 1);
    PlayerTextDrawColor(playerid, v_nome[playerid], -1);
    PlayerTextDrawSetShadow(playerid, v_nome[playerid], 0);
    PlayerTextDrawSetOutline(playerid, v_nome[playerid], 256);
    PlayerTextDrawBackgroundColor(playerid, v_nome[playerid], 51);
    PlayerTextDrawFont(playerid, v_nome[playerid], 3);
    PlayerTextDrawSetProportional(playerid, v_nome[playerid], 1);
    PlayerTextDrawSetSelectable(playerid, v_nome[playerid], true);

    v_progress_branco_gas[playerid] = CreatePlayerTextDraw(playerid, 603.176086, 350.749877, "usebox");//progres fundo gas
    PlayerTextDrawLetterSize(playerid, v_progress_branco_gas[playerid], 0.000000, 0.967953);
    PlayerTextDrawTextSize(playerid, v_progress_branco_gas[playerid], 506.345458, 0.000000);
    PlayerTextDrawUseBox(playerid, v_progress_branco_gas[playerid], true);
    PlayerTextDrawBoxColor(playerid, v_progress_branco_gas[playerid], -1);

    v_progress_branco_velo[playerid] = CreatePlayerTextDraw(playerid, 603.113037, 327.583374, "usebox");//progress fundo velo
    PlayerTextDrawLetterSize(playerid, v_progress_branco_velo[playerid], 0.000000, 1.858143);
    PlayerTextDrawTextSize(playerid, v_progress_branco_velo[playerid], 506.345520, 0.000000);
    PlayerTextDrawUseBox(playerid, v_progress_branco_velo[playerid], true);
    PlayerTextDrawBoxColor(playerid, v_progress_branco_velo[playerid], -1);

    v_progress_azul_velo[playerid] = CreatePlayerTextDraw(playerid, 602.770507, 351.749847, "usebox"); //progress azul
    PlayerTextDrawLetterSize(playerid, v_progress_azul_velo[playerid], 0.000000, 0.827396);
    PlayerTextDrawTextSize(playerid, v_progress_azul_velo[playerid], 506.813995, 0.000000);
    PlayerTextDrawUseBox(playerid, v_progress_azul_velo[playerid], true);
    PlayerTextDrawBoxColor(playerid, v_progress_azul_velo[playerid], 121335295);

    v_progress_ver_velo[playerid] = CreatePlayerTextDraw(playerid, 602.833435, 328.249816, "usebox"); //progress vermelho
    PlayerTextDrawLetterSize(playerid, v_progress_ver_velo[playerid], 0.000000, 1.717586);
    PlayerTextDrawTextSize(playerid, v_progress_ver_velo[playerid], 506.833435, 0.000000);
    PlayerTextDrawUseBox(playerid, v_progress_ver_velo[playerid], true);
    PlayerTextDrawBoxColor(playerid, v_progress_ver_velo[playerid], -1138808065);

    v_progress_cinza_velo[playerid] = CreatePlayerTextDraw(playerid, 602.833435, 328.249816, "usebox"); //progress velocidade
    PlayerTextDrawLetterSize(playerid, v_progress_cinza_velo[playerid], 0.000000, 1.717586);
    PlayerTextDrawTextSize(playerid, v_progress_cinza_velo[playerid], 506.833435, 0.000000);
    PlayerTextDrawUseBox(playerid, v_progress_cinza_velo[playerid], true);
    PlayerTextDrawBoxColor(playerid, v_progress_cinza_velo[playerid], 0x707170FF);

    v_progress_cinza_gas[playerid] = CreatePlayerTextDraw(playerid, 602.770507, 351.749847, "usebox"); //progress gasolina
    PlayerTextDrawLetterSize(playerid, v_progress_cinza_gas[playerid], 0.000000, 0.827396);
    PlayerTextDrawTextSize(playerid, v_progress_cinza_gas[playerid], 506.813995, 0.000000);
    PlayerTextDrawUseBox(playerid, v_progress_cinza_gas[playerid], true);
    PlayerTextDrawBoxColor(playerid, v_progress_cinza_gas[playerid], 0x707170FF);
    return true;
}

forward a_velocimetro();
public a_velocimetro() {
    for(new i; i < MAX_PLAYERS; i++) {
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER) {
            new fVelocidade = floatround(GetVehicleSpeed(GetPlayerVehicleID(i), 1)), v_index = GetPlayerVehicleID(i);
            new string_velocidade[32], string_gasolina[32];

            PlayerTextDrawShow(i, v_velocidade[i]);
            PlayerTextDrawShow(i, v_gasolina[i]);
            PlayerTextDrawShow(i, v_nome[i]);
            PlayerTextDrawShow(i, v_progress_branco_gas[i]);
            PlayerTextDrawShow(i, v_progress_branco_velo[i]);
            PlayerTextDrawShow(i, v_progress_azul_velo[i]);
            PlayerTextDrawShow(i, v_progress_ver_velo[i]);
            PlayerTextDrawShow(i, v_progress_cinza_velo[i]);
            PlayerTextDrawShow(i, v_progress_cinza_gas[i]);

            format(string_gasolina, sizeof(string_gasolina), "%d", fuel), PlayerTextDrawSetString(i, v_gasolina[i], string_gasolina);
            format(string_velocidade, sizeof(string_velocidade), "%i", fVelocidade), PlayerTextDrawSetString(i, v_velocidade[i], string_velocidade);
            PlayerTextDrawSetString(i, v_nome[i], GetVehicleName(v_index));

            PlayerTextDrawTextSize(i, v_progress_cinza_velo[i], (507.00 + ((97.0 * fVelocidade) / 160)), 0.0);

            switch(fuel) {
                case 94 .. 100: PlayerTextDrawTextSize(i, v_progress_cinza_gas[i], (507.00 + ((97.0 * 100) / 100 -5.5)), 0.0);
                default: PlayerTextDrawTextSize(i, v_progress_cinza_gas[i], (507.00 + ((97.0 * fuel) / 100 )), 0.0);
            }
        }
        else {
            PlayerTextDrawHide(i, v_velocidade[i]);
            PlayerTextDrawHide(i, v_gasolina[i]);
            PlayerTextDrawHide(i, v_nome[i]);
            PlayerTextDrawHide(i, v_progress_branco_gas[i]);
            PlayerTextDrawHide(i, v_progress_branco_velo[i]);
            PlayerTextDrawHide(i, v_progress_azul_velo[i]);
            PlayerTextDrawHide(i, v_progress_ver_velo[i]);
            PlayerTextDrawHide(i, v_progress_cinza_velo[i]);
            PlayerTextDrawHide(i, v_progress_cinza_gas[i]);
        }
    }
    return 1;
}

forward Float:GetVehicleSpeed(vehicleid, UseMPH = 0);
stock Float:GetVehicleSpeed(vehicleid, UseMPH = 0) {
    new Float:speed_x, Float:speed_y, Float:speed_z, Float:temp_speed;
    GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
    if(UseMPH == 0) temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
    else temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*85.4166672;
    floatround(temp_speed,floatround_round);
    return temp_speed;
}

stock GetVehicleName(vehicleid) {
    new String[128];
    format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
    return String;
}

command(criarcarro, playerid, params []) {
    new index, Float:pl_x, Float:pl_y, Float:pl_z;
    GetPlayerPos(playerid, pl_x, pl_y, pl_z);
    if(sscanf(params, "d", index)) return CreateVehicle(411, pl_x, pl_y, pl_z, 0.0, 6, 6, 99999999);
    return CreateVehicle(index, pl_x, pl_y, pl_z, 0.0, 6, 6, 99999999);
}

command(setfuel, playerid, params []) {
    new index;
    if(sscanf(params, "d", index)) return false;
    fuel = index;
    return true;
}
se alguйm puder me ajudar, Agradeзo!
Reply
#2

Testa ae!

Oque tem de errado!?
1°Vocк criou apenas uma variavel fuel, entгo para todos os players o valor seria o mesmo, com o fuel[MAX_PLAYERS] cada um terб seu combustivel com valores diferente!

2°Nгo havia no sistema um esquema pela qual fazia com que a contagem da gasolina foce decrementada!


PHP код:
#include a_samp
#include zcmd
#include sscanf2
new fuel[MAX_PLAYERS];
new 
VehicleNames[][] = {
    
"Landstalker""Bravura""Buffalo""Linerunner""Perrenial""Sentinel",
    
"Dumper""Firetruck""Trashmaster""Stretch""Manana""Infernus",
    
"Voodoo""Pony""Mule""Cheetah""Ambulance""Leviathan""Moonbeam",
    
"Esperanto""Taxi""Washington""Bobcat""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""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""Cropduster""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""Stratium",
    
"Elegy""Raindance""RC Tiger""Flash""Tahoma""Savanna""Bandito",
    
"Freight Flat""Streak Carriage""Kart""Mower""Dune""Sweeper",
    
"Broadway""Tornado""AT-400""DFT-30""Huntley""Stafford""BF-400",
    
"News Van""Tug""Trailer""Emperor""Wayfarer""Euros""Hotdog""Club",
    
"Freight Box""Trailer""Andromada""Dodo""RC Cam""Launch""Police Car",
    
"Police Car""Police Car""Police Ranger""Picador""S.W.A.T""Alpha",
    
"Phoenix""Glendale""Sadler""Luggage""Luggage""Stairs""Boxville",
    
"Tiller""Utility Trailer"
};
//Player Textdraws:
new PlayerText:v_velocidade [MAX_PLAYERS];
new 
PlayerText:v_gasolina[MAX_PLAYERS];
new 
PlayerText:v_nome[MAX_PLAYERS];
new 
PlayerText:v_progress_branco_gas[MAX_PLAYERS];
new 
PlayerText:v_progress_branco_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_azul_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_ver_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_cinza_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_cinza_gas[MAX_PLAYERS];
public 
OnFilterScriptInit() {
    
SetTimer("a_velocimetro"100true);
    
SetTimer("GasolinaVeiculo"10000true); //10 Segundos
    
return true;
}
public 
OnPlayerConnect(playerid) {
    
v_velocidade[playerid] = CreatePlayerTextDraw(playerid603.581237332.749847"100");
    
PlayerTextDrawLetterSize(playeridv_velocidade[playerid], 0.4392221.424997);
    
PlayerTextDrawAlignment(playeridv_velocidade[playerid], 1);
    
PlayerTextDrawColor(playeridv_velocidade[playerid], -1138808065);
    
PlayerTextDrawSetShadow(playeridv_velocidade[playerid], 1);
    
PlayerTextDrawSetOutline(playeridv_velocidade[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridv_velocidade[playerid], -1);
    
PlayerTextDrawFont(playeridv_velocidade[playerid], 3);
    
PlayerTextDrawSetProportional(playeridv_velocidade[playerid], 1);
    
v_gasolina[playerid] = CreatePlayerTextDraw(playerid603.644226347.750000"100");
    
PlayerTextDrawLetterSize(playeridv_gasolina[playerid], 0.4392221.424997);
    
PlayerTextDrawAlignment(playeridv_gasolina[playerid], 1);
    
PlayerTextDrawColor(playeridv_gasolina[playerid], 121335295);
    
PlayerTextDrawSetShadow(playeridv_gasolina[playerid], 1);
    
PlayerTextDrawSetOutline(playeridv_gasolina[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridv_gasolina[playerid], -1);
    
PlayerTextDrawFont(playeridv_gasolina[playerid], 3);
    
PlayerTextDrawSetProportional(playeridv_gasolina[playerid], 1);
    
v_nome[playerid] = CreatePlayerTextDraw(playerid507.939697305.499786"Sultan");
    
PlayerTextDrawLetterSize(playeridv_nome[playerid], 0.3984612.090001);
    
PlayerTextDrawAlignment(playeridv_nome[playerid], 1);
    
PlayerTextDrawColor(playeridv_nome[playerid], -1);
    
PlayerTextDrawSetShadow(playeridv_nome[playerid], 0);
    
PlayerTextDrawSetOutline(playeridv_nome[playerid], 256);
    
PlayerTextDrawBackgroundColor(playeridv_nome[playerid], 51);
    
PlayerTextDrawFont(playeridv_nome[playerid], 3);
    
PlayerTextDrawSetProportional(playeridv_nome[playerid], 1);
    
PlayerTextDrawSetSelectable(playeridv_nome[playerid], true);
    
v_progress_branco_gas[playerid] = CreatePlayerTextDraw(playerid603.176086350.749877"usebox");//progres fundo gas
    
PlayerTextDrawLetterSize(playeridv_progress_branco_gas[playerid], 0.0000000.967953);
    
PlayerTextDrawTextSize(playeridv_progress_branco_gas[playerid], 506.3454580.000000);
    
PlayerTextDrawUseBox(playeridv_progress_branco_gas[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_branco_gas[playerid], -1);
    
v_progress_branco_velo[playerid] = CreatePlayerTextDraw(playerid603.113037327.583374"usebox");//progress fundo velo
    
PlayerTextDrawLetterSize(playeridv_progress_branco_velo[playerid], 0.0000001.858143);
    
PlayerTextDrawTextSize(playeridv_progress_branco_velo[playerid], 506.3455200.000000);
    
PlayerTextDrawUseBox(playeridv_progress_branco_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_branco_velo[playerid], -1);
    
v_progress_azul_velo[playerid] = CreatePlayerTextDraw(playerid602.770507351.749847"usebox"); //progress azul
    
PlayerTextDrawLetterSize(playeridv_progress_azul_velo[playerid], 0.0000000.827396);
    
PlayerTextDrawTextSize(playeridv_progress_azul_velo[playerid], 506.8139950.000000);
    
PlayerTextDrawUseBox(playeridv_progress_azul_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_azul_velo[playerid], 121335295);
    
v_progress_ver_velo[playerid] = CreatePlayerTextDraw(playerid602.833435328.249816"usebox"); //progress vermelho
    
PlayerTextDrawLetterSize(playeridv_progress_ver_velo[playerid], 0.0000001.717586);
    
PlayerTextDrawTextSize(playeridv_progress_ver_velo[playerid], 506.8334350.000000);
    
PlayerTextDrawUseBox(playeridv_progress_ver_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_ver_velo[playerid], -1138808065);
    
v_progress_cinza_velo[playerid] = CreatePlayerTextDraw(playerid602.833435328.249816"usebox"); //progress velocidade
    
PlayerTextDrawLetterSize(playeridv_progress_cinza_velo[playerid], 0.0000001.717586);
    
PlayerTextDrawTextSize(playeridv_progress_cinza_velo[playerid], 506.8334350.000000);
    
PlayerTextDrawUseBox(playeridv_progress_cinza_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_cinza_velo[playerid], 0x707170FF);
    
v_progress_cinza_gas[playerid] = CreatePlayerTextDraw(playerid602.770507351.749847"usebox"); //progress gasolina
    
PlayerTextDrawLetterSize(playeridv_progress_cinza_gas[playerid], 0.0000000.827396);
    
PlayerTextDrawTextSize(playeridv_progress_cinza_gas[playerid], 506.8139950.000000);
    
PlayerTextDrawUseBox(playeridv_progress_cinza_gas[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_cinza_gas[playerid], 0x707170FF);
    return 
true;
}
forward a_velocimetro();
public 
a_velocimetro() {
    for(new 
iMAX_PLAYERSi++) {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER) {
            new 
fVelocidade floatround(GetVehicleSpeed(GetPlayerVehicleID(i), 1)), v_index GetPlayerVehicleID(i);
            new 
string_velocidade[32], string_gasolina[32];
            
PlayerTextDrawShow(iv_velocidade[i]);
            
PlayerTextDrawShow(iv_gasolina[i]);
            
PlayerTextDrawShow(iv_nome[i]);
            
PlayerTextDrawShow(iv_progress_branco_gas[i]);
            
PlayerTextDrawShow(iv_progress_branco_velo[i]);
            
PlayerTextDrawShow(iv_progress_azul_velo[i]);
            
PlayerTextDrawShow(iv_progress_ver_velo[i]);
            
PlayerTextDrawShow(iv_progress_cinza_velo[i]);
            
PlayerTextDrawShow(iv_progress_cinza_gas[i]);
            
format(string_gasolinasizeof(string_gasolina), "%d"fuel[i]), PlayerTextDrawSetString(iv_gasolina[i], string_gasolina);
            
format(string_velocidadesizeof(string_velocidade), "%i"fVelocidade), PlayerTextDrawSetString(iv_velocidade[i], string_velocidade);
            
PlayerTextDrawSetString(iv_nome[i], GetVehicleName(v_index));
            
PlayerTextDrawTextSize(iv_progress_cinza_velo[i], (507.00 + ((97.0 fVelocidade) / 160)), 0.0);
            switch(
fuel[i]) {
                case 
94 .. 100PlayerTextDrawTextSize(iv_progress_cinza_gas[i], (507.00 + ((97.0 100) / 100 -5.5)), 0.0);
                default: 
PlayerTextDrawTextSize(iv_progress_cinza_gas[i], (507.00 + ((97.0 fuel[i]) / 100 )), 0.0);
            }
        }
        else {
            
PlayerTextDrawHide(iv_velocidade[i]);
            
PlayerTextDrawHide(iv_gasolina[i]);
            
PlayerTextDrawHide(iv_nome[i]);
            
PlayerTextDrawHide(iv_progress_branco_gas[i]);
            
PlayerTextDrawHide(iv_progress_branco_velo[i]);
            
PlayerTextDrawHide(iv_progress_azul_velo[i]);
            
PlayerTextDrawHide(iv_progress_ver_velo[i]);
            
PlayerTextDrawHide(iv_progress_cinza_velo[i]);
            
PlayerTextDrawHide(iv_progress_cinza_gas[i]);
        }
    }
    return 
1;
}
forward Float:GetVehicleSpeed(vehicleidUseMPH 0);
stock Float:GetVehicleSpeed(vehicleidUseMPH 0) {
    new 
Float:speed_xFloat:speed_yFloat:speed_zFloat:temp_speed;
    
GetVehicleVelocity(vehicleidspeed_xspeed_yspeed_z);
    if(
UseMPH == 0temp_speed floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
    else 
temp_speed floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*85.4166672;
    
floatround(temp_speed,floatround_round);
    return 
temp_speed;
}
stock GetVehicleName(vehicleid) {
    new 
String[128];
    
format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
    return 
String;
}
command(criarcarroplayeridparams []) {
    new 
indexFloat:pl_xFloat:pl_yFloat:pl_z;
    
GetPlayerPos(playeridpl_xpl_ypl_z);
    if(
sscanf(params"d"index)) return CreateVehicle(411pl_xpl_ypl_z0.06699999999);
    return 
CreateVehicle(indexpl_xpl_ypl_z0.06699999999);
}
command(setfuelplayeridparams []) {
    new 
index;
    if(
sscanf(params"d"index)) return false;
    
fuel[playerid) = index;
    return 
true;
}
//FUNDAMENTAL!
forward GasolinaVeiculo();
public 
GasolinaVeiculo()
{
    for(new 
iMAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            
fuel[playerid] --;
        }
    }

Reply
#3

E outra dъvida , esse combustivel fica guardado em cada veнculo ou em cada conta? (Obs:preciso guardar nos vehiculos).
Reply
#4

Quote:
Originally Posted by TheCrazyy
Посмотреть сообщение
E outra dъvida , esse combustivel fica guardado em cada veнculo ou em cada conta? (Obs:preciso guardar nos vehiculos).
Ele esta armazenado em uma variбvel relacionado a cada player!

MODO QUE FICA ARMAZENADO NOS VEICULOS
PHP код:
#include a_samp
#include zcmd
#include sscanf2
new fuel[MAX_VEHICLES];
new 
VehicleNames[][] = {
    
"Landstalker""Bravura""Buffalo""Linerunner""Perrenial""Sentinel",
    
"Dumper""Firetruck""Trashmaster""Stretch""Manana""Infernus",
    
"Voodoo""Pony""Mule""Cheetah""Ambulance""Leviathan""Moonbeam",
    
"Esperanto""Taxi""Washington""Bobcat""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""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""Cropduster""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""Stratium",
    
"Elegy""Raindance""RC Tiger""Flash""Tahoma""Savanna""Bandito",
    
"Freight Flat""Streak Carriage""Kart""Mower""Dune""Sweeper",
    
"Broadway""Tornado""AT-400""DFT-30""Huntley""Stafford""BF-400",
    
"News Van""Tug""Trailer""Emperor""Wayfarer""Euros""Hotdog""Club",
    
"Freight Box""Trailer""Andromada""Dodo""RC Cam""Launch""Police Car",
    
"Police Car""Police Car""Police Ranger""Picador""S.W.A.T""Alpha",
    
"Phoenix""Glendale""Sadler""Luggage""Luggage""Stairs""Boxville",
    
"Tiller""Utility Trailer"
};
//Player Textdraws:
new PlayerText:v_velocidade [MAX_PLAYERS];
new 
PlayerText:v_gasolina[MAX_PLAYERS];
new 
PlayerText:v_nome[MAX_PLAYERS];
new 
PlayerText:v_progress_branco_gas[MAX_PLAYERS];
new 
PlayerText:v_progress_branco_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_azul_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_ver_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_cinza_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_cinza_gas[MAX_PLAYERS];
public 
OnFilterScriptInit()
{
    
SetTimer("a_velocimetro"100true);
    
SetTimer("GasolinaVeiculo"10000true); //10 Segundos
    
for(new 0MAX_VEHICLESi++)
    {
        
fuel[i] == 100// Seta a gasolina inicial de todos os veiculos para 100
    
}
    return 
true;
}
public 
OnPlayerConnect(playerid) {
    
v_velocidade[playerid] = CreatePlayerTextDraw(playerid603.581237332.749847"100");
    
PlayerTextDrawLetterSize(playeridv_velocidade[playerid], 0.4392221.424997);
    
PlayerTextDrawAlignment(playeridv_velocidade[playerid], 1);
    
PlayerTextDrawColor(playeridv_velocidade[playerid], -1138808065);
    
PlayerTextDrawSetShadow(playeridv_velocidade[playerid], 1);
    
PlayerTextDrawSetOutline(playeridv_velocidade[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridv_velocidade[playerid], -1);
    
PlayerTextDrawFont(playeridv_velocidade[playerid], 3);
    
PlayerTextDrawSetProportional(playeridv_velocidade[playerid], 1);
    
v_gasolina[playerid] = CreatePlayerTextDraw(playerid603.644226347.750000"100");
    
PlayerTextDrawLetterSize(playeridv_gasolina[playerid], 0.4392221.424997);
    
PlayerTextDrawAlignment(playeridv_gasolina[playerid], 1);
    
PlayerTextDrawColor(playeridv_gasolina[playerid], 121335295);
    
PlayerTextDrawSetShadow(playeridv_gasolina[playerid], 1);
    
PlayerTextDrawSetOutline(playeridv_gasolina[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridv_gasolina[playerid], -1);
    
PlayerTextDrawFont(playeridv_gasolina[playerid], 3);
    
PlayerTextDrawSetProportional(playeridv_gasolina[playerid], 1);
    
v_nome[playerid] = CreatePlayerTextDraw(playerid507.939697305.499786"Sultan");
    
PlayerTextDrawLetterSize(playeridv_nome[playerid], 0.3984612.090001);
    
PlayerTextDrawAlignment(playeridv_nome[playerid], 1);
    
PlayerTextDrawColor(playeridv_nome[playerid], -1);
    
PlayerTextDrawSetShadow(playeridv_nome[playerid], 0);
    
PlayerTextDrawSetOutline(playeridv_nome[playerid], 256);
    
PlayerTextDrawBackgroundColor(playeridv_nome[playerid], 51);
    
PlayerTextDrawFont(playeridv_nome[playerid], 3);
    
PlayerTextDrawSetProportional(playeridv_nome[playerid], 1);
    
PlayerTextDrawSetSelectable(playeridv_nome[playerid], true);
    
v_progress_branco_gas[playerid] = CreatePlayerTextDraw(playerid603.176086350.749877"usebox");//progres fundo gas
    
PlayerTextDrawLetterSize(playeridv_progress_branco_gas[playerid], 0.0000000.967953);
    
PlayerTextDrawTextSize(playeridv_progress_branco_gas[playerid], 506.3454580.000000);
    
PlayerTextDrawUseBox(playeridv_progress_branco_gas[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_branco_gas[playerid], -1);
    
v_progress_branco_velo[playerid] = CreatePlayerTextDraw(playerid603.113037327.583374"usebox");//progress fundo velo
    
PlayerTextDrawLetterSize(playeridv_progress_branco_velo[playerid], 0.0000001.858143);
    
PlayerTextDrawTextSize(playeridv_progress_branco_velo[playerid], 506.3455200.000000);
    
PlayerTextDrawUseBox(playeridv_progress_branco_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_branco_velo[playerid], -1);
    
v_progress_azul_velo[playerid] = CreatePlayerTextDraw(playerid602.770507351.749847"usebox"); //progress azul
    
PlayerTextDrawLetterSize(playeridv_progress_azul_velo[playerid], 0.0000000.827396);
    
PlayerTextDrawTextSize(playeridv_progress_azul_velo[playerid], 506.8139950.000000);
    
PlayerTextDrawUseBox(playeridv_progress_azul_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_azul_velo[playerid], 121335295);
    
v_progress_ver_velo[playerid] = CreatePlayerTextDraw(playerid602.833435328.249816"usebox"); //progress vermelho
    
PlayerTextDrawLetterSize(playeridv_progress_ver_velo[playerid], 0.0000001.717586);
    
PlayerTextDrawTextSize(playeridv_progress_ver_velo[playerid], 506.8334350.000000);
    
PlayerTextDrawUseBox(playeridv_progress_ver_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_ver_velo[playerid], -1138808065);
    
v_progress_cinza_velo[playerid] = CreatePlayerTextDraw(playerid602.833435328.249816"usebox"); //progress velocidade
    
PlayerTextDrawLetterSize(playeridv_progress_cinza_velo[playerid], 0.0000001.717586);
    
PlayerTextDrawTextSize(playeridv_progress_cinza_velo[playerid], 506.8334350.000000);
    
PlayerTextDrawUseBox(playeridv_progress_cinza_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_cinza_velo[playerid], 0x707170FF);
    
v_progress_cinza_gas[playerid] = CreatePlayerTextDraw(playerid602.770507351.749847"usebox"); //progress gasolina
    
PlayerTextDrawLetterSize(playeridv_progress_cinza_gas[playerid], 0.0000000.827396);
    
PlayerTextDrawTextSize(playeridv_progress_cinza_gas[playerid], 506.8139950.000000);
    
PlayerTextDrawUseBox(playeridv_progress_cinza_gas[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_cinza_gas[playerid], 0x707170FF);
    return 
true;
}
forward a_velocimetro();
public 
a_velocimetro() {
    for(new 
iMAX_PLAYERSi++) {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER) {
            new 
fVelocidade floatround(GetVehicleSpeed(GetPlayerVehicleID(i), 1)), v_index GetPlayerVehicleID(i);
            new 
string_velocidade[32], string_gasolina[32];
            
PlayerTextDrawShow(iv_velocidade[i]);
            
PlayerTextDrawShow(iv_gasolina[i]);
            
PlayerTextDrawShow(iv_nome[i]);
            
PlayerTextDrawShow(iv_progress_branco_gas[i]);
            
PlayerTextDrawShow(iv_progress_branco_velo[i]);
            
PlayerTextDrawShow(iv_progress_azul_velo[i]);
            
PlayerTextDrawShow(iv_progress_ver_velo[i]);
            
PlayerTextDrawShow(iv_progress_cinza_velo[i]);
            
PlayerTextDrawShow(iv_progress_cinza_gas[i]);
            
format(string_gasolinasizeof(string_gasolina), "%d"fuel[GetPlayerVehicleID(i)], PlayerTextDrawSetString(iv_gasolina[i], string_gasolina);
            
format(string_velocidadesizeof(string_velocidade), "%i"fVelocidade), PlayerTextDrawSetString(iv_velocidade[i], string_velocidade);
            
PlayerTextDrawSetString(iv_nome[i], GetVehicleName(v_index));
            
PlayerTextDrawTextSize(iv_progress_cinza_velo[i], (507.00 + ((97.0 fVelocidade) / 160)), 0.0);
            switch(
fuel[GetPlayerVehicleID(i)]) {
                case 
94 .. 100PlayerTextDrawTextSize(iv_progress_cinza_gas[i], (507.00 + ((97.0 100) / 100 -5.5)), 0.0);
                default: 
PlayerTextDrawTextSize(iv_progress_cinza_gas[i], (507.00 + ((97.0 fuel[GetPlayerVehicleID(i)]) / 100 )), 0.0);
            }
        }
        else {
            
PlayerTextDrawHide(iv_velocidade[i]);
            
PlayerTextDrawHide(iv_gasolina[i]);
            
PlayerTextDrawHide(iv_nome[i]);
            
PlayerTextDrawHide(iv_progress_branco_gas[i]);
            
PlayerTextDrawHide(iv_progress_branco_velo[i]);
            
PlayerTextDrawHide(iv_progress_azul_velo[i]);
            
PlayerTextDrawHide(iv_progress_ver_velo[i]);
            
PlayerTextDrawHide(iv_progress_cinza_velo[i]);
            
PlayerTextDrawHide(iv_progress_cinza_gas[i]);
        }
    }
    return 
1;
}
forward Float:GetVehicleSpeed(vehicleidUseMPH 0);
stock Float:GetVehicleSpeed(vehicleidUseMPH 0) {
    new 
Float:speed_xFloat:speed_yFloat:speed_zFloat:temp_speed;
    
GetVehicleVelocity(vehicleidspeed_xspeed_yspeed_z);
    if(
UseMPH == 0temp_speed floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
    else 
temp_speed floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*85.4166672;
    
floatround(temp_speed,floatround_round);
    return 
temp_speed;
}
stock GetVehicleName(vehicleid) {
    new 
String[128];
    
format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
    return 
String;
}
command(criarcarroplayeridparams []) {
    new 
indexFloat:pl_xFloat:pl_yFloat:pl_z;
    
GetPlayerPos(playeridpl_xpl_ypl_z);
    if(
sscanf(params"d"index)) return CreateVehicle(411pl_xpl_ypl_z0.06699999999);
    return 
CreateVehicle(indexpl_xpl_ypl_z0.06699999999);
}
command(setfuelplayeridparams []) {
    new 
index;
    if(
sscanf(params"d"index)) return false;
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"Erro! Vocк nгo estб em um veiculo!");
    
fuel[GetPlayerVehicleID(playerid)] = index;
    return 
true;
}
//FUNDAMENTAL!
forward GasolinaVeiculo();
public 
GasolinaVeiculo()
{
    for(new 
iMAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            
fuel[GetPlayerVehicleID(i)] --;
        }
    }

Reply
#5

Quote:
Originally Posted by AdrianoStk
Посмотреть сообщение
Ele esta armazenado em uma variбvel relacionado a cada player!

MODO QUE FICA ARMAZENADO NOS VEICULOS
PHP код:
#include a_samp
#include zcmd
#include sscanf2
new fuel[MAX_VEHICLES];
new 
VehicleNames[][] = {
    
"Landstalker""Bravura""Buffalo""Linerunner""Perrenial""Sentinel",
    
"Dumper""Firetruck""Trashmaster""Stretch""Manana""Infernus",
    
"Voodoo""Pony""Mule""Cheetah""Ambulance""Leviathan""Moonbeam",
    
"Esperanto""Taxi""Washington""Bobcat""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""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""Cropduster""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""Stratium",
    
"Elegy""Raindance""RC Tiger""Flash""Tahoma""Savanna""Bandito",
    
"Freight Flat""Streak Carriage""Kart""Mower""Dune""Sweeper",
    
"Broadway""Tornado""AT-400""DFT-30""Huntley""Stafford""BF-400",
    
"News Van""Tug""Trailer""Emperor""Wayfarer""Euros""Hotdog""Club",
    
"Freight Box""Trailer""Andromada""Dodo""RC Cam""Launch""Police Car",
    
"Police Car""Police Car""Police Ranger""Picador""S.W.A.T""Alpha",
    
"Phoenix""Glendale""Sadler""Luggage""Luggage""Stairs""Boxville",
    
"Tiller""Utility Trailer"
};
//Player Textdraws:
new PlayerText:v_velocidade [MAX_PLAYERS];
new 
PlayerText:v_gasolina[MAX_PLAYERS];
new 
PlayerText:v_nome[MAX_PLAYERS];
new 
PlayerText:v_progress_branco_gas[MAX_PLAYERS];
new 
PlayerText:v_progress_branco_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_azul_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_ver_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_cinza_velo[MAX_PLAYERS];
new 
PlayerText:v_progress_cinza_gas[MAX_PLAYERS];
public 
OnFilterScriptInit()
{
    
SetTimer("a_velocimetro"100true);
    
SetTimer("GasolinaVeiculo"10000true); //10 Segundos
    
for(new 0MAX_VEHICLESi++)
    {
        
fuel[i] == 100// Seta a gasolina inicial de todos os veiculos para 100
    
}
    return 
true;
}
public 
OnPlayerConnect(playerid) {
    
v_velocidade[playerid] = CreatePlayerTextDraw(playerid603.581237332.749847"100");
    
PlayerTextDrawLetterSize(playeridv_velocidade[playerid], 0.4392221.424997);
    
PlayerTextDrawAlignment(playeridv_velocidade[playerid], 1);
    
PlayerTextDrawColor(playeridv_velocidade[playerid], -1138808065);
    
PlayerTextDrawSetShadow(playeridv_velocidade[playerid], 1);
    
PlayerTextDrawSetOutline(playeridv_velocidade[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridv_velocidade[playerid], -1);
    
PlayerTextDrawFont(playeridv_velocidade[playerid], 3);
    
PlayerTextDrawSetProportional(playeridv_velocidade[playerid], 1);
    
v_gasolina[playerid] = CreatePlayerTextDraw(playerid603.644226347.750000"100");
    
PlayerTextDrawLetterSize(playeridv_gasolina[playerid], 0.4392221.424997);
    
PlayerTextDrawAlignment(playeridv_gasolina[playerid], 1);
    
PlayerTextDrawColor(playeridv_gasolina[playerid], 121335295);
    
PlayerTextDrawSetShadow(playeridv_gasolina[playerid], 1);
    
PlayerTextDrawSetOutline(playeridv_gasolina[playerid], 0);
    
PlayerTextDrawBackgroundColor(playeridv_gasolina[playerid], -1);
    
PlayerTextDrawFont(playeridv_gasolina[playerid], 3);
    
PlayerTextDrawSetProportional(playeridv_gasolina[playerid], 1);
    
v_nome[playerid] = CreatePlayerTextDraw(playerid507.939697305.499786"Sultan");
    
PlayerTextDrawLetterSize(playeridv_nome[playerid], 0.3984612.090001);
    
PlayerTextDrawAlignment(playeridv_nome[playerid], 1);
    
PlayerTextDrawColor(playeridv_nome[playerid], -1);
    
PlayerTextDrawSetShadow(playeridv_nome[playerid], 0);
    
PlayerTextDrawSetOutline(playeridv_nome[playerid], 256);
    
PlayerTextDrawBackgroundColor(playeridv_nome[playerid], 51);
    
PlayerTextDrawFont(playeridv_nome[playerid], 3);
    
PlayerTextDrawSetProportional(playeridv_nome[playerid], 1);
    
PlayerTextDrawSetSelectable(playeridv_nome[playerid], true);
    
v_progress_branco_gas[playerid] = CreatePlayerTextDraw(playerid603.176086350.749877"usebox");//progres fundo gas
    
PlayerTextDrawLetterSize(playeridv_progress_branco_gas[playerid], 0.0000000.967953);
    
PlayerTextDrawTextSize(playeridv_progress_branco_gas[playerid], 506.3454580.000000);
    
PlayerTextDrawUseBox(playeridv_progress_branco_gas[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_branco_gas[playerid], -1);
    
v_progress_branco_velo[playerid] = CreatePlayerTextDraw(playerid603.113037327.583374"usebox");//progress fundo velo
    
PlayerTextDrawLetterSize(playeridv_progress_branco_velo[playerid], 0.0000001.858143);
    
PlayerTextDrawTextSize(playeridv_progress_branco_velo[playerid], 506.3455200.000000);
    
PlayerTextDrawUseBox(playeridv_progress_branco_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_branco_velo[playerid], -1);
    
v_progress_azul_velo[playerid] = CreatePlayerTextDraw(playerid602.770507351.749847"usebox"); //progress azul
    
PlayerTextDrawLetterSize(playeridv_progress_azul_velo[playerid], 0.0000000.827396);
    
PlayerTextDrawTextSize(playeridv_progress_azul_velo[playerid], 506.8139950.000000);
    
PlayerTextDrawUseBox(playeridv_progress_azul_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_azul_velo[playerid], 121335295);
    
v_progress_ver_velo[playerid] = CreatePlayerTextDraw(playerid602.833435328.249816"usebox"); //progress vermelho
    
PlayerTextDrawLetterSize(playeridv_progress_ver_velo[playerid], 0.0000001.717586);
    
PlayerTextDrawTextSize(playeridv_progress_ver_velo[playerid], 506.8334350.000000);
    
PlayerTextDrawUseBox(playeridv_progress_ver_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_ver_velo[playerid], -1138808065);
    
v_progress_cinza_velo[playerid] = CreatePlayerTextDraw(playerid602.833435328.249816"usebox"); //progress velocidade
    
PlayerTextDrawLetterSize(playeridv_progress_cinza_velo[playerid], 0.0000001.717586);
    
PlayerTextDrawTextSize(playeridv_progress_cinza_velo[playerid], 506.8334350.000000);
    
PlayerTextDrawUseBox(playeridv_progress_cinza_velo[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_cinza_velo[playerid], 0x707170FF);
    
v_progress_cinza_gas[playerid] = CreatePlayerTextDraw(playerid602.770507351.749847"usebox"); //progress gasolina
    
PlayerTextDrawLetterSize(playeridv_progress_cinza_gas[playerid], 0.0000000.827396);
    
PlayerTextDrawTextSize(playeridv_progress_cinza_gas[playerid], 506.8139950.000000);
    
PlayerTextDrawUseBox(playeridv_progress_cinza_gas[playerid], true);
    
PlayerTextDrawBoxColor(playeridv_progress_cinza_gas[playerid], 0x707170FF);
    return 
true;
}
forward a_velocimetro();
public 
a_velocimetro() {
    for(new 
iMAX_PLAYERSi++) {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER) {
            new 
fVelocidade floatround(GetVehicleSpeed(GetPlayerVehicleID(i), 1)), v_index GetPlayerVehicleID(i);
            new 
string_velocidade[32], string_gasolina[32];
            
PlayerTextDrawShow(iv_velocidade[i]);
            
PlayerTextDrawShow(iv_gasolina[i]);
            
PlayerTextDrawShow(iv_nome[i]);
            
PlayerTextDrawShow(iv_progress_branco_gas[i]);
            
PlayerTextDrawShow(iv_progress_branco_velo[i]);
            
PlayerTextDrawShow(iv_progress_azul_velo[i]);
            
PlayerTextDrawShow(iv_progress_ver_velo[i]);
            
PlayerTextDrawShow(iv_progress_cinza_velo[i]);
            
PlayerTextDrawShow(iv_progress_cinza_gas[i]);
            
format(string_gasolinasizeof(string_gasolina), "%d"fuel[GetPlayerVehicleID(i)], PlayerTextDrawSetString(iv_gasolina[i], string_gasolina);
            
format(string_velocidadesizeof(string_velocidade), "%i"fVelocidade), PlayerTextDrawSetString(iv_velocidade[i], string_velocidade);
            
PlayerTextDrawSetString(iv_nome[i], GetVehicleName(v_index));
            
PlayerTextDrawTextSize(iv_progress_cinza_velo[i], (507.00 + ((97.0 fVelocidade) / 160)), 0.0);
            switch(
fuel[GetPlayerVehicleID(i)]) {
                case 
94 .. 100PlayerTextDrawTextSize(iv_progress_cinza_gas[i], (507.00 + ((97.0 100) / 100 -5.5)), 0.0);
                default: 
PlayerTextDrawTextSize(iv_progress_cinza_gas[i], (507.00 + ((97.0 fuel[GetPlayerVehicleID(i)]) / 100 )), 0.0);
            }
        }
        else {
            
PlayerTextDrawHide(iv_velocidade[i]);
            
PlayerTextDrawHide(iv_gasolina[i]);
            
PlayerTextDrawHide(iv_nome[i]);
            
PlayerTextDrawHide(iv_progress_branco_gas[i]);
            
PlayerTextDrawHide(iv_progress_branco_velo[i]);
            
PlayerTextDrawHide(iv_progress_azul_velo[i]);
            
PlayerTextDrawHide(iv_progress_ver_velo[i]);
            
PlayerTextDrawHide(iv_progress_cinza_velo[i]);
            
PlayerTextDrawHide(iv_progress_cinza_gas[i]);
        }
    }
    return 
1;
}
forward Float:GetVehicleSpeed(vehicleidUseMPH 0);
stock Float:GetVehicleSpeed(vehicleidUseMPH 0) {
    new 
Float:speed_xFloat:speed_yFloat:speed_zFloat:temp_speed;
    
GetVehicleVelocity(vehicleidspeed_xspeed_yspeed_z);
    if(
UseMPH == 0temp_speed floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667;
    else 
temp_speed floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*85.4166672;
    
floatround(temp_speed,floatround_round);
    return 
temp_speed;
}
stock GetVehicleName(vehicleid) {
    new 
String[128];
    
format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
    return 
String;
}
command(criarcarroplayeridparams []) {
    new 
indexFloat:pl_xFloat:pl_yFloat:pl_z;
    
GetPlayerPos(playeridpl_xpl_ypl_z);
    if(
sscanf(params"d"index)) return CreateVehicle(411pl_xpl_ypl_z0.06699999999);
    return 
CreateVehicle(indexpl_xpl_ypl_z0.06699999999);
}
command(setfuelplayeridparams []) {
    new 
index;
    if(
sscanf(params"d"index)) return false;
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"Erro! Vocк nгo estб em um veiculo!");
    
fuel[GetPlayerVehicleID(playerid)] = index;
    return 
true;
}
//FUNDAMENTAL!
forward GasolinaVeiculo();
public 
GasolinaVeiculo()
{
    for(new 
iMAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            
fuel[GetPlayerVehicleID(i)] --;
        }
    }

Muito Obrigado, deu tudo certo!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)