| closedcan id be steam id? |
| Started by Dr.G on 12-11-2008, 12:34 PM |
Threads: 75
Joined: Nov 2007
can id be steam id somehow? example:rnrn
public admin_sniper(id)rn{rn if(cmd_access(id,1) && is_user_connected(id))rn if(is_user_alive(id))rn give_item(id,"weapon_springfield")rnrn return PLUGIN_HANDLEDrn}rnrnrnrnIf i replace it like this it wont work:rnrn public admin_sniper(STEAM_0:1:12345)rn{rn if(cmd_access(STEAM_0:1:12345,1) && is_user_connected(STEAM_0:1:12345))rn if(is_user_alive(STEAM_0:1:12345))rn give_item(STEAM_0:1:12345,"weapon_springfield")rnrn return PLUGIN_HANDLEDrn}rnrnrnrnSo how would i only allow the function to a person with STEAM_0:1:12345 ?Threads: 11
Joined: Dec 2007
How is called the admin_sniper function ? register_clcmd or register_concmd or others ?nnYou just have to set the function for only being executed by an admin with a specific flags.
Threads: 75
Joined: Nov 2007
its called like thisrnrn
register_concmd("admin_sniper","admin_sniper",ADMIN_BAN,"Gives you a sniper rifle")rnrnBut want it to be only one person, by steamid in example. isnt that possible?Threads: 11
Joined: Dec 2007
Yes you can.nnBut if you have acces to the server, you can modify users flags to be the only one with a specified flag.nn
public admin_sniper(id)n{n new steamid[]n get_user_authid( id, steamid, 35) nn if(cmd_access(id,1) && is_user_connected(id))n if(equal(steamid,"STEAM_0:1:000000"))n if(is_user_alive(id))n give_item(id,"weapon_springfield")nn return PLUGIN_HANDLEDn}Threads: 59
Joined: Jan 2007
Good question and good explanation. I've been looking myself for this as well for my donators.
Threads: 75
Joined: Nov 2007
cool thanks!!
Threads: 75
Joined: Jun 2006
You could also use only certain flags for certain people. As such you can give access to all people and then check the persons flags after they call the function. That way you can utilize the other flags:rnrnhttp://wiki.amxmodx.org/Adding_Admins_(AMX_Mod_X)#Access_LevelsrnrnLook at levels A-H. To do this you would do the following:rnrn
register_concmd("admin_sniper","admin_sniper",ADMIN_RESERVATION,"Gives you a sniper rifle")rnrnThat way you can add your donators to the Reservation. Then you just look at the individual and see if they have certain flags and then give them access:rnrnpublic admin_sniper(id, level, cid)rn{rn // id = 1 -32rn // level = this case ADMIN_RESERVATIONrn // cid = id of the command that called this functionrn // 1 = the count of switches attached to thisrn // command eg: admin_ban 1 100 rn // -- that would be 3 or 1 for command and 2 for switchesrn // and last rn if(!cmd_access(id, level, cid, 1)) // check for BAN accessrn {rn if(get_user_flags(id) & (ADMIN_LEVEL_A|ADMIN_LEVEL_B))rn {rn if(is_user_alive(id))rn {rn give_item(id,"weapon_springfield")rn }rn }rn }rnrn return PLUGIN_HANDLEDrn} rnrnIn the above if you have set them to level a or level b they get access. So you have redundancy. They have to have reservation to get into that command, and then they have to have level a or level b. So I hope this helps!Threads: 11
Joined: Dec 2007
I think that using ADMIN flags is the best way to do what you want.
Threads: 75
Joined: Nov 2007
Thanks guys! very usefull info!

