SA-MP Forums Archive
Headshot help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Headshot help (/showthread.php?tid=625508)



Headshot help - RyderX - 02.01.2017

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
    {
        new 
string[128],name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME];
        
format(stringsizeof(string), "[RBOT]:{FFFFFF} {FF0FF0}%s {FFFFFF}Has Headshotted {F00F00}%d {FFFFFF}And Wins {F12F12}$2000$!"namename2);
        
SendClientMessageToAll(0xF8F8F8FFFstring);
        
SetPlayerHealth(playerid0.0);
        new 
string1[128]; new name3[MAX_PLAYER_NAME];
        
GetPlayerName(issueridname3sizeof(name3));
        
format(string1sizeof(string1), "~P~ Got Pawned :[ By %s."name3);
        
GameTextForPlayer(playeridstring30006);
    }
    return 
1;

i know this code is wrong, im just asking how to make string for issuerid and for playerid, i know for playerid like this
name[MAX_PLAYER_NAME];
what about issuerid? Help hope that u have understand what i meant to ask


Re: Headshot help - BiosMarcel - 02.01.2017

its exactly the same ... both are just playerids


Re: Headshot help - RyderX - 02.01.2017

i know,
so u r saying this is correct?:

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
    {
        new 
string[128],name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME];
                
GetPlayerName(playeridnamesizeof(name));
                
GetPlayerName(issueridname2sizeof(name2));
        
format(stringsizeof(string), "[RBOT]:{FFFFFF} {FF0FF0}%s {FFFFFF}Has Headshotted {F00F00}%d {FFFFFF}And Wins {F12F12}$2000$!"namename2);
        
SendClientMessageToAll(0xF8F8F8FFFstring);
        
SetPlayerHealth(playerid0.0);
        return 
1;

new name[MAX_PLAYER_NAME]; and new name2[MAX_PLAYER_NAME]; would work?


Re: Headshot help - Konstantinos - 02.01.2017

It would if you used GetPlayerName

EDIT: Okay, you added those two lines.


Re: Headshot help - RyderX - 02.01.2017

if it's ok, so why i am getting this?
Код:
C:\Users\Admin\Desktop\HeadShot.pwn(5) : error 025: function heading differs from prototype



Re: Headshot help - iLearner - 02.01.2017

Error line
Edit:
Код:
format(string, sizeof(string), "[RBOT]:{FFFFFF} {FF0FF0}%s {FFFFFF}Has Headshotted {F00F00}%d{FFFFFF}And Wins {F12F12}$2000$!", name, name2);



Re: Headshot help - Konstantinos - 02.01.2017

"bodypart" parameter was added later so you have outdated includes. Update.


Re: Headshot help - RyderX - 02.01.2017

Code:
PHP код:
Line 5>>> public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
    {
        new 
string[128],name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME];
                
GetPlayerName(playeridnamesizeof(name));
                
GetPlayerName(issueridname2sizeof(name2));
        
format(stringsizeof(string), "[RBOT]:{FFFFFF} {FF0FF0}%s {FFFFFF}Has Headshotted {F00F00}%d {FFFFFF}And Wins {F12F12}$2000$!"namename2);
        
SendClientMessageToAll(0xF8F8F8FFFstring);
        
SetPlayerHealth(playerid0.0);
        return 
1;

Error:
Код:
C:\Users\Admin\Desktop\HeadShot.pwn(5) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Headshot help - GoldenLion - 02.01.2017

Quote:
Originally Posted by RyderX
Посмотреть сообщение
Code:
PHP код:
Line 5>>> public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
    {
        new 
string[128],name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME];
                
GetPlayerName(playeridnamesizeof(name));
                
GetPlayerName(issueridname2sizeof(name2));
        
format(stringsizeof(string), "[RBOT]:{FFFFFF} {FF0FF0}%s {FFFFFF}Has Headshotted {F00F00}%d {FFFFFF}And Wins {F12F12}$2000$!"namename2);
        
SendClientMessageToAll(0xF8F8F8FFFstring);
        
SetPlayerHealth(playerid0.0);
        return 
1;

Error:
Код:
C:\Users\Admin\Desktop\HeadShot.pwn(5) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Update your a_samp.inc.

EDIT: I didn't notice Konstantinos' post.


Re: Headshot help - RyderX - 02.01.2017

EDIT: Late