Anti run + shoot - 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: Anti run + shoot (
/showthread.php?tid=327669)
Anti run + shoot -
KeeDee - 22.03.2012
Hello, i've been asking alot of times if it's possible to do something with Colt, Uzi, Tec-9 a Anti Running + Shot so the pepoles can't Run + Shot while they running and using these guns. Is it possible? If Yes can i have a copy of a script Or something, Thanks in advance.
Re: Anti run + shoot -
CyNiC - 22.03.2012
Knowing if the player is running(velocity higher than 15~20, make test for confirm):
pawn Код:
stock GetPlayerSpeed(playerid) // by misco
{
new Float:Vel[3], Float:rtn;
if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vel[0], Vel[1], Vel[2]); else GetPlayerVelocity(playerid,Vel[0], Vel[1], Vel[2]);
rtn = floatsqroot(floatabs(floatpower(Vel[0] + Vel[1] + Vel[2], 2)));
return floatround(rtn * 100 * 1.61);
}
The function returns the player velocity in KM/H.
You can set a timer for check if the players are sprinting and pressing the keys combination, using this method is need to stay aware that key combinations can give diferent keys return, for example press KEY_SPRINT + SUB_MISSION gives diferent keys.
https://sampwiki.blast.hk/wiki/GetPlayerKeys
https://sampwiki.blast.hk/wiki/SetTimerEx
Re: Anti run + shoot -
[ABK]Antonio - 22.03.2012
Quote:
Originally Posted by CyNiC
Knowing if the player is running(velocity higher than 15~20, make test for confirm):
pawn Код:
stock GetPlayerSpeed(playerid) // by misco { new Float:Vel[3], Float:rtn; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vel[0], Vel[1], Vel[2]); else GetPlayerVelocity(playerid,Vel[0], Vel[1], Vel[2]); rtn = floatsqroot(floatabs(floatpower(Vel[0] + Vel[1] + Vel[2], 2))); return floatround(rtn * 100 * 1.61); }
The function returns the player velocity in KM/H.
You can set a timer for check if the players are sprinting and pressing the keys combination, using this method is need to stay aware that key combinations can give diferent keys return, for example press KEY_SPRINT + SUB_MISSION gives diferent keys.
https://sampwiki.blast.hk/wiki/GetPlayerKeys
https://sampwiki.blast.hk/wiki/SetTimerEx
|
https://sampwiki.blast.hk/wiki/GetPlayerAnimationIndex