AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   clcmd for admin not working (https://forums.alliedmods.net/showthread.php?t=75491)

Fawkes37 08-06-2008 14:25

clcmd for admin not working
 
register_clcmd("say /flymenu","flymenu",ADMIN_BAN)

im a newbie. its not working. all the clients can use it. what am i doing wrong?

thx in advance

YamiKaitou 08-06-2008 14:34

Re: clcmd for admin not working
 
Are you checking to make sure that the client has ADMIN_BAN access? Cause, anyone can use it, but if you don't check it, it won't stop them

Fawkes37 08-06-2008 15:04

Re: clcmd for admin not working
 
Quote:

Originally Posted by Fawkes37 (Post 665572)
im a newbie.

thx in advance

and i dont know shit bro.
so the question would be, how to check it? (if thats what i have to do?)

thx in advance

dekken 08-06-2008 15:30

Re: clcmd for admin not working
 
post the Full code and ill help you

Fawkes37 08-06-2008 15:57

Re: clcmd for admin not working
 
Quote:

Originally Posted by dekken (Post 665594)
post the Full code and ill help you

nah dude, would u just bring out a sample? i mean, i would actaully like to do it myself, learn and shit, so a small sample would be best for me :D
u know, something like a motd pops up if u write /motd, but only for admin. think that would be a nice example, or wouldnt it?

Iwon 08-06-2008 17:45

Re: clcmd for admin not working
 
PHP Code:

#include <amxmodx>

public plugin_init() {
      
register_clcmd("say /motd","MOTD")
      
register_clcmd("say /admin","ADMINMOTD")

public 
MOTD(id)
{
 
//everyone can see
    
show_motd(id,"motd.txt","Message of the Day.")
    return 
PLUGIN_CONTINUE

public 
ADMINMOTD(id)
{
    if(!
is_user_admin(id)) // Only admins can see
    
return PLUGIN_HANDLED
    show_motd
(id,"admin.txt","Message of the Day.")
    return 
PLUGIN_CONTINUE



YamiKaitou 08-06-2008 18:01

Re: clcmd for admin not working
 
Iwon, Didn't help him any. That would just allow ALL admins to access it, not check if they had the ADMIN_BAN flag.


@OP: You can check the users flag using !get_user_flags(id)&ADMIN_BAN

Iwon 08-06-2008 18:14

Re: clcmd for admin not working
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() {
    
register_clcmd("say /admin","motd")
}
    
public 
motd(id) {
        if(!
get_user_flags(id) & ADMIN_BAN)
            return 
PLUGIN_CONTINUE
        
        show_motd
(id,"admin.txt","Message of the Day.")


Fixed :)

YamiKaitou 08-06-2008 18:15

Re: clcmd for admin not working
 
Quote:

Originally Posted by Iwon (Post 665653)
PHP Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init() {
    
register_clcmd("say /admin","motd")
}
    
public 
motd(id) {
    if(!
get_user_flags(id) & ADMIN_BAN)
            return 
PLUGIN_HANDLED
        
        show_motd
(0,"admin.txt","Message of the Day.")
    } 

Fixed :)


Now it is fixed

Iwon 08-06-2008 18:17

Re: clcmd for admin not working
 
Quote:

Originally Posted by YamiKaitou (Post 665655)
Now it is fixed

Yeh after 2 times i Made some mistakes and fixed them :)


All times are GMT -4. The time now is 05:36.

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