26.12.2012, 11:23
create something like this
on top the script
and put this to ongamemodeinit
Код:
stock CheckGas() { new string[128]; for(new i=0;i<MAX_PLAYERS;i++) { if(GetPlayerState(i) == PLAYER_STATE_DRIVER) { new vehicle = GetPlayerVehicleID(i); if(Gas[vehicle] >= 1) { if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); if(gGas[i] == 0) { GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Nema goriva",5000,3); } } if(gGas[i] == 1) { if (IsPlayerInAnyVehicle(playerid)) { format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ N/A"); } else { format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %d%",Gas[vehicle]); } GameTextForPlayer(i,string,20500,3); } if (IsPlayerInAnyVehicle(playerid)) { Gas[vehicle]++; } Gas[vehicle]--; } else { TogglePlayerControllable(i, 0); GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~ you dont have fuel ",1500,3); } } } } return 1;
Код:
new gGas[MAX_PLAYERS]; new Gas[CAR_AMOUNT];//change to your define of max_cars
Код:
SetTimer("CheckGas", 25000, 1);