Fuel help
#2

create something like this
Код:
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;
on top the script
Код:
new gGas[MAX_PLAYERS];
new Gas[CAR_AMOUNT];//change to your define of max_cars
and put this to ongamemodeinit
Код:
SetTimer("CheckGas", 25000, 1);
Reply


Messages In This Thread
Fuel help - by Private200 - 26.12.2012, 10:40
Re: Fuel help - by Blaeks - 26.12.2012, 11:23

Forum Jump:


Users browsing this thread: 1 Guest(s)