03.09.2009, 21:03
I have these scripts:
Engine:
But Gas and Fuel Update keep showing for bikes, what's wrong?
Engine:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { new VID = GetPlayerVehicleID(playerid); new MOD = GetVehicleModel(playerid); new string[128]; if(newstate == PLAYER_STATE_DRIVER) { format(string, sizeof(string), "~g~%s",VehicleTittle[GetVehicleModel(VID)-400]); GameTextForPlayer(playerid,string,3500,1); if(VehicleStarted[VID] == 0 && MOD != 510 && MOD != 509 && MOD != 481) { TogglePlayerControllable(playerid,0); SendClientMessage(playerid,WHITE,"* This Vehicle is not Started yet. You can start it with key: 'TAB'"); } else { SendClientMessage(playerid,YELLOW,"* This Vehicle is already started!"); } if(VehicleGas[VID] < 1) { SendClientMessage(playerid,WHITE,"* No fuel in Vehicle!"); } } return 1; }
Код:
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)) { if(Filling[i] == 0 && VehicleStarted[VID] == 1 && MOD != 510 && MOD != 509 && MOD != 481) { if(VehicleGas[VID] >= 1) { VehicleGas[VID] -= 1; format(string, sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~~l~~p~FUEL: ~w~%d%",VehicleGas[VID]); GameTextForPlayer(i,string,11500,3); } else { TogglePlayerControllable(i,0); GameTextForPlayer(i,"~n~~n~~n~~n~~b~Your car is without fuel!",2500,3); SendClientMessage(i,WHITE,"* Your Vehicle is without Gas! Use '/exit' to get out."); } } } } } return 1; }