27.12.2015, 16:07
untested but complies fine
PHP код:
#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;
}