diff --git a/plugins/admin.sma b/plugins/admin.sma index 14fd736b..377ae788 100755 --- a/plugins/admin.sma +++ b/plugins/admin.sma @@ -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 diff --git a/plugins/admincmd.sma b/plugins/admincmd.sma index 1036f1db..d238f410 100755 --- a/plugins/admincmd.sma +++ b/plugins/admincmd.sma @@ -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 diff --git a/plugins/adminvote.sma b/plugins/adminvote.sma index 07588399..6ae8e497 100755 --- a/plugins/adminvote.sma +++ b/plugins/adminvote.sma @@ -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 diff --git a/plugins/dlsym.c b/plugins/dlsym.c index 2958b02e..9540bb3b 100755 --- a/plugins/dlsym.c +++ b/plugins/dlsym.c @@ -37,7 +37,6 @@ int main(int argc, char **argv) } else { printf("Shared module failed to load: %s\n", dlerror()); } - - exit(0); + return 0; } diff --git a/plugins/include/amxmisc.inc b/plugins/include/amxmisc.inc index d8bfc7cd..2c1017c3 100755 --- a/plugins/include/amxmisc.inc +++ b/plugins/include/amxmisc.inc @@ -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)) { diff --git a/plugins/ns/nscommands.sma b/plugins/ns/nscommands.sma index 3d7ac332..5ddef815 100755 --- a/plugins/ns/nscommands.sma +++ b/plugins/ns/nscommands.sma @@ -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.");