Vehicle crash like IV
#5

I try it but something wrong...
pawn Код:
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;
}
Player not go to front of vehicle.
Reply


Messages In This Thread
Vehicle crash like IV - by whitedragon - 10.11.2011, 21:32
Re: Vehicle crash like IV - by RyDeR` - 10.11.2011, 21:46
Re: Vehicle crash like IV - by whitedragon - 10.11.2011, 21:48
Re: Vehicle crash like IV - by RyDeR` - 10.11.2011, 21:53
Re: Vehicle crash like IV - by whitedragon - 12.11.2011, 14:51

Forum Jump:


Users browsing this thread: 2 Guest(s)