Dying to take punches
#7

Why should we make it so difficult..

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
newkeys KEY_FIRE) {
            if(
GetPlayerWeapon(playerid) == || GetPlayerWeapon(playerid) == 1) {
                new 
victimid GetClosestPlayer(playerid);
                if(
IsPlayerConnected(victimid)) {
                    if(
GetDistanceBetweenPlayers(playerid,victimid) < 2) {
                        new 
Float:health;
                        
GetPlayerHealth(victimidhealth);
                        
SetPlayerHealth(victimidhealth 3.0);
                        return 
1;
                    }
            }
        }
    } 
And :

PHP код:
forward GetClosestPlayer(p1)
public 
GetClosestPlayer(p1)
{
    new 
x,Float:dis,Float:dis2,player;
    
player = -1;
    
dis 99999.99;
    for (
x=0;x<MAX_PLAYERS;x++) {
        if(
IsPlayerConnected(x)) {
            if(
!= p1) {
                
dis2 GetDistanceBetweenPlayers(x,p1);
                if(
dis2 dis && dis2 != -1.00) {
                    
dis dis2;
                    
player x;
                }
            }
        }
    }
    return 
player;

Reply


Messages In This Thread
Dying to take punches - by JoshNudock - 23.06.2015, 21:47
Re: Dying to take punches - by Inn0cent - 23.06.2015, 21:57
Re: Dying to take punches - by Jonny5 - 23.06.2015, 21:58
Re: Dying to take punches - by Roberto80 - 23.06.2015, 22:03
Re: Dying to take punches - by JoshNudock - 23.06.2015, 22:15
Re: Dying to take punches - by Jonny5 - 23.06.2015, 22:16
Re : Dying to take punches - by KillerDVX - 24.06.2015, 04:14

Forum Jump:


Users browsing this thread: 2 Guest(s)