Raised This Month: $ Target: $400
 0% 

Small help - adding immunity to my plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bry
Member
Join Date: Mar 2004
Old 05-11-2004 , 11:03   Small help - adding immunity to my plugin
Reply With Quote #1

Hi guys.
i have a small plugin that runs a command all players (autoassing) which basically puts everyone onto a random team and works fine as it is

Code:
public randomteam (id, level,cid) 
{
 if (!cmd_access(id,level,cid,1))
 {
  console_print (id, "[AMX]: You do not have access to this command.")
  return PLUGIN_HANDLED;
 }
 
 new playercounter[32], numtotal
 get_players(playercounter,numtotal,"e","undefinedteam")
 for (new i = 0;i <= numtotal;i++)
 {
  client_cmd(playercounter[i], "autoassign") 
 }
 
 client_print(0,print_chat,"ADMIN: Moved everyone In Ready Room to a random team") 
 return PLUGIN_HANDLED;

}
However, i want anyone with admin_immunity to be immune to this. But am unsure on how to actaully go about adding the function which basically skips running this command on immune admins.
Would anyone be able to help?
Bry is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 05-11-2004 , 11:47  
Reply With Quote #2

Code:
public randomteam (id, level,cid) {  if (!cmd_access(id,level,cid,1))  {   console_print (id, "[AMX]: You do not have access to this command.")   return PLUGIN_HANDLED;  }   if( access( id, ADMIN_IMMUNITY ) )   {          // This player is immune...        return PLUGIN_HANDLED   }    new playercounter[32], numtotal  get_players(playercounter,numtotal,"e","undefinedteam")  for (new i = 0;i <= numtotal;i++)  {   client_cmd(playercounter[i], "autoassign")  }    client_print(0,print_chat,"ADMIN: Moved everyone In Ready Room to a random team")  return PLUGIN_HANDLED; }
xeroblood is offline
Send a message via MSN to xeroblood
Bry
Member
Join Date: Mar 2004
Old 05-11-2004 , 13:41  
Reply With Quote #3

cheers
Bry is offline
Bry
Member
Join Date: Mar 2004
Old 05-11-2004 , 14:01  
Reply With Quote #4

thanks but i just tested it and now it doesnt work.
I think the solution you posted will stop the scripting from running if there is an admin with immunity access on the server. This isn't what i was after.
I want the script to run but to ignore the immune admins i.e. it doesnt run the command on the admins it skips over them so to speak.

Is this possible?
Bry is offline
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 05-11-2004 , 14:11  
Reply With Quote #5

try this:

Code:
#include <amxmodx> #include <amxmisc> public randomteam (id, level,cid) {  if (!cmd_access(id,level,cid,1))  {   console_print (id, "[AMX]: You do not have access to this command.")   return PLUGIN_HANDLED;  }  if (!access(read_data(1),ADMIN_IMMUNITY))    new playercounter[32], numtotal  get_players(playercounter,numtotal,"e","undefinedteam")  for (new i = 0;i <= numtotal;i++)  {   client_cmd(playercounter[i], "autoassign")  }    client_print(0,print_chat,"ADMIN: Moved everyone In Ready Room to a random team")  return PLUGIN_HANDLED; }

maybe works, maybe not, can't grant that
FeuerSturm is offline
Ingram
Veteran Member
Join Date: May 2004
Old 05-11-2004 , 16:10  
Reply With Quote #6

Code:
#include <amxmodx> #include <amxmisc> public randomteam (id, level,cid) { if (!cmd_access(id,level,cid,1)) {   console_print (id, "[AMX]: You do not have access to this command.")   return PLUGIN_HANDLED; } new playercounter[32], numtotal get_players(playercounter,numtotal,"e","undefinedteam") for (new i = 0;i <= numtotal;i++)   if (!access( playercounter[i], ADMIN_IMMUNITY ))     client_cmd(playercounter[i], "autoassign")     client_print(0,print_chat,"ADMIN: Moved everyone In Ready Room to a random team") return PLUGIN_HANDLED; }
Why wouldn't u want it where i have it? Shouldn't that run the command on everyone except for the admins with ADMIN_IMMUNITY? He still wants it to run the command on everyone else.

Also, isn't the client already told
Code:
console_print (id, "[AMX]: You do not have access to this command.")
?
Ingram is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 05-11-2004 , 18:17  
Reply With Quote #7

Quote:
Originally Posted by Bry
thanks but i just tested it and now it doesnt work.
I think the solution you posted will stop the scripting from running if there is an admin with immunity access on the server. This isn't what i was after.
I want the script to run but to ignore the immune admins i.e. it doesnt run the command on the admins it skips over them so to speak.

Is this possible?
Sorry, I misinterpreted what you wanted really... Either way, the code snippet is useful to you, just in a diff spot...

Just looked at JJKiller's solution and it is what I should've wrote if I had understood you better.. GJ JJKiller!!!
xeroblood is offline
Send a message via MSN to xeroblood
Bry
Member
Join Date: Mar 2004
Old 05-11-2004 , 20:49  
Reply With Quote #8

ta JJkiller that works great and thxs anyway xeno
Bry is offline
Ingram
Veteran Member
Join Date: May 2004
Old 05-11-2004 , 22:33  
Reply With Quote #9

np, and i guess the answer was it is possible
Ingram is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode