0% found this document useful (0 votes)
12 views3 pages

Message

The OnPlayerDamage function handles damage events in a game, applying various conditions to determine if damage should be processed or blocked based on player states, weapon types, and specific game rules. It includes checks for player roles, proximity, and special weapons, as well as displaying messages and animations to players involved in the damage event. Additionally, it updates player health displays and manages timers for showing damage information.

Uploaded by

ptplayerr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Message

The OnPlayerDamage function handles damage events in a game, applying various conditions to determine if damage should be processed or blocked based on player states, weapon types, and specific game rules. It includes checks for player roles, proximity, and special weapons, as well as displaying messages and animations to players involved in the damage event. Additionally, it updates player health displays and manages timers for showing damage information.

Uploaded by

ptplayerr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)

if(issuerid != INVALID_PLAYER_ID) SetPVarInt(issuerid, "UltimoTiro",


bodypart);
// if(PlayerInAlhambra(issuerid))return 0;
if(IsPlayerInRC(issuerid)) return 0;
if(IsPlayerInRC(playerid)) return 0;
if(GetAdmin(playerid) > 0 && admtrampando[playerid]) return 0;
if(PlayerInfo[playerid][pHelper] > 0 && helpertrampando[playerid]) return 0;
if(GetAdmin(issuerid) > 0 && admtrampando[issuerid] && issuerid !=
INVALID_PLAYER_ID) return 0;
if(PlayerInfo[issuerid][pHelper] > 0 && helpertrampando[issuerid] && issuerid
!= INVALID_PLAYER_ID) return 0;
if(weapon == 34)//Sniper Rifle
{
if(!ProxDetectorS(20.0, playerid, issuerid)){

if(bodypart == 9){
if(GetPlayerState(issuerid) == PLAYER_STATE_ONFOOT &&
issuerid != INVALID_PLAYER_ID){
amount = 0.0;
return InitHeadShot(issuerid, playerid);
}
}

amount = 30.0;
}
else{
amount = 30.0;
}

TextDrawShowForPlayer(playerid, textXizinho);
}
if(bodypart == 9 && weapon != 34 && issuerid != INVALID_PLAYER_ID){
amount = 0.0;
GameTextForPlayer(playerid, "~g~Headshot", 5000, 3);
GameTextForPlayer(issuerid, "~g~Headshot", 5000, 3);
SCMf(playerid, COLOR_LIGHTBLUE, "[HS] * Voce levou um headshot de %s e
morreu!", NP(issuerid));
}
if(issuerid != INVALID_PLAYER_ID && weapon == 35)
{
amount = 0.0;
}
if(weapon == 38)
{
if(PlayerInfo[playerid][pAdmin] > 1) return 1;
new str[128];
format(str, 128, "Anti-Cheat: %s pegou arma: Minigun pelo s0beit e foi
kickado!", PlayerName(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, str);
KickBCP(playerid);
}
if(weapon == 34)
{
if(GetDistanceBetweenPlayers(playerid, issuerid) <= 20 && issuerid !=
INVALID_PLAYER_ID)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "Sniper de perto e
proibido, o tiro foi bloqueado.");
return 0;
}
}
if(weapon == 35 && weapon == 36)
{

if(issuerid != INVALID_PLAYER_ID) {
if(GetDistanceBetweenPlayers(playerid, issuerid) <= 20)
{

SendClientMessage(playerid,COLOR_LIGHTRED, "Bazuca de perto e


proibido, o tiro foi bloqueado.");
return 0;
}
}
}
if(GetPlayerOrg(playerid) == 0 && GetPlayerOrg(issuerid) == 0 &&
IsPlayerInRC(playerid))
{
ShowPlayerDialog(playerid, 8724, DIALOG_STYLE_MSGBOX,
"{FF8400}ATENCAO:\n\n",
"{FFFFFF}Voce nao pode matar/atirar em alguem dentro da area azul do
mapa\n\
{FFFFFF}caso voce tente novamente, sera {FF0000}PRESO{FFFFFF} por um
administrador", "Entendido","");
ApplyAnimationEx(playerid,"PED","handscower",4.1,0,1,1,0,0);
return 1;
}
if(PlayerInfo[playerid][pJailed] && PlayerInfo[issuerid][pJailed] && issuerid
!= INVALID_PLAYER_ID)
{
ShowPlayerDialog(playerid, 8724, DIALOG_STYLE_MSGBOX,
"{FFFFFF}» Proibido fazer {FF0000}Death-Match",
"{FFFFFF}» Voce nao pode bater em alguem enquanto estiver{FF0000} Na
cadeia\n\
{FFFFFF}Caso faca novamente, sera {FF0000}Ajustado por um admin!",
"OK","");
ApplyAnimationEx(playerid,"PED","handscower",4.1,0,1,1,0,0);

return 1;
}

if(issuerid != INVALID_PLAYER_ID) SetPVarInt(issuerid, "VarDano", gettime()


+20);

//------------- Retirar Vida/Colete ------------------

if(issuerid != INVALID_PLAYER_ID) PlayerPlaySound(issuerid, 17802, 0.0, 0.0,


0.0);

//------------------------------------------------------------------------------

//playerid
static string[256];
KillTimer(TempoMostrarLife[playerid]);

format(string,sizeof(string),"DANO EM %s ~n~%s", NomePlayer(issuerid),


NomeArma(weapon));
PlayerTextDrawSetString(playerid, textinfodamage[playerid][0], string);

format(string,sizeof(string),"+%0.0f", amount);
PlayerTextDrawSetString(playerid, textinfodamage[playerid][1], string);

PlayerTextDrawShow(playerid, textinfodamage[playerid][0]);
PlayerTextDrawShow(playerid, textinfodamage[playerid][1]);

TempoMostrarLife[playerid] = SetTimerEx("HideTextoLife", 800, 0, "i",


playerid);
MostrandoVida[playerid] = 1;

//------------------------------------------------------------------------------

//issuerid

if(issuerid != INVALID_PLAYER_ID) {
KillTimer(TempoMostrarLife[issuerid]);

format(string,sizeof(string),"DANO DE %s ~n~%s", NomePlayer(issuerid),


NomeArma(weapon));
PlayerTextDrawSetString(issuerid, textinfodamaga[issuerid][0], string);

format(string,sizeof(string),"-%0.0f", amount);
PlayerTextDrawSetString(issuerid, textinfodamaga[issuerid][1], string);

PlayerTextDrawShow(issuerid, textinfodamaga[issuerid][0]);
PlayerTextDrawShow(issuerid, textinfodamaga[issuerid][1]);

TempoMostrarLife[issuerid] = SetTimerEx("HideTextoLife", 800, 0, "i",


issuerid);
MostrandoVida[issuerid] = 1;
}

return 1;
}

You might also like