[Help] vehicle damage taken
#1

NEVERMIND FIXED IT












what i'm trying to do here is to make if the player is going 150km/h with his car so if he hits something that the car explodes

PHP код:
public OnVehicleDamageStatusUpdate(vehicleidplayerid)
{
    if(
GetPlayerSpeed(playerid) >= 150)
    {
          new 
Float:vhealth;
          if(
GetVehicleHealth(GetPlayerVehicleID(playerid), vhealth) <= 500)
          {
              new 
Float:pos[3];
              
CreateExplosionForPlayer(playeridpos[0],pos[1],pos[2], 015.0);
          }
    }

i don't really know why i choose this callback but i thought it would work my getplayerspeed script
PHP код:
stock GetPlayerSpeed(playerid)
{
    new 
Float:ST[4];
    if(
IsPlayerInAnyVehicle(playerid))
    
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else 
GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
    return 
floatround(ST[3]);

Reply
#2

https://sampforum.blast.hk/showthread.php?tid=485682
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)