SA-MP Forums Archive
Help - Speedgun - 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 - Speedgun (/showthread.php?tid=422417)



Help - Speedgun - barbarbar1 - 13.03.2013

pawn Код:
forward OnPlayerShootVehicle(playerid, vehicleid, unoccupied, weaponid, Float:heathlost);
public OnPlayerShootVehicle(playerid, vehicleid, unoccupied, weaponid, Float:heathlost)
{
    if(GetPlayerWeapon(playerid) == 23 && speedgun[playerid] == 1)
    {
        new str[128];
        new Float:Velocity[3]
        format(str,128,"The speed is %d km/h.",GetVehicleSpeed(vehicleid));
        SendClientMessage(playerid, COLOR_WHITE, str);
    }
    print("This public has debugged as worked.");
        return 0;
}
GetVehicleSpeed(car)
{
     new
          Float:X,
          Float:Y,
          Float:Z;
     GetVehicleVelocity(car, X, Y, Z);
     new Float:Total = floatsqroot(X*X, Y*Y, Z*Z);
     return Total*100;
}
I'm trying to shoot on a moving vehicle, and it says that he moves on 0kmh...


Re: Help - Speedgun - Denying - 13.03.2013

This MIGHT help you, just read it and understand the concept. https://sampforum.blast.hk/showthread.php?tid=284003


Re: Help - Speedgun - barbarbar1 - 13.03.2013

It doesn't help me much.