Raised This Month: $ Target: $400
 0% 

Admin only command- Gatling weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dare.Devil
Member
Join Date: May 2014
Old 08-30-2015 , 02:59   Admin only command- Gatling weapon
Reply With Quote #1

Hi all,

Attached is a weapon plugin called "Gatling".. and under the plugin init section you will find the register_clcmd line that I've edited to make it console only & for admins only..

only problems is.. everyone can still use it and NOT only admins.. can someone me help out and make the console command to buy for ADMINS ONLY?!

Code:
public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
	
	register_forward(FM_CmdStart, "fw_CmdStart")
	register_forward(FM_SetModel, "fw_SetModel")
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	register_forward(FM_PlaybackEvent, "fw_PlaybackEvent")	
	
	RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack")
	RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack")		
	
	RegisterHam(Ham_Item_Deploy, weapon_gatling, "fw_Item_Deploy_Post", 1)
	RegisterHam(Ham_Weapon_Reload, weapon_gatling, "fw_Weapon_Reload_Post", 1)
	RegisterHam(Ham_Item_PostFrame, weapon_gatling, "fw_Item_PostFrame")
	RegisterHam(Ham_Item_AddToPlayer, weapon_gatling, "fw_Item_AddToPlayer_Post", 1)
	RegisterHam(Ham_Weapon_PrimaryAttack, weapon_gatling, "fw_Weapon_PrimaryAttack")
	RegisterHam(Ham_Weapon_PrimaryAttack, weapon_gatling, "fw_Weapon_PrimaryAttack_Post", 1)
	
	register_clcmd("weapon_gatling", "hook_weapon")
	register_clcmd("get_gatling", "get_gatling", ADMIN_BAN)
}
Attached Files
File Type: sma Get Plugin or Get Source (gatling-test.sma - 673 views - 15.1 KB)
Dare.Devil is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 08-30-2015 , 03:20   Re: Admin only command- Gatling weapon
Reply With Quote #2

You should check access inside declared function.
Check source code of default plugins. For example:
Quote:
register_clcmd("amx_rcon", "cmdRcon", ADMIN_RCON, "<command line>")

public cmdRcon(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED


new arg[128], authid[32], name[MAX_NAME_LENGTH]

read_args(arg, charsmax(arg))
get_user_authid(id, authid, charsmax(authid))
get_user_name(id, name, charsmax(name))

log_amx("Cmd: ^"%s<%d><%s><>^" server console (cmdline ^"%s^")", name, get_user_userid(id), authid, arg)

console_print(id, "[AMXX] %L", id, "COM_SENT_SERVER", arg)
server_cmd("%s", arg)

return PLUGIN_HANDLED
}

Last edited by Phant; 08-30-2015 at 03:21.
Phant is offline
Send a message via ICQ to Phant
Dare.Devil
Member
Join Date: May 2014
Old 08-30-2015 , 14:39   Re: Admin only command- Gatling weapon
Reply With Quote #3

Quote:
Originally Posted by Phant View Post
You should check access inside declared function.
Check source code of default plugins. For example:
there are no other default plugins..only the includes.. also do u mean that I copy the code script u provide and replace "id" with admin level values??

so do u mean it's a whole new section to add?
Dare.Devil is offline
Reply



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 22:09.


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