SA-MP Forums Archive
headshot system problem - 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 system problem (/showthread.php?tid=617677)



headshot system problem - Bondz - 25.09.2016

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID)
    {
        if(
weaponid == 34 && bodypart == 9)
        {
            if(
GOD[playerid] == || GetPVarInt(playerid"aGod") == 0)
            {
                
GameTextForPlayer(issuerid,"~r~Headshot",2000,3) && GameTextForPlayer(playerid,"~r~Headshot",2000,3);
                
PlayerPlaySound(playerid178020.00.00.0)  && PlayerPlaySound(issuerid178020.00.00.0);
                
SetPlayerHealth(playerid0.0);
            }
        }
    }
    return 
1;

the problem I persist is that,if the playerid is on god mode,issuerid still can kill them


Re: headshot system problem - UnGodly - 25.09.2016

Have you tried changing your operator? Try using (if i'm wrong correct me please - just trying to help)

PHP код:
if(GOD[playerid] != || GetPVarInt(playerid"aGod") != 1



Re: headshot system problem - DrVenomous - 25.09.2016

PHP код:
 if(GOD[playerid] == || GetPVarInt(playerid"aGod") == 0
The problem is in this

Add this

PHP код:
 if(GOD[playerid] == || GetPVarInt(playerid"aGod") == 1
And then compile it, it will work. If I solved your problem, then please rep+


Re: headshot system problem - jlalt - 25.09.2016

You had to use && instead || so it should be like this:
PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart

    if(
issuerid != INVALID_PLAYER_ID
    { 
        if(
weaponid == 34 && bodypart == 9
        { 
            if(
GOD[playerid] == && GetPVarInt(playerid"aGod") == 0
            { 
                
GameTextForPlayer(issuerid,"~r~Headshot",2000,3) && GameTextForPlayer(playerid,"~r~Headshot",2000,3); 
                
PlayerPlaySound(playerid178020.00.00.0)  && PlayerPlaySound(issuerid178020.00.00.0); 
                
SetPlayerHealth(playerid0.0); 
            } 
        } 
    } 
    return 
1




Re: headshot system problem - UnGodly - 25.09.2016

Quote:
Originally Posted by jlalt
Посмотреть сообщение
You had to use && instead || so it should be like this:
PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart

    if(
issuerid != INVALID_PLAYER_ID
    { 
        if(
weaponid == 34 && bodypart == 9
        { 
            if(
GOD[playerid] == && GetPVarInt(playerid"aGod") == 0
            { 
                
GameTextForPlayer(issuerid,"~r~Headshot",2000,3) && GameTextForPlayer(playerid,"~r~Headshot",2000,3); 
                
PlayerPlaySound(playerid178020.00.00.0)  && PlayerPlaySound(issuerid178020.00.00.0); 
                
SetPlayerHealth(playerid0.0); 
            } 
        } 
    } 
    return 
1

Question

Shouldn't it be working with || or && (any of these <-)? Considering || (or) and && (and)


Re: headshot system problem - jlalt - 25.09.2016

Quote:
Originally Posted by UnGodly
Посмотреть сообщение
Question

Shouldn't it be working with || or && (any of these <-)? Considering || (or) and && (and)
he got two god checkers so that mean he got two god commands for ex: /god and /sgod [ simple god ]
if you want to check if player isn't in god mode you gotta check both before saying he is not god so yeah you have to use &&, || mean or so you have to be on both of god mods to avoid head shots...