AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Alternative to is_user_admin() ? (https://forums.alliedmods.net/showthread.php?t=213682)

devWaleed 04-17-2013 14:45

Alternative to is_user_admin() ?
 
Em Hi, probably my first post here. I found that is_user_admin() is not showing in funcwiki and It isn't working in my script too, perhaps only for me? :/

PHP Code:

    if(is_user_alive(id) && !is_user_bot(id) && is_user_admin(id) == 0){
        
set_task(float(get_pcvar_num(frequency)), "getdata"id__"b")
    } 

I still get my desired errors for clients which shouldn't been shown if user is admin.

Is there an alternative to it? Or If still is_user_admin() works?

-Thanks.

Dr. McKay 04-17-2013 14:53

Re: Alternative to is_user_admin() ?
 
Are you sure you meant to post here? Looks like you're looking for AMXX.

devWaleed 04-17-2013 14:58

Re: Alternative to is_user_admin() ?
 
Oh, I am sorry Sir, I clicked the wrong scripting section, Yes It is meant to be in AMXX section. Sorry. Can you or any mode' move it there, please?

didoWEE 04-17-2013 15:28

Re: Alternative to is_user_admin() ?
 
It's native which is NOT included in the base amxmodx.
However you can make it yourself.


BTW,
Code:

set_task(float(get_pcvar_num(frequency)),.....
--->
set_task(get_pcvar_float(frequency),.....


baneado 04-17-2013 16:17

Re: Alternative to is_user_admin() ?
 
get_user_flags it's better

ConnorMcLeod 04-17-2013 16:46

Re: Alternative to is_user_admin() ?
 
get_user_flags is not better, is_user_admin is just fine.

Add this after #include <amxmodx> at top of plugin :

#include <amxmisc>

devWaleed 04-17-2013 17:16

Re: Alternative to is_user_admin() ?
 
Ok, but I couldn't find it in funcwiki. Tell me if I am doing this wrong.

To check if user is not an admin.

PHP Code:

if(!is_user_admin(id))  OR  if(is_user_admin(id) == 0

which one is correct? I think both.

Jhob94 04-17-2013 17:35

Re: Alternative to is_user_admin() ?
 
I think the more correct is:
if(!is_user_admin(id))

ConnorMcLeod 04-17-2013 17:52

Re: Alternative to is_user_admin() ?
 
It is rather the same, but boolean check is better.

Jhob94 04-17-2013 18:53

Re: Alternative to is_user_admin() ?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1934744)
It is rather the same, but boolean check is better.

Now iam interested to know why boolean check is better, because i always use ! thinking it was the better way :stupid:


All times are GMT -4. The time now is 10:55.

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