03.07.2017, 19:10
(
Последний раз редактировалось AdrianoStk; 03.07.2017 в 19:13.
Причина: Comentario
)
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!
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", 100, true);
SetTimer("GasolinaVeiculo", 10000, true); //10 Segundos
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[i]), 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[i]) {
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[i]) / 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[playerid) = index;
return true;
}
//FUNDAMENTAL!
forward GasolinaVeiculo();
public GasolinaVeiculo()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
fuel[playerid] --;
}
}
}