public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) if(issuerid != INVALID_PLAYER_ID) // issuerid/ the one who uses the weapon isn't invalid. { if(GetPlayerTeam(playerid) != GetPlayerTeam(issuerid))// checking teams are not same { if(weaponid == 34 && bodypart == 9) // checking the weapon and body part { new str[90]; format(str, sizeof(str), "%s has headshotted %s", pName(issuerid), pName(playerid)); GameTextForPlayer(issuerid, "~r~Headshot!", 3000, 5); GameTextForPlayer(playerid, "~r~Headshotted!", 3000, 5); SendClientMessageToAll(0x5BC178FF, str); SetPlayerHealth(playerid, 0.0); // We will always use float integer because health is in float! } } } return 1; }
((GetPlayerTeam(playerid) != GetPlayerTeam(issuerid)) && GetPlayerTeam(playerid) != NO_TEAM)
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { if(gTeam[issuerid] == gTeam[playerid]) { GameTextForPlayer(issuerid,"~r~Don't attack your team mates!", 3000, 3); } if(issuerid != INVALID_PLAYER_ID) { new str[26]; format(str, sizeof(str),"-%.0f", amount); SetPlayerChatBubble(playerid, str, 0xFF0000FF, 100.0, 2000); PlayerPlaySound(issuerid,17802,0.0,0.0,0.0); } new Float:x, Float:y, Float:z; if(PlayerInfo[playerid][OnDuty] == 1 || PlayerInfo[playerid][God] == 1) { SetPlayerHealth(playerid, 100000000.0); new Float:Health; GetPlayerHealth(issuerid,Health); GameTextForPlayer(issuerid,"~w~dont~n~~p~Attack~n~~p~onduty~n~~w~admins", 3000, 3); GetPlayerPos(issuerid,x,y,z); SetPlayerPos(issuerid,x,y,z+5); } if(issuerid != INVALID_PLAYER_ID) { if(GetPlayerTeam(playerid) != GetPlayerTeam(issuerid) && GetPlayerTeam(playerid) != NO_TEAM) { if(weaponid == 34 && bodypart == 9) // checking the weapon and body part { new str[90]; format(str, sizeof(str), "%s has headshotted %s", pName(issuerid), pName(playerid)); GameTextForPlayer(issuerid, "~r~Headshot!", 3000, 5); GameTextForPlayer(playerid, "~r~Headshotted!", 3000, 5); SendClientMessageToAll(0x5BC178FF, str); SetPlayerHealth(playerid, 0.0); } } } return 1; }
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { if(gTeam[issuerid] == gTeam[playerid]) { GameTextForPlayer(issuerid,"~r~Don't attack your team mates!", 3000, 3); } if(issuerid != INVALID_PLAYER_ID) { new str[26]; format(str, sizeof(str),"-%.0f", amount); SetPlayerChatBubble(playerid, str, 0xFF0000FF, 100.0, 2000); PlayerPlaySound(issuerid,17802,0.0,0.0,0.0); } new Float:x, Float:y, Float:z; if(PlayerInfo[playerid][OnDuty] == 1 || PlayerInfo[playerid][God] == 1) { SetPlayerHealth(playerid, 100000000.0); new Float:Health; GetPlayerHealth(issuerid,Health); GameTextForPlayer(issuerid,"~w~dont~n~~p~Attack~n~~p~onduty~n~~w~admins", 3000, 3); GetPlayerPos(issuerid,x,y,z); SetPlayerPos(issuerid,x,y,z+5); } if(issuerid != INVALID_PLAYER_ID) { if(GetPlayerTeam(playerid) != GetPlayerTeam(issuerid) && GetPlayerTeam(playerid) != NO_TEAM) { if(weaponid == 34 && bodypart == 9 && PlayerInfo[playerid][OnDuty] != 1 && PlayerInfo[playerid][God] != 1) // checking the weapon and body part { new str[90]; format(str, sizeof(str), "%s has headshotted %s", pName(issuerid), pName(playerid)); GameTextForPlayer(issuerid, "~r~Headshot!", 3000, 5); GameTextForPlayer(playerid, "~r~Headshotted!", 3000, 5); SendClientMessageToAll(0x5BC178FF, str); SetPlayerHealth(playerid, 0.0); } } } return 1; }
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { if(gTeam[issuerid] == gTeam[playerid]) { GameTextForPlayer(issuerid,"~r~Don't attack your team mates!", 3000, 3); } if(issuerid != INVALID_PLAYER_ID) { new str[26]; format(str, sizeof(str),"-%.0f", amount); SetPlayerChatBubble(playerid, str, 0xFF0000FF, 100.0, 2000); PlayerPlaySound(issuerid,17802,0.0,0.0,0.0); } new Float:x, Float:y, Float:z; if(PlayerInfo[playerid][OnDuty] == 1 || PlayerInfo[playerid][God] == 1) { SetPlayerHealth(playerid, 100000000.0); new Float:Health; GetPlayerHealth(issuerid,Health); GameTextForPlayer(issuerid,"~w~dont~n~~p~Attack~n~~p~onduty~n~~w~admins", 3000, 3); GetPlayerPos(issuerid,x,y,z); SetPlayerPos(issuerid,x,y,z+5); } if(issuerid != INVALID_PLAYER_ID) { if(GetPlayerTeam(playerid) != GetPlayerTeam(issuerid) && GetPlayerTeam(playerid) != NO_TEAM) { if(weaponid == 34 && bodypart == 9 && PlayerInfo[playerid][OnDuty] != 1 && PlayerInfo[playerid][God] != 1) // checking the weapon and body part { new str[90]; format(str, sizeof(str), "%s has headshotted %s", pName(issuerid), pName(playerid)); GameTextForPlayer(issuerid, "~r~Headshot!", 3000, 5); GameTextForPlayer(playerid, "~r~Headshotted!", 3000, 5); SendClientMessageToAll(0x5BC178FF, str); SetPlayerHealth(playerid, 0.0); } } } return 1; } |