Raised This Month: $ Target: $400
 0% 

Command reservation?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 11-13-2005 , 19:00   Re: Command reservation?
Reply With Quote #1

Quote:
Originally Posted by XxAvalanchexX
Quote:
Originally Posted by Unidentified
When I set the godmode flag to ADMIN_LEVEL_H a non-admin was able to use the command without authorization. WTF?
Did you use cmd_access to check for access, or just assume it would be done automatically?
I...assumed It would be done automaticly. How would I check for access? Thanks a billion.
Unidentified is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-13-2005 , 19:25  
Reply With Quote #2

Code:
public plugin_init() {     register_clcmd("command","function",ACCESS_LEVEL);  }  public function(id,level,cid) {     if(!cmd_access(id,level,cid,argument_count))        return PLUGIN_HANDLED;     return PLUGIN_HANDLED;  }

You need to change argument_count to the number of extra arguments the command takes (ie: amx_glow <player> <color> would be two extra arguments) plus one (so for amx_glow the last parameter to cmd_access would be 3).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 11-13-2005 , 20:44  
Reply With Quote #3

You need to change argument_count to the number of extra arguments the command takes (ie: amx_glow <player> <color> would be two extra arguments) plus one (so for amx_glow the last parameter to cmd_access would be 3).[/quote]

So It has to be clcmd? Not concmd? So, If I use
Code:
register_clcmd("command","function",ADMIN_LEVEL_H);

I'll be able to give them access to a command just by adding them In the users.ini?
Unidentified is offline
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 11-13-2005 , 21:07  
Reply With Quote #4

Tried It. Compile Error:
Quote:
Originally Posted by CompileError
undefined symbol "level"
Unidentified is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-13-2005 , 21:10  
Reply With Quote #5

It can be register_clcmd or register_concmd, it doesn't matter.

Make sure you change the function header from:

Code:
public myFunc(id) {

to this:

Code:
public myFunc(id,level,cid) {
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 11-13-2005 , 22:20  
Reply With Quote #6

Thanks, but that death msg thing Is not working.

Code:
public plugin_init() { register_event("DeathMsg","event_deathmsg","a"); }  public event_deathmsg(id) {     set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransTexture,255);         return PLUGIN_HANDLED  }
Unidentified is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-13-2005 , 23:41  
Reply With Quote #7

DeathMsg is a global event, sent to everyone. The "id" you have will be 0. Use read_data(2) to get the player who was killed.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 11-15-2005 , 14:49  
Reply With Quote #8

Quote:
Originally Posted by XxAvalanchexX
DeathMsg is a global event, sent to everyone. The "id" you have will be 0. Use read_data(2) to get the player who was killed.
Thanks, but I'm confused now.

Quote:
Originally Posted by amxmodx.inc
/* Gets value from client messages.
* When you are asking for string the array and length is needed (read_data(2,name,len)).
* Integer is returned by function (new me = read_data(3)).
* Float is set in second parameter (read_data(3,value)). */
native read_data(value, {Float,Sql,Result,_}:... );
??

So It's like I use
Code:
new deathevent = read_data(2)
??
Unidentified is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-15-2005 , 15:30  
Reply With Quote #9

Code:
public plugin_init() {     register_event("DeathMsg","event_deathmsg","a");  }  public event_deathmsg() {     new deadguy = read_data(2);  }

deadguy now contains the index of the player who was killed.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 11-15-2005 , 15:36  
Reply With Quote #10

Okay, would this be correct?

Code:
public event_deathmsg(id) {     new deadguy = read_data(2);     set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransTexture,255);         return PLUGIN_HANDLED  }
Unidentified 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 23:39.


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