28.07.2010, 13:45
Hey I need a little favour from somone that could make this code run even the player is not inside the vehicle.
That means, the fuel still goes down, even the player is not inside the vehicle, and the engine is turned off.
(Btw: You don't need to care about the flashing indicator message, I can fix that one self)
Thanks !
That means, the fuel still goes down, even the player is not inside the vehicle, and the engine is turned off.
(Btw: You don't need to care about the flashing indicator message, I can fix that one self)
Thanks !
pawn Код:
public FuelUpdate()
{
//new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
new VID = GetPlayerVehicleID(i);
new MOD = GetVehicleModel(i);
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
if(IsPlayerConnected(i))
{
new vehicle = GetPlayerVehicleID(i);
if(IsABike(vehicle)) return 1;
if(Filling[i] == 0 && VehicleStarted[VID] == 1 && MOD != 510 && MOD != 509 && MOD != 481)
{
if(VehicleGas[VID] <= 10)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(i, x, y, z);
PlayerPlaySound(i, 1085, x, y, z);
}
if(VehicleGas[VID] >= 1)
{
VehicleGas[VID] -= 1;
}
else
{
TogglePlayerControllable(i,0);
if(VehicleStarted[VID] == 1)
{
new string[128];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "* Vehicle engine stops, fuel indicator flashes (( %s's vehicle ))", sendername);
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehicleStarted[VID] = 0;
}
GameTextForPlayer(i,"~n~~n~~n~~n~~b~Your car is without fuel!",2500,3);
SendClientMessage(i,COLOR_CMD," - Your Vehicle is without fuel!!");
}
}
}
}
}
return 1;
}