SA-MP Forums Archive
Car help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Car help (/showthread.php?tid=86329)



Car help - lepompier - 13.07.2009

Hello, I need help I want that when a player is in a car and that car and seriously damaged its ejects

thank you in advance


Re: Car help - Correlli - 13.07.2009

https://sampwiki.blast.hk/wiki/Main_Page
http://forum.sa-mp.com/index.php?action=search


Re: Car help - lepompier - 13.07.2009

pleaze help me,



Re: Car help - Weirdosport - 13.07.2009

Quote:
Originally Posted by lepompier
pleaze help me,
He just gave you all the answers you could ever need, I've seen a very similar question before, and by searching timers and eject etc you'll find all you need to build the script.


Re: Car help - lepompier - 13.07.2009

I did but its not

new Float:health;
GetVehicleHealth(GetPlayerVehicleID(playerid), health);

if(floatround(value/1000) >= 132 && health == 500)
{
RemovePlayerFromVehicle(playerid);
}

timer blablabla...


Re: Car help - Weirdosport - 13.07.2009

What's this all about?:

if(floatround(value/1000) >= 132 && health == 500)


Re: Car help - lepompier - 13.07.2009

if(floatround(value/1000) >= 132
is the speed,

&& health == 500 and the health of the car

and not eject player


Re: Car help - c0der. - 13.07.2009

I would use < or =< not ==.


Re: Car help - lepompier - 13.07.2009

as it's

if(floatround(value/1000) >= 132 && health <= 400)
{
RemovePlayerFromVehicle(playerid);
}


Re: Car help - abhinavdabral - 13.07.2009

Add this on the top of script.
pawn Код:
forward EjectIfDamaged();
Add this in GameModeInit
pawn Код:
SetTimer("EjectIfDamaged",100,1);
Add at the botton of the script
pawn Код:
public EjectIfDamaged(){
    new i;
    for(i=0;i<=MAX_PLAYERS;i++){
      if(IsPlayerInAnyVehicle(i)){
        new Float:health;
            GetVehicleHealth(GetPlayerVehicleID(i),health);
            if(health<=200){
                RemovePlayerFromVehicle(i);
            }
      }
    }
    return 1;
}