27.12.2015, 11:53
Basically, I'd like a command made with zcmd which enables headshot for a /single shot only/, if the shot doesn't hit the players head, then the feature will automatically get toggled off.
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
new allowheadshot[MAX_PLAYERS];
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnPlayerConnect(playerid)
{
allowheadshot[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
allowheadshot[playerid] = 0;
return 1;
}
public OnPlayerTakeDamage(playerid,issuerid, Float:amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID /*&& weaponid == 34*/ && bodypart == 9 && allowheadshot[issuerid] == 1)//uncomment weaponid == 34 if you want the player to make headshots with ONLY SNIPER
{
SetPlayerHealth(playerid, 0.0);
}
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(allowheadshot[playerid] == 1)
{
allowheadshot[playerid] = 0; //so when missed he can't headshot in the second try
SendClientMessage(playerid,-1,"You have lost your headshot ability");
}
return 1;
}
CMD:headshot(playerid,params[])
{
allowheadshot[playerid] = 1;
GameTextForPlayer(playerid,"Head shot enabled",1000,3);
SendClientMessage(playerid,-1,"You have gained ability to headshot");
return 1;
}
headshot.pwn(45) : error 025: function heading differs from prototype headshot.pwn(53) : warning 235: public function lacks forward declaration (symbol "OnPlayerWeaponShot") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);