11.01.2017, 19:27
"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))"
-----
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.
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;
}