SA-MP Forums Archive
[Help] vehicle damage taken - 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 damage taken (/showthread.php?tid=596355)



[Help] vehicle damage taken - malackov - 16.12.2015

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]);




Re: [Help] vehicle damage taken - SickAttack - 16.12.2015

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