30.05.2018, 00:02
Seu cуdigo parece muito confuso.
Fiz aqui rapidamente pra vocк, adapte ao seu gamemode e veja as alteraзхes e otimizaзгo feita.
Se houver algum erro me comunique pois criei por aqui e mesmo e nem copilei.
Fiz aqui rapidamente pra vocк, adapte ao seu gamemode e veja as alteraзхes e otimizaзгo feita.
Se houver algum erro me comunique pois criei por aqui e mesmo e nem copilei.
PHP код:
SetTimerEx("CombustivelVeiculo", 15000, true, "i", playerid);
forward CombustivelVeiculo(playerid);
public CombustivelVeiculo(playerid)
{
if(!IsPlayerInAnyVehicle(playerid)) return 1; // retorna se nao tiver em veiculos
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1; //retorna se nao tiver como motorista
new modelo = GetVehicleModel(GetPlayerVehicleID(playerid));
if(modelo == 509 || modelo == 510) return 1; // retorna se tiver em bikes
format(formato, sizeof(formato),"~y~~h~Combustivel:~w~ %i", InfoPlayer[playerid][Combustivel]);
TextDrawSetString(CombustivelT[playerid],formato);
TextDrawShowForPlayer(playerid, CombustivelT[playerid]);
if(InfoPlayer[playerid][Combustivel] < 5)
{
SendClientMessage(playerid, 0xFF0808AA, "Seu combustнvel estб acabando, vб atй um posto de gasolina mais prуximo!");
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 10.0);
return 0;
}
if(InfoPlayer[playerid][Combustivel] == 0)
{
SendClientMessage(playerid, 0xFF0808AA, "Seu combustнvel acabou!");
RemovePlayerFromVehicle(playerid);
return 0;
}
InfoPlayer[playerid][Combustivel] --;
return 1;
}