10.11.2011, 21:32
Hello i just wondering how to make player fly out of front window like it is in GTA IV. I have seen it some servers but i have no clue how to make it.
new Float:CarHealth[MAX_PLAYERS];
Funktsioon Damage()
{
foreach(Player,playerid) // foreach include in use :)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:TempCarHealth;
new Veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(Veh, TempCarHealth);
new Float:Difference = floatsub(CarHealth[playerid], TempCarHealth);
if((floatcmp(CarHealth[playerid], TempCarHealth) == 1) && (floatcmp(Difference,1.0) == 1))
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
new Float:Velocity[3];
GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);
SetPlayerPos(playerid,x+Velocity[0],y+Velocity[1],z+Velocity[2]);
Difference = floatdiv(Difference, 10.0);
new Float:OldHealth;
GetPlayerHealth(playerid, OldHealth);
SendClientMessage(playerid,-1,"You just crash");
SetPlayerHealth(playerid, floatsub(OldHealth, Difference));
}
CarHealth[playerid] = TempCarHealth;
}
else
{
CarHealth[playerid] = 0.0; //To aviod that a player dies when he enters a vehicle
}
}
return 1;
}