#1

Greedings,i have problem with one thing.I want to do fuel,but on different vehiclemodel should be different fuel,for example infernus should have 150L,but when i go into vehicle textdraw shows this 0.00L...I dont know why.
There is code:
PHP код:
stock FULL(vehicleid)
{
    new 
model GetVehicleModel(vehicleid);
    if(
model 399 && model 613)
    {
           switch(
model)
           {
                 case 
401,404,405,410,412,419,420,421,426,436,438,445,458,466,467,492,507,516,526,527,529,536,540,542,546,596,597,598,604,605: return 2;
                 case 
402,411,415,429,439,451,474,475,477,480,491,496,504,506,517,518,533,534,541,555,558,559,562,587,589,602,603: return 3;
           }
    }
    return 
false;

PHP код:
//OngamemodeInit
for(new v=0v<MAX_VEHICLESv++)
    {
        if(
FULL(v) == 2)
        {
               
Benzin[v] = 100.00;
        }
        if(
FULL(v) == 3)
        {
               
Benzin[v] = 150.00;
        }
    } 
Reply
#2

Wouldn't it make more sense to return the amount of fuel directly, eliminating the intermediary step?

Also you mention textdraw but there isn't any textdraw code to be seen.
Reply
#3

Show the code for displaying the textdraw.

EDIT: Vince beat me to it, I didn't reload the page.
Reply
#4

PHP код:
//timer
SetTimer("SecondTimer",1000,1);
//public
public SecondTimer()
{
    for(new 
i=0i<MAX_PLAYERS++)
    {
          if(
IsPlayerInAnyVehicle(i) && IsPlayerConnected(i) && GetPlayerVehicleID(i) != 481 && GetPlayerVehicleID(i) != 509 && GetPlayerVehicleID(i) != 510)
          {
                  new 
str[128],str1[128],str2[128],str3[128];
                  new 
Float:HP;
                  
GetVehicleHealth(GetPlayerVehicleID(i),Float:HP);
                   if (
HP/10 <= 30)
                    {
                        
PlayerTextDrawColor(i,Vozidla[i][4],COLOR_RED);
                        
PlayerTextDrawHide(i,Vozidla[i][4]);
                        
PlayerTextDrawShow(i,Vozidla[i][4]);
                    }
                    else if (
HP/10 <= 70)
                    {
                        
PlayerTextDrawColor(iVozidla[i][4], -65281);
                        
PlayerTextDrawHide(i,Vozidla[i][4]);
                        
PlayerTextDrawShow(i,Vozidla[i][4]);
                    }
                    else
                    {
                        
PlayerTextDrawColor(iVozidla[i][4], 16711935);
                        
PlayerTextDrawHide(i,Vozidla[i][4]);
                        
PlayerTextDrawShow(i,Vozidla[i][4]);
                     }
                  
format(str,sizeof(str),"%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]);
                  
format(str1,sizeof(str1),"%.1f %%",HP/10);
                  
format(str2,sizeof(str2),"%d KM/H",GetVehicleSpeed(GetPlayerVehicleID(i)));
                  
format(str3,sizeof(str3),"%.2fL",Benzin[GetPlayerVehicleID(i)]);
                  
PlayerTextDrawSetString(i,Vozidla[i][2],str);
                  
PlayerTextDrawSetString(i,Vozidla[i][4],str1);
                  
PlayerTextDrawSetString(i,Vozidla[i][8],str2);
                  
PlayerTextDrawSetString(i,Vozidla[i][6],str3);
          }
    }
    return 
1;
}
//showing textdraws
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
          
PlayerTextDrawShow(playerid,Vozidla[playerid][0]);
          
PlayerTextDrawShow(playerid,Vozidla[playerid][1]);
          
PlayerTextDrawShow(playerid,Vozidla[playerid][2]);
          
PlayerTextDrawShow(playerid,Vozidla[playerid][3]);
          
PlayerTextDrawShow(playerid,Vozidla[playerid][4]);
          
PlayerTextDrawShow(playerid,Vozidla[playerid][5]);
          
PlayerTextDrawShow(playerid,Vozidla[playerid][6]);
          
PlayerTextDrawShow(playerid,Vozidla[playerid][7]);
          
PlayerTextDrawShow(playerid,Vozidla[playerid][8]);
    }
    else if(
oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
    {
          
PlayerTextDrawHide(playerid,Vozidla[playerid][0]);
          
PlayerTextDrawHide(playerid,Vozidla[playerid][1]);
          
PlayerTextDrawHide(playerid,Vozidla[playerid][2]);
          
PlayerTextDrawHide(playerid,Vozidla[playerid][3]);
          
PlayerTextDrawHide(playerid,Vozidla[playerid][4]);
          
PlayerTextDrawHide(playerid,Vozidla[playerid][5]);
          
PlayerTextDrawHide(playerid,Vozidla[playerid][6]);
          
PlayerTextDrawHide(playerid,Vozidla[playerid][7]);
          
PlayerTextDrawHide(playerid,Vozidla[playerid][8]);
    }
    return 
1;

Reply
#5

Vehicleid != modelid. Take care to use the right one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)