Raised This Month: $ Target: $400
 0% 

dmb lil question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 05-16-2005 , 10:53   dmb lil question
Reply With Quote #1

may i know whats the difference if i don't put the ",level,cid" in this following script?
Code:
public train(id,level,cid)

i declared that you need at least ADMIN_LEVEL_A to do that, but if i don't put that, will it do any harm?

yep, i know stupid question
__________________
Plugins:
none

n0obie4life is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 05-16-2005 , 11:30  
Reply With Quote #2

If you don't put it, then the function will not be able to compare access levels to the calling user, meaning anyone can call the command from console in-game..

Bad idea, unless it is a public command..

To compare access levels, we usually use 'cmd_access()' from amxmisc.inc:

Code:
public MyFunction( id, level, cid ) {     if( !cmd_access( id, level, cid, 0 ) ) // <--  0 = # of Command-Line Arguments..         return PLUGIN_HANDLED }
xeroblood is offline
Send a message via MSN to xeroblood
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 05-16-2005 , 12:23  
Reply With Quote #3

The last parameter should be number of command line arguments + 1
Quote:
Originally Posted by funcwiki
The last parameter (num) is the number of arguments.
Note that the first parameter is the command name so if you expect one param set it to 2.
__________________
twistedeuphoria is offline
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 05-17-2005 , 05:51  
Reply With Quote #4

oh crap. no wonder my plugin wasn't "approved"

Code:
 if (!(get_user_flags(id)&ADMIN_LEVEL_A)){         client_print(id,print_console,"[AMX] You have no access to that command")         return PLUGIN_HANDLED  }

what abotu if i use this?
__________________
Plugins:
none

n0obie4life 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 16:39.


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