Bite key
#1

Umm.. I need a little help here,

I want to make my zombie bite the humans with the RMB key

Can anyone show me how?

Thanks!!!
Reply
#2

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_FIRE))
    {
        new Float:vec[3];
        GetPlayerPos(playerid, vec[0], vec[1], vec[2]);
        for(new i; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerInRangeOfPoint(i, 3.0, vec[0], vec[1], vec[2]))
            {
                 SetPlayerHealth(i,GetPlayerHealth(i)-3);
            }
        }
        return 1;
    }
    return 1;
}
Reply
#3

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_FIRE)
    {
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            new Float:x, Float:y, Float:z,name[24],str[128];
            GetPlayerPos(i, x, y, z);
            GetPlayerName(playerid,name,24);
            if(IsPlayerInRangeOfPoint(playerid,5,x,y,z))
            {
                format(str,sizeof(str),"Zombie %s has bitten you",name);
                SendClientMessage(i,-1,str);
                SetPlayerHealth(i,-50);

            }
            return 1;
        }
    }
    return 1;
}
just an example, u can modify it,
when the fire key is pressed and any player is near zombie then he will loose -50 health
Reply
#4

Edit: never mind
Reply
#5

Thnx guys ! turn me back into happy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)