SA-MP Forums Archive
Help - 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: Help (/showthread.php?tid=471785)



Help - samp_boy - 25.10.2013

Guys i need help:

when a guy givedamage it should show a heart or a armour over the head of the player which he attacked

someone can remember this ?


Re: Help - rickisme - 25.10.2013

here : https://sampforum.blast.hk/showthread.php?tid=250076


Re : Help - samp_boy - 25.10.2013

i mean a heart over the head or armour not numbers!


Re: Help - rickisme - 25.10.2013

pawn Код:
forward RemoveIcon(playerid);
public RemoveIcon(playerid)
{
    if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
}

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        if(GetPlayerArmour(playerid) > 0.0)
        {
            SetTimerEx("RemoveIcon", 1500, false, "i", playerid);
            if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
            SetPlayerAttachedObject(playerid, 9, 1242, 17, 0.601999, -0.036000, 0.011000, 96.299972, 79.500015, -81.599990, 1, 1, 1);          

            return 1;
        }
        if(GetPlayerHealth(playerid) > 0.0)
        {
            SetTimerEx("RemoveIcon", 1500, false, "i", playerid);
            if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
            SetPlayerAttachedObject(playerid, 9, 1240, 17, 0.587000, -0.027000, 0.028000, 86.100051, 79.499977, -69.599990, 1, 1, 1);      
            return 1;
        }
    }
    return 1;
}



Re : Help - samp_boy - 25.10.2013

C:\Documents and Settings\magnifique2012\Bureau\zm.pwn(47) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: Help - rickisme - 25.10.2013

Remove dot (".")

Код:
if(GetPlayerHealth(playerid) > 0.0) .



Re: Help - Konstantinos - 25.10.2013

That was due to a dot by accident:
pawn Код:
if(GetPlayerHealth(playerid) > 0.0) . // <--
However, take a look at those function.

https://sampwiki.blast.hk/wiki/GetPlayerArmour
https://sampwiki.blast.hk/wiki/GetPlayerHealth

You should store the amount of health/armour somewhere and they're passed by reference. They do not return the amount (actually GetPlayerHealth returns a value but for success/failure, not what you need).


Re : Help - samp_boy - 25.10.2013

Thank You!!!