[help] lose hp when near NPC how can i do ?
#2

pawn Код:
//Somewhere in your script, best would be after you created the npc
SetTimerEx("DamagePlayersInRange", damage_interval, 1, "iff", npcid, range, damage);

forward public DamagePlayersInRange(npcid, Float:range, Float:damage);
public DamagePlayersInRange(npcid, Float:range, Float:damage)
{
    new Float:x, Float:y, Float:z;
    new Float:hp;
    GetPlayerPos(npcid, x, y, z);
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInRangeOfPoint(i, range, x, y, z))
        {
            GetPlayerHealth(i, hp);
            SetPlayerHealth(i, hp - damage);
        }
}
Untested as always
Reply


Messages In This Thread
[help] lose hp when near NPC how can i do ? - by andruz99 - 01.10.2010, 10:14
Re: [help] lose hp when near NPC how can i do ? - by Mauzen - 01.10.2010, 13:21

Forum Jump:


Users browsing this thread: 1 Guest(s)