well, I have downloaded a fuel system and later I upgraded it and it works enough good BUT ITS WORKS FOR EVERY VEHICLES and that is my problem, if think real bikes ( bmx etc ) doesn't have fuel
pawn Код:
forward BenzinUpdate();
public BenzinUpdate()
{
new string[256];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new vehicle = GetPlayerVehicleID(i);
if(GetPlayerVehicleID(i) != 481 && GetPlayerVehicleID(i) != 509 && GetPlayerVehicleID(i) != 510)
{
if(IsPlayerInAnyVehicle(i) == 1)
{
if(Gas[vehicle] == 0)
{
format(string, sizeof(string), "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~FUEL: ~l~--");
GameTextForPlayer(i,string,10000,3);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicle,0,lights,alarm,doors,bonnet,boot,objective);
}
else if(Gas[vehicle] > 0 && Gas[vehicle] <= 10)
{
format(string, sizeof(string), "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~FUEL: ~r~%d%",Gas[vehicle]);
GameTextForPlayer(i,string,5000,3);
}
else if(Gas[vehicle] >= 11 && Gas[vehicle] <= 50)
{
format(string, sizeof(string), "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~FUEL: ~y~%d%",Gas[vehicle]);
GameTextForPlayer(i,string,5000,3);
}
else if(Gas[vehicle] >= 51 && Gas[vehicle] <= 100)
{
format(string, sizeof(string), "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~FUEL: ~g~%d%",Gas[vehicle]);
GameTextForPlayer(i,string,5000,3);
}
return 1;
}
return 1;
}
return 1;
}
return 1;
}
return 1;
}
forward CheckGas();
public CheckGas()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(i);
if(GetPlayerVehicleID(i) != 481 && GetPlayerVehicleID(i) != 509 && GetPlayerVehicleID(i) != 510)
{
if(Gas[vehicle] >= 1)
{
Gas[vehicle]--;
return 1;
}
return 1;
}
return 1;
}
return 1;
}
return 1;
}
return 1;
}
Easy.
I see you have used GetPlayerVehicleID(i).