SA-MP Forums Archive
Help vehicle health - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help vehicle health (/showthread.php?tid=632615)



Help vehicle health - Alucynious - 16.04.2017

Help me :confuso::confuso::confuso::confuso::confuso:

What to do to not flood the message when the vehicle reaches 280 health



PHP код:
if(IsPlayerInAnyVehicle(playerid))
    {
    new 
Float:Vehicleid GetPlayerVehicleID(playerid);
        
GetVehicleHealth(idVehicle);
        if(
Vehicle <= 280.0 
        {
            
            
SetVehicleHealth(id280.0);
              new 
enginelightsalarmdoorsbonnetbootobjective;
              new 
vid GetPlayerVehicleID(playerid);
            
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(
engineSetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective); // engine off
            
            
            
SendClientMessage(playerid, -1," Text flood ? :(");
            
        }
        
    
    } 



Re: Help vehicle health - Vince - 16.04.2017

If you set the health to 280 it is still "smaller than or equal to" 280 the next time it is checked. So it runs forever.


Re: Help vehicle health - Alucynious - 16.04.2017

yes help me ?


Re: Help vehicle health - DarkSkull - 16.04.2017

PHP код:
if(IsPlayerInAnyVehicle(playerid))
    {
    new 
Float:Vehicleid GetPlayerVehicleID(playerid);
        
GetVehicleHealth(idVehicle);
        if(
Vehicle 280.0 
        {
            
            
SetVehicleHealth(id280.0);
              new 
enginelightsalarmdoorsbonnetbootobjective;
              new 
vid GetPlayerVehicleID(playerid);
            
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(
engineSetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective); // engine off
            
            
            
SendClientMessage(playerid, -1," Text flood ? :(");
            
        }
        
    

    } 



Re: Help vehicle health - Vince - 16.04.2017

Quote:
Originally Posted by Alucynious
Посмотреть сообщение
yes help me ?
I can't fix your logic reasoning. If I had given you the solution you would've copy-pasted it (like you did now, probably) and you wouldn't have learned a thing. Give a man a fish and you feed him for a day, teach a man to fish and you feed him for a lifetime.


Re: Help vehicle health - Alucynious - 16.04.2017

If it is not help, do not comment!


Re: Help vehicle health - DarkSkull - 16.04.2017

Quote:
Originally Posted by Alucynious
Посмотреть сообщение
If it is not help, do not comment!
That is not true. I've looked at the code before Vince and couldn't figure out what was wrong. When he posted his comment, I noticed what mistake you made and you still didn't understand. And when you further needed help, That's why I gave you the code. If you knew something about scripting, You could've fixed it yourself.

Quote:
Originally Posted by Vince
Give a man a fish and you feed him for a day, teach a man to fish and you feed him for a lifetime.
REP+.


Re: Help vehicle health - Alucynious - 17.04.2017

ja consegui arumar e nao precisei de ajuda de ngm flw vlw todo mundo que esta aki precisa de algo ou sempre tem duvidas


Re: Help vehicle health - DarkSkull - 17.04.2017

English please.