little problem
#1

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.
Reply
#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
#3

your command disable it if teammate in range point.
Reply
#4

Quote:
Originally Posted by GeneralAref
Посмотреть сообщение
your command disable it if teammate in range point.
How to determine wheter any given player is enemy or teammate?
If You answer Yourself this question it will be very easy to alternate this loop to appropriate form.
Greetings.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)