A headshot command
#1

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

Код:
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.
Also, how could I integrate this into the NGRP gamemode?
Reply
#4

add
PHP код:
forward OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ); 
top of your script.
Reply
#5

also This callback was added in SA-MP 0.3z and will not work in earlier versions!
Are you sure that you are using the latest version of samp?
Reply
#6

Put It On You TOP Script
Код:
forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
Reply
#7

Alright, I got the script running and all, but it doesn't kill with one shot.
Reply
#8

Show the line number 48 of your filterscript " headshot.pwn ", please.

Quote:
Originally Posted by Avetsky
Посмотреть сообщение
Also, how could I integrate this into the NGRP gamemode?
Open your server.cfg

Add the following in the line filterscripts:

Код:
filterscripts headshot
-Regards Noob Programmer Akbaig
Reply
#9

Nobody is dying whenever I perform a headshot.
Reply
#10

Quote:
Originally Posted by xTURBOx
Посмотреть сообщение
also This callback was added in SA-MP 0.3z and will not work in earlier versions!
Are you sure that you are using the latest version of samp?
^^^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)