little problem
#2

Quote:
Originally Posted by GeneralAref
Посмотреть сообщение
i have this command
Код:
CMD:kill(playerid, params[])
{
 	SetPlayerHealth(playerid, 0);
  	return 1;
}
i need if any enemy player around him , he cant use this command.
pawn Код:
CMD:kill(playerid, params[])
{
    new Float:min_distance = 10.0; // Minimum distance to disable this command
    new Float:tmp, Float:ppos[3];
   
    GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);

    for(new PlayerId = 0; PlayerId < MAX_PLAYERS; PlayerId++) {
        if(PlayerId == playerid) continue;
        if(IsPlayerInRangeOfPoint(playerid, min_distance, ppos[0], ppos[1], ppos[2])) {
            SendClientMessage(playerid, -1, "You can't use this command, because there is someone nearby.");
            return 1;
        }
    }
   
    SetPlayerHealth(playerid, 0);
    return 1;
}
Greetings.
Reply


Messages In This Thread
little problem - by GeneralAref - 15.12.2015, 11:29
Re: little problem - by LetsOWN[PL] - 15.12.2015, 12:28
Re: little problem - by GeneralAref - 15.12.2015, 13:00
Re: little problem - by LetsOWN[PL] - 15.12.2015, 13:56

Forum Jump:


Users browsing this thread: 1 Guest(s)