public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if(bodypart == 3) PlayerInfo[playerid][pBodyStatus][0] -= frandom(1.0);
if(bodypart == 4) PlayerInfo[playerid][pBodyStatus][1] -= frandom(1.0);
if(bodypart == 5) PlayerInfo[playerid][pBodyStatus][3] -= frandom(1.0);
if(bodypart == 6) PlayerInfo[playerid][pBodyStatus][2] -= frandom(1.0);
if(bodypart == 7) PlayerInfo[playerid][pBodyStatus][5] -= frandom(1.0);
if(bodypart == 8) PlayerInfo[playerid][pBodyStatus][4] -= frandom(1.0);
ShowBloodScreen(playerid, amount);
new status[64], Float:health, Float:armor, string[128];
GetPlayerHealth(playerid, health);
GetPlayerArmour(playerid, armor);
format(status, sizeof(status), "Stranger_%d\n{ff0000}H: %.1f\n{ffffff}A: %.1f", RandMask[playerid], health, armor);
UpdateDynamic3DTextLabelText(MaskText[playerid], 0xFFFFFFFF, status);
if(issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 9)
{
if(!PlayerInfo[playerid][pHS])
{
PlayerInfo[playerid][pHS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("KillPlayer",2000,0,"i",playerid);
}
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
{
if(!PlayerInfo[playerid][pHS])
{
PlayerInfo[playerid][pHS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("KillPlayer",2000,0,"i",playerid);
}
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 9)
{
if(!PlayerInfo[playerid][pHS])
{
PlayerInfo[playerid][pHS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("KillPlayer",2000,0,"i",playerid);
}
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 9)
{
if(!PlayerInfo[playerid][pHS])
{
PlayerInfo[playerid][pHS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("KillPlayer",2000,0,"i",playerid);
}
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 9)
{
if(!PlayerInfo[playerid][pHS])
{
PlayerInfo[playerid][pHS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("KillPlayer",2000,0,"i",playerid);
}
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 9)
{
if(!PlayerInfo[playerid][pHS])
{
PlayerInfo[playerid][pHS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("KillPlayer",2000,0,"i",playerid);
}
}
if(issuerid != INVALID_PLAYER_ID && bodypart == 7)
{
if(!PlayerInfo[playerid][pLLS])
{
PlayerInfo[playerid][pLLS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
ApplyAnimation(playerid,"CRACK", "crckdeth2", 4.1, 1, 0, 0, 1, 600);
}
}
if(issuerid != INVALID_PLAYER_ID && bodypart == 8)
{
if(!PlayerInfo[playerid][pRLS])
{
PlayerInfo[playerid][pRLS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
ApplyAnimation(playerid,"CRACK", "crckdeth2", 4.1, 1, 0, 0, 1, 600);
}
}
if(issuerid != INVALID_PLAYER_ID && bodypart == 5)
{
if(!PlayerInfo[playerid][pLAS])
{
PlayerInfo[playerid][pLAS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
if(issuerid != INVALID_PLAYER_ID && bodypart == 6)
{
if(!PlayerInfo[playerid][pRAS])
{
PlayerInfo[playerid][pRAS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
if(issuerid != INVALID_PLAYER_ID && bodypart == 4)
{
if(!PlayerInfo[playerid][pCS])
{
if(health < 15)
{
PlayerInfo[playerid][pCS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("KillPlayer",3000,0,"i",playerid);
}
}
}
if(issuerid != INVALID_PLAYER_ID && bodypart == 3)
{
if(!PlayerInfo[playerid][pTS])
{
if(health < 15)
{
PlayerInfo[playerid][pTS] = 1;
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("KillPlayer",3000,0,"i",playerid);
}
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPVarInt(playerid, "Injured") == 1)
{
SetPlayerHealth(playerid, 19.0);
}
}
}
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPVarInt(playerid, "Injured") == 1)
{
SetPlayerHealth(playerid, 19.0);
}
}
}
return 1;
new Float:HP;
GetPlayerHealth(playerid,HP);
SetPlayerHealth(playerid,HP+amount);
u can make it in 2 way, first is to toggleplayercontrollable, wich also gives him a god mode.
and second one, you can give a player exactly amount what he took as a damage. OnPlayerTakeDamage PHP код:
|
I knew it but i don't know where to put it.
WAIT, AIN'T YOU THE SAME PERSON WHO HELPED ME TO FIX THE PROBLEMS IN MY OTHER THREADS? WHOA! |
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
// we need this code at the top of the callback OnPlayerTakeDamage.
if(Death[playerid] == 1) //u must place your death script here, for example let it be Death[playerid];
{
new Float:HP;
GetPlayerHealth(playerid,HP);
SetPlayerHealth(playerid,HP+amount);
return 1;
}