Anti run + shoot
#1

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.
Reply
#2

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
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)