16.08.2010, 20:09
Aee pessoal tipo... eu fiz um sistema de gas + n pego... ajudem ae:
ajudem ae... O ERRO Й: O GAS NГO ABAIXA.
pawn Код:
new GasVeh[MAX_VEHICLES];
forward Gas();
forward GasAtualizar();
//OnGameModeInit
for(new v; v <MAX_VEHICLES; v++)
{
GasVeh[v] = 100;
}
SetTimer("Gas",10000, 1);
SetTimer("GasAtualizar",10000, 1);
//Publics
public GasAtualizar()
{
for(new i; i <MAX_PLAYERS; i++)
{
/* for(new v; v <MAX_VEHICLES; v++)
{*/
new vehicleid = GetPlayerVehicleID(i);
if(IsPlayerInVehicle(i,vehicleid))
{
if(GasVeh[vehicleid] >= 11)
{
new string[256];
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~y~Gasolina: %d", GasVeh[vehicleid]);
GameTextForPlayer(i, string, 9500, 5);
}
if(GasVeh[vehicleid] <= 10 && GasVeh[vehicleid] > 0)
{
new string[256];
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~p~Gasolina esta acabando: %d", GasVeh[vehicleid]);
GameTextForPlayer(i, string, 9500, 5);
}
if(GasVeh[vehicleid] == 0)
{
new string[256];
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Gasolina acabou.", GasVeh[vehicleid]);
GameTextForPlayer(i, string, 9500, 5);
}
}
}
// }
return 1;
}
public Gas()
{
for(new i; i <MAX_PLAYERS; i++)
{
/* for(new v; v <MAX_VEHICLES; v++)
{*/
new vehicleid = GetPlayerVehicleID(i);
if(IsPlayerInVehicle(i,vehicleid))
{
if(GasVeh[vehicleid] > 0)
{
GasVeh[vehicleid] --;
}
if(GasVeh[vehicleid] == 0)
{
// RemovePlayerFromVehicle(i);
SendClientMessage(i, COLOR_GRAD2, "A Gasolina do veiculo acabou");
TogglePlayerControllable(i, false);
}
}
}
// }
return 1;
}