mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Added some defines for cmd_target's filter system (for less cryptic code)
Changed all immunity obeying commands to allow for self execution - amb633
This commit is contained in:
parent
7c642fbf6e
commit
d836aeb716
@ -164,7 +164,7 @@ public addadminfn(id, level, cid)
|
||||
if (containi(arg, "STEAM_0:") == -1)
|
||||
{
|
||||
idtype |= ADMIN_LOOKUP
|
||||
player = cmd_target(id, arg, 10)
|
||||
player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF | CMDTARGET_NO_BOTS)
|
||||
} else {
|
||||
new _steamid[44]
|
||||
static _players[32], _num, _pv
|
||||
@ -189,7 +189,7 @@ public addadminfn(id, level, cid)
|
||||
}
|
||||
else if (idtype & ADMIN_NAME)
|
||||
{
|
||||
player = cmd_target(id, arg, 10)
|
||||
player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF | CMDTARGET_NO_BOTS)
|
||||
|
||||
if (player)
|
||||
idtype |= ADMIN_LOOKUP
|
||||
|
@ -109,7 +109,7 @@ public cmdKick(id, level, cid)
|
||||
|
||||
new arg[32]
|
||||
read_argv(1, arg, 31)
|
||||
new player = cmd_target(id, arg, 1)
|
||||
new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
|
||||
if (!player)
|
||||
return PLUGIN_HANDLED
|
||||
@ -212,7 +212,7 @@ public cmdBan(id, level, cid)
|
||||
read_argv(2, minutes, 7)
|
||||
read_argv(3, reason, 63)
|
||||
|
||||
new player = cmd_target(id, target, 9)
|
||||
new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
|
||||
|
||||
if (!player)
|
||||
return PLUGIN_HANDLED
|
||||
@ -280,10 +280,11 @@ public cmdBanIP(id, level, cid)
|
||||
read_argv(2, minutes, 7)
|
||||
read_argv(3, reason, 63)
|
||||
|
||||
new player = cmd_target(id, target, 9)
|
||||
new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
|
||||
|
||||
if (!player)
|
||||
{
|
||||
// why is this here?
|
||||
player = cmd_target(id, target, 9);
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
@ -350,7 +351,7 @@ public cmdSlay(id, level, cid)
|
||||
|
||||
read_argv(1, arg, 31)
|
||||
|
||||
new player = cmd_target(id, arg, 5)
|
||||
new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE)
|
||||
|
||||
if (!player)
|
||||
return PLUGIN_HANDLED
|
||||
@ -381,7 +382,7 @@ public cmdSlap(id, level, cid)
|
||||
new arg[32]
|
||||
|
||||
read_argv(1, arg, 31)
|
||||
new player = cmd_target(id, arg, 5)
|
||||
new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE)
|
||||
|
||||
if (!player)
|
||||
return PLUGIN_HANDLED
|
||||
@ -901,7 +902,7 @@ public cmdNick(id, level, cid)
|
||||
read_argv(1, arg1, 31)
|
||||
read_argv(2, arg2, 31)
|
||||
|
||||
new player = cmd_target(id, arg1, 1)
|
||||
new player = cmd_target(id, arg1, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
|
||||
if (!player)
|
||||
return PLUGIN_HANDLED
|
||||
|
@ -466,7 +466,7 @@ public cmdVoteKickBan(id, level, cid)
|
||||
new arg[32]
|
||||
read_argv(1, arg, 31)
|
||||
|
||||
new player = cmd_target(id, arg, 1)
|
||||
new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
|
||||
if (!player)
|
||||
return PLUGIN_HANDLED
|
||||
|
@ -37,7 +37,6 @@ int main(int argc, char **argv)
|
||||
} else {
|
||||
printf("Shared module failed to load: %s\n", dlerror());
|
||||
}
|
||||
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,11 @@ stock access(id,level)
|
||||
* 2 - allow yourself
|
||||
* 4 - must be alive
|
||||
* 8 - can't be bot */
|
||||
stock cmd_target(id,const arg[],flags = 1)
|
||||
#define CMDTARGET_OBEY_IMMUNITY (1<<0)
|
||||
#define CMDTARGET_ALLOW_SELF (1<<1)
|
||||
#define CMDTARGET_ONLY_ALIVE (1<<2)
|
||||
#define CMDTARGET_NO_BOTS (1<<3)
|
||||
stock cmd_target(id,const arg[],flags = CMDTARGET_OBEY_IMMUNITY)
|
||||
{
|
||||
new player = find_player("bl",arg);
|
||||
if (player)
|
||||
@ -127,9 +131,10 @@ stock cmd_target(id,const arg[],flags = 1)
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
if (flags & 1)
|
||||
if (flags & CMDTARGET_OBEY_IMMUNITY)
|
||||
{
|
||||
if ((get_user_flags(player)&ADMIN_IMMUNITY) && ((flags&2)?(id!=player):true) )
|
||||
if ((get_user_flags(player) & ADMIN_IMMUNITY) &&
|
||||
((flags & CMDTARGET_ALLOW_SELF) ? (id != player) : true) )
|
||||
{
|
||||
new imname[32];
|
||||
get_user_name(player,imname,31);
|
||||
@ -141,7 +146,7 @@ stock cmd_target(id,const arg[],flags = 1)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (flags & 4)
|
||||
if (flags & CMDTARGET_ONLY_ALIVE)
|
||||
{
|
||||
if (!is_user_alive(player))
|
||||
{
|
||||
@ -155,7 +160,7 @@ stock cmd_target(id,const arg[],flags = 1)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (flags & 8)
|
||||
if (flags & CMDTARGET_NO_BOTS)
|
||||
{
|
||||
if (is_user_bot(player))
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ public cmdRandom(id,level,cid) {
|
||||
if (read_argc()>1) { // person is specified..
|
||||
new arg[32]
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,1)
|
||||
new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
new name[32],name_targ[32];
|
||||
new auth[32],auth_targ[32];
|
||||
@ -231,7 +231,7 @@ public cmdReadyRoom(id,level,cid) {
|
||||
if (read_argc()>1) { // person is specified..
|
||||
new arg[32]
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,1)
|
||||
new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
new name[32],name_targ[32];
|
||||
new auth[32],auth_targ[32];
|
||||
@ -294,7 +294,7 @@ public cmdTeamTwo(id,level,cid) {
|
||||
if (read_argc()>1) { // person is specified..
|
||||
new arg[32]
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,1)
|
||||
new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
if (g_Team[player]==2 || g_Team[player]==4 /*i think 4 is team 2 in ava..*/) {
|
||||
client_print(id,print_chat,"[AMXX] That user is already on team two.");
|
||||
@ -322,7 +322,7 @@ public cmdTeamOne(id,level,cid) {
|
||||
if (read_argc()>1) { // person is specified..
|
||||
new arg[32]
|
||||
read_argv(1,arg,31)
|
||||
new player = cmd_target(id,arg,1)
|
||||
new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
|
||||
if (!player) return PLUGIN_HANDLED
|
||||
if (g_Team[player]==1 || g_Team[player]==3 /*i think 3 is team 2 in mvm..*/) {
|
||||
client_print(id,print_chat,"[AMXX] That user is already on team one.");
|
||||
|
Loading…
Reference in New Issue
Block a user