SA-MP Forums Archive
HP Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: HP Problem (/showthread.php?tid=364666)



HP Problem - diablo16 - 31.07.2012

Hi i have a problem with OnPlayerDeath. I want wen a player kills a nother player to give him +50hp to the existing hp but it gives +50hp to the killed player. Please help me !

Here is OnPlayerDeath code:


Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    for (new i = 0; i < MAX_PLAYERS; i++)
	GameTextForPlayer(i, "~g~Killing Spree~n~~y~+15.000$+50HP~y~", 5000, 3);
    new Float:Health;
    GetPlayerHealth(playerid, Health);
    SetPlayerHealth(playerid, Health+50);
	GivePlayerMoney(killerid,15000);//<-------added this
	SendDeathMessage(killerid, playerid, reason);
    TextDrawHideForPlayer(playerid,HealthBar[playerid]);
    GameTextForPlayer(playerid, "~r~You Die", 5000, 2);
    neon(playerid);
    nrg(playerid);
    if( DMZone[killerid] >= 1)
    {
        TextDrawHideForPlayer(playerid,HealthBar[playerid]);
        SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
        SetPlayerScore(killerid,GetPlayerScore(killerid)-0);
        GameTextForPlayer(playerid, "~r~You Die", 5000, 2);
        PlayCrimeReportForPlayer(playerid, killerid, 3);
        kills[killerid]++;
    }
    if( DMZone[killerid] == 0)
    {
        TextDrawHideForPlayer(playerid,HealthBar[playerid]);
        SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
        SetPlayerScore(playerid,GetPlayerScore(playerid)-0);
        GameTextForPlayer(playerid, "~r~You Die", 5000, 2);
        PlayCrimeReportForPlayer(playerid, killerid, 3);
    }
    return 1;
}



Re: HP Problem - XStormiest - 31.07.2012

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    GameTextForPlayer(i, "~g~Killing Spree~n~~y~+15.000$+50HP~y~", 5000, 3);
    new Float:Health;
    GetPlayerHealth(killerid, Health);
    SetPlayerHealth(killerid, Health+50);
    GivePlayerMoney(killerid,15000);//<-------added this
    SendDeathMessage(killerid, playerid, reason);
    TextDrawHideForPlayer(playerid,HealthBar[playerid]);
    GameTextForPlayer(playerid, "~r~You Die", 5000, 2);
    neon(playerid);
    nrg(playerid);
    if( DMZone[killerid] >= 1)
    {
        TextDrawHideForPlayer(playerid,HealthBar[playerid]);
        SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
        SetPlayerScore(killerid,GetPlayerScore(killerid)-0);
        GameTextForPlayer(playerid, "~r~You Die", 5000, 2);
        PlayCrimeReportForPlayer(playerid, killerid, 3);
        kills[killerid]++;
    }
    if( DMZone[killerid] == 0)
    {
        TextDrawHideForPlayer(playerid,HealthBar[playerid]);
        SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
        SetPlayerScore(playerid,GetPlayerScore(playerid)-0);
        GameTextForPlayer(playerid, "~r~You Die", 5000, 2);
        PlayCrimeReportForPlayer(playerid, killerid, 3);
    }
    return 1;
}
try this


Re: HP Problem - diablo16 - 31.07.2012

Ty XStormiest(+rep) problem is solved but i have a question : how to do wen the player after killing and haves 100hp to give him +50 armor like the hp ?