A headshot command
#2

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(playeridreason)
{
    
allowheadshot[playerid] = 0;
    return 
1;
}

public 
OnPlayerTakeDamage(playerid,issueridFloat:amountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID /*&& weaponid == 34*/ && bodypart == && allowheadshot[issuerid] == 1)//uncomment weaponid == 34 if you want the player to make headshots with ONLY SNIPER
    
{
        
SetPlayerHealth(playerid0.0);
    }
    return 
1;
}
public 
OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat: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;

Reply


Messages In This Thread
A headshot command - by Avetsky - 27.12.2015, 11:53
Re: A headshot command - by xTURBOx - 27.12.2015, 16:07
Re: A headshot command - by Avetsky - 27.12.2015, 17:15
Re: A headshot command - by GeneralAref - 27.12.2015, 17:31
Re: A headshot command - by xTURBOx - 28.12.2015, 06:40
Re: A headshot command - by CrunchxNoy - 28.12.2015, 07:22
Re: A headshot command - by Avetsky - 28.12.2015, 15:52
Re: A headshot command - by Akbaig - 28.12.2015, 16:26
Re: A headshot command - by Avetsky - 28.12.2015, 22:01
Re: A headshot command - by Boar - 28.12.2015, 22:24

Forum Jump:


Users browsing this thread: 1 Guest(s)