vehfonc
#1

hello, i have a problem
PHP код:
function vehfonc(){
    print(
"lancement du vehfonc");
    for(new 
vid 1vid MAX_VEHICLESvid++){
        new 
enginelightsalarmdoorsbonnetbootobjective,str[128];
        if(
GetVehicleModel(vid) == 481 || GetVehicleModel(vid) == 509 || GetVehicleModel(vid) == 510) return 1;
        if(
vinfo[vid][Essence] > 0){
            
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
            
printf("Vйrification du moteur id %d.",vid);
            if(
engine == 0) return printf("id %d, moteur йteint.",vid);
            if(
vinfo[vid][Job] > && vinfo[vid][Job] < 100) return printf("id %d, vehicule job.",vid);
            
vinfo[vid][Essence] -= 1;
            print(
"retrait de l'essence id %d");
            for(new 
0GetPlayerPoolSize(); <= ji++){
                if(
GetPlayerVehicleID(i) == vid){
                    
format(strsizeof(str), "Essence: %d"vinfo[vid][Essence]);
                    
PlayerTextDrawSetString(iTextEssenceVeh[i], str);
                }
            }
        }
        else{
            
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
            
SetVehicleParamsEx(vid0lightsalarmvinfo[vid][Doors], bonnetbootobjective);
        }
    }
    return 
1;

but server_log :
[16:00:53] lancement du vehfonc
[16:00:53] Vйrification du moteur id 1.
[16:00:53] id 1, moteur йteint.

it was the fact that id 1, I will like it has done on all vehicles, can you help me ?
Reply
#2

none will understand this code because its not in english man and i dont understood what you want.
Reply
#3

I want to do that every minute if the engine is running it loses 1 petrol (vinfo[vid][Essence] -= 1)
if petrol is 0 the engine shuts down
can you help me ?
Reply
#4

please ?
Reply
#5

run a timer with a interval of a minute and keep the repeating the timer.
loop through all the players, check for players in the vehicle as driver and check that the engine is on or off,
if the vehicle engine is on, reduce the fuel. Much more better way of doing it will be to check the speed, if the speed is greater than 0 and do some calculation stuff like get the velocity etc. and then decrease the fuel according to it.
Reply
#6

Hello.

PHP код:
if(vinfo[vid][Job] > && vinfo[vid][Job] < 100) return printf("id %d, vehicule job.",vid); 
For what is this line? Delete this. Does it work then?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)