28.03.2014, 23:40
Quote:
All the players need to be on the same team so OnPlayerTakeDamage() doesn't do anything though.
|
Код:
public OnPlayerRequestClass(playerid, classid) { //.... switch(classid) { case 0,1,2,3: { //... SetPlayerTeam(playerid,0); gTeam[playerid] = BLUE_TEAM; } case 4,5,6,7: { //... SetPlayerTeam(playerid,0); gTeam[playerid] = RED_TEAM; } } return 1; }
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart) { if(playerid != INVALID_PLAYER_ID) // If not self-inflicted { if(gTeam[playerid] != gTeam[damagedid]) { GetPlayerHealth(damagedid,pHealth[damagedid]); SetPlayerHealth(damagedid,pHealth[damagedid]-amount); } } if(playerid == damagedid) // If self-inflicted { GetPlayerHealth(damagedid,pHealth[damagedid]); SetPlayerHealth(damagedid,pHealth[damagedid]-amount); } KilledBy[damagedid] = playerid; KillReason[damagedid] = weaponid; return 1; }