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



Object Health..? - AryanV - 02.01.2014

Can We Set Health Of a Object...


Re: Object Health..? - TheOriginal1337 - 02.01.2014

Wait, what? No. However you can check out this: https://sampforum.blast.hk/showthread.php?tid=372478
Check the reply under the first post.


Re: Object Health..? - AryanV - 02.01.2014

I Don't Understand


Re: Object Health..? - Voxel - 02.01.2014

Use OnPlayerKeyStateChange and detect if the player is holding the KEY_FIRE and detect his weapon to be the chainsaw ID.
example:
pawn Код:
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (HOLDING(KEY_FIRE))
    {
        if(GetPlayerWeapon(playerid) == 9)
        {
            IsPlayerInRangeOfPoint etc etc
        }
    }
    return 1;
}



Re: Object Health..? - AryanV - 02.01.2014

Quote:
Originally Posted by Voxel
Посмотреть сообщение
Use OnPlayerKeyStateChange and detect if the player is holding the KEY_FIRE and detect his weapon to be the chainsaw ID.
example:
pawn Код:
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (HOLDING(KEY_FIRE))
    {
        if(GetPlayerWeapon(playerid) == 9)
        {
            IsPlayerInRangeOfPoint etc etc
        }
    }
    return 1;
}
oK thnx this helped me a lot..


Re: Object Health..? - Schocc - 02.01.2014

Additionally, use a timer to detect the time when the player is in front of the tree.

SetTimer


Re: Object Health..? - Pottus - 02.01.2014

Quote:
Originally Posted by Schocc
Посмотреть сообщение
Additionally, use a timer to detect the time when the player is in front of the tree.

SetTimer
That is a terrible idea, just use dynamic areas and call it a day.