SA-MP Forums Archive
little problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: little problem (/showthread.php?tid=596276)



little problem - GeneralAref - 15.12.2015

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.


Re: little problem - LetsOWN[PL] - 15.12.2015

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.


Re: little problem - GeneralAref - 15.12.2015

your command disable it if teammate in range point.


Re: little problem - LetsOWN[PL] - 15.12.2015

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.