public OnPlayerUpdate(playerid)
{
if(GetPlayerSkin(playerid) == 280 || 281 || 282)//police skin
{
SetPlayerTeam(playerid,1);// if player use police skin, they are team 1
}
if(GetPlayerSkin(playerid) == 28)//bmydrug skin
{
SetPlayerTeam(playerid,2);// if player use terorrist skin, they are team 2
}
return 1;
}
public OnGameModeInit()
{
EnableVehicleFriendlyFire();
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
if(issuerid != INVALID_PLAYER_ID)
{
new Float:health, Float:newhealth;
health = GetPlayerHealth(playerid, health);
newhealth = health += amount;
SetPlayerHealth(playerid, newhealth);
}
I don't see why you'd need either of those. Guest123 is partially correct with SetPlayerTeam, but OnPlayerUpdate is severe overkill. Setting the team once on spawn is enough.
|
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[playerid][gTeam] == PlayerInfo[playerid][gTeam])
{
new Float:health, Float:newhealth;
health = GetPlayerHealth(playerid, health);
newhealth = health += amount;
SetPlayerHealth(playerid, newhealth);
}
}
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid) { if(issuerid != INVALID_PLAYER_ID) { if(PlayerInfo[playerid][gTeam] == PlayerInfo[playerid][gTeam]) { new Float:health, Float:newhealth; health = GetPlayerHealth(playerid, health); newhealth = health += amount; SetPlayerHealth(playerid, newhealth); } } }
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
if(gTeam[playerid] == gTeam[issuerid])
{
new Float:health, Float:newhealth;
health = GetPlayerHealth(playerid, health);
newhealth = health += amount;
SetPlayerHealth(playerid, newhealth);
}
}
}