[Tutorial] HeadShot System [Explained]
#14

"Stock by Gammix"

It's not a stock, it's a function.

-----

"if (HeadShotSystem == true)"

You could just do "if(HeadShotSystem)" instead.

P.S. "if(!HeadShotSystem)" for false.

-----

"else if(HeadShotSystem == false)"

"else" is more than enough. If the first if-then is true then obviously the else below it will be false.

-----

"else SendClientMessage(issuerid, -1, "That player is in your team!");"

A big fail for that as you placed it for this if-then: "if(HeadShotSystem == true)"

-----

I suggest removing the previously mentioned message and placing the 4 if-thens (you can find them below) in just one statement.

"if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)"
"if(HeadShotSystem == true)"
"if(GetPlayerTeam(issuerid) == NO_TEAM || GetPlayerTeam(playerid) == NO_TEAM || GetPlayerTeam(issuerid) != GetPlayerTeam(playerid))"
"if(!IsPlayerDead(playerid))"

-----

pawn Code:
stock IsPlayerDead(playerid)  
{  
    new Float: health = 0.0;  
    GetPlayerHealth(playerid, health);  
    if(GetPlayerState(playerid) == PLAYER_STATE_WASTED && health <= 0.0)  
        return true;  
    return false;  
}
Too overdone, just use a variable (boolean) and set it to true when the player spawns, and to false when the player dies or leaves the server. Simple as that.
Reply


Messages In This Thread
HeadShot System [Explained] - by iLearner - 11.01.2017, 17:35
Re: HeadShot System [Explained] - by Gammix - 11.01.2017, 17:43
Re: HeadShot System [Explained] - by Logic_ - 11.01.2017, 17:44
Re: HeadShot System [Explained] - by iLearner - 11.01.2017, 17:45
Re: HeadShot System [Explained] - by RedRex - 11.01.2017, 17:54
Re: HeadShot System [Explained] - by saffierr - 11.01.2017, 18:02
Re: HeadShot System [Explained] - by Logic_ - 11.01.2017, 18:05
Re: HeadShot System [Explained] - by iLearner - 11.01.2017, 18:06
Re: HeadShot System [Explained] - by saffierr - 11.01.2017, 18:08
Re: HeadShot System [Explained] - by RyderX - 11.01.2017, 18:32
Re: HeadShot System [Explained] - by PhoneixViper - 11.01.2017, 18:55
Re: HeadShot System [Explained] - by Gammix - 11.01.2017, 19:06
Re: HeadShot System [Explained] - by iLearner - 11.01.2017, 19:07
Re: HeadShot System [Explained] - by SickAttack - 11.01.2017, 19:27
Re: HeadShot System [Explained] - by iLearner - 11.01.2017, 19:35
Re: HeadShot System [Explained] - by SickAttack - 11.01.2017, 19:48
Re: HeadShot System [Explained] - by saffierr - 12.01.2017, 00:14
Re: HeadShot System [Explained] - by SickAttack - 12.01.2017, 00:28
Re: HeadShot System [Explained] - by saffierr - 12.01.2017, 00:58
Re: HeadShot System [Explained] - by muzammilfreeman - 12.01.2017, 01:01
Re: HeadShot System [Explained] - by Lordzy - 12.01.2017, 11:04
Re: HeadShot System [Explained] - by SyS - 12.01.2017, 11:57
Re: HeadShot System [Explained] - by iLearner - 12.01.2017, 12:39
Re: HeadShot System [Explained] - by Gammix - 12.01.2017, 13:16
Re: HeadShot System [Explained] - by SickAttack - 12.01.2017, 14:11
Re: HeadShot System [Explained] - by Lordzy - 12.01.2017, 14:23
Re: HeadShot System [Explained] - by iLearner - 12.01.2017, 14:27
Re: HeadShot System [Explained] - by GoldenLion - 12.01.2017, 14:32
Re: HeadShot System [Explained] - by SickAttack - 12.01.2017, 14:33
Re: HeadShot System [Explained] - by iLearner - 12.01.2017, 14:42
Re: HeadShot System [Explained] - by GoldenLion - 12.01.2017, 14:45
Re: HeadShot System [Explained] - by saffierr - 12.01.2017, 14:52
Re: HeadShot System [Explained] - by iLearner - 12.01.2017, 15:07
Re: HeadShot System [Explained] - by GhostHacker9 - 20.01.2017, 08:28

Forum Jump:


Users browsing this thread: 1 Guest(s)