#define RETIRAR_KM 2 //- A Cada 2 KM ,retirar 1 de gasolina
new Gas[MAX_CARROS], Float:velokm[3], Retirada[MAX_CARROS];//Gasolina
SetTimer("AttGasosa", 2000, true);
for(new i = 0; i < MAX_CARROS; i++)
{
Gas[i] = 61;
}
forward AttGasosa();
public AttGasosa()
{
foreach(Player, i)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new carro = GetPlayerVehicleID(i);
new mot, lu, alar, por, cap, porma, ob;
if(floatround(((floatsqroot(((velokm[0] * velokm[0]) + (velokm[1] * velokm[1]) + (velokm[2] * velokm[2]))) * (170.0))) * 1) > 5)
{
if(Gas[carro] == 0)
{
SendClientMessage(i, COR_CINZA1, "[GASOLINA] Esse carro estб sem gasolina!");
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
TogglePlayerControllable(i, 0);
}
else if(Gas[carro] > 0) Retirada[carro]+=1;
if(Retirada[carro] >= (RETIRAR_KM*13))
{
Gas[carro]--;
Retirada[carro]=0;
return 1;
}
}
}
return 1;
}
return 1;
}
CMD:zerar(playerid, params[])
{
new carro = GetPlayerVehicleID(playerid);
Gas[carro] = 0;
return 1;
}
Vocк jб se certificou de que a gasolina estб sendo atualizada corretamente?
|