Raised This Month: $ Target: $400
 0% 

Amxmodx 1.8.1 [AMXX] Run time error 10: native error (native "get_user_flags")


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tryout101
Member
Join Date: Mar 2009
Old 06-19-2009 , 06:13   Amxmodx 1.8.1 [AMXX] Run time error 10: native error (native "get_user_flags")
Reply With Quote #1

Hi , I am in need of a solution, it doesn't have to be necessarily the plublic_rules.sma but the amxmisc.inc . I know if i get a solution to amxmisc.inc i can then do it for public rules. How can this error be fixed ?

Using Amxmodx 1.8.1

Thank You.

[AMXX] Run time error 10: native error (native "get_user_flags")
L 06/19/2009 - 05:403: [AMXX] [0] amxmisc.inc::cmd_access (line 50)
L 06/19/2009 - 05:403: [AMXX] [1] public_rules.sma::rules (line 212)

It has something to do with get user flags :

ammisc.inc Lines 50- 53
PHP Code:
else if ( get_user_flags(id) & level )
    {
        
has_access 1;
    } 
And if it makes it any easier
public_rules lines 207-214

PHP Code:
public rules(idlevelcid)
{
    new 
pID[1]
    
pID[0] = id
            
    
if (!cmd_access(idlevelcid0)) {  // NOT ADMIN
        
return PLUGIN_HANDLED
    

tryout101 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-19-2009 , 06:38   Re: Amxmodx 1.8.1 [AMXX] Run time error 10: native error (native "get_user_flags")
Reply With Quote #2

How you register your command ?

If not a client command, id would be 0, thus you should not use cmd_access.
__________________
Arkshine is offline
tryout101
Member
Join Date: Mar 2009
Old 06-19-2009 , 12:38   Re: Amxmodx 1.8.1 [AMXX] Run time error 10: native error (native "get_user_flags")
Reply With Quote #3

Hmm, I wish I knew what you were talking about ? Would you like me to post the whole code of either one of them?

Kind Regards
tryout101 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-19-2009 , 12:44   Re: Amxmodx 1.8.1 [AMXX] Run time error 10: native error (native "get_user_flags")
Reply With Quote #4

Arkshine want to know from where the function rules comes from.
Something like register_clcmd("amx_rules", "rules", ADMIN_FLAG) in plugin_init ?

Also, for sure, if (!cmd_access(id, level, cid, 0)) { // NOT ADMIN should be :

if (!cmd_access(id, level, cid, 1)) { // NOT ADMIN

1 is the min value, when no args are passed after the cmd.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
tryout101
Member
Join Date: Mar 2009
Old 06-19-2009 , 12:50   Re: Amxmodx 1.8.1 [AMXX] Run time error 10: native error (native "get_user_flags")
Reply With Quote #5

Heyyyyy its Connor,

Nice to hear from you. I try so much of the time to not talk to you, well you know why, it begins to become annoying.

Well anyways from your recommendation, I should change that 0 into a 1 right ?

And as for the plugin_init
PHP Code:
public plugin_init()
{
    
    
register_plugin("AMXX Public server rules""1.20""Priski")
    
    
// register command
    
    
register_concmd("rules_show""rules"ADMIN_KICK"- show rules to everybody")
    
register_concmd("rules_enable""r_enable"ADMIN_KICK"- <1|0> set automessagin on/off")
    
register_cvar("rules_admin_only""0")
    
register_cvar("rules_join""1")
    
register_cvar("rules_join_timeout""5")
    
register_cvar("rules_hudmessage_time""10")
    
register_cvar("rules_interval""600")
    
register_clcmd("say /rules""clientrules"ADMIN_ALL"- show rules")

tryout101 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-19-2009 , 12:58   Re: Amxmodx 1.8.1 [AMXX] Run time error 10: native error (native "get_user_flags")
Reply With Quote #6

Yes, change the 0 to 1.
And please show the whole function, i'm curious about why you are settings some parms.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
tryout101
Member
Join Date: Mar 2009
Old 06-19-2009 , 13:02   Re: Amxmodx 1.8.1 [AMXX] Run time error 10: native error (native "get_user_flags")
Reply With Quote #7

Sure , If show hole function means the whole plugin lol
PHP Code:
#include <amxmodx>
#include <amxmisc>

new base[] = "rules.txt"

new inumtext[127], hudmsg[440//max hudmessage length was 439 chars (?)

public plugin_init()
{
    
    
register_plugin("AMXX Public server rules""1.20""Priski")
    
    
// register command
    
    
register_concmd("rules_show""rules"ADMIN_KICK"- show rules to everybody")
    
register_concmd("rules_enable""r_enable"ADMIN_KICK"- <1|0> set automessagin on/off")
    
register_cvar("rules_admin_only""0")
    
register_cvar("rules_join""1")
    
register_cvar("rules_join_timeout""5")
    
register_cvar("rules_hudmessage_time""10")
    
register_cvar("rules_interval""600")
    
register_clcmd("say /rules""clientrules"ADMIN_ALL"- show rules")


public 
plugin_cfg() {
    
    if (!
file_exists(base)) {
        
write_file(base"; This is the public rules file, put your rules below")
        
write_file(base"; Remember, max amount of characters is 439")
        
console_print(0"%s file not found. creating new ..."base)
    }
    
}

public 
client_authorized id ) {
    
// on join display rules
    
    
if (get_cvar_num("rules_join")) {
        new 
tmp[1]
        
tmp[0] = id
        set_task
(1.0"showrules",id,tmp,1)
        
//console_print(0, "[user %d] client auth!", tmp[0])
    
}
    
    return 
PLUGIN_HANDLED
}


public 
showrules (pid[]) {
    new 
id pid[0]
    
    if ( 
get_user_team(id) != && get_user_team(id) != ) {
        if (
id) {
            new 
tmp[1]
            
tmp[0] = id
            set_task
(2.0"showrules",id,tmp,1)  // not yet in server
            //console_print(0, "[user %d] wait for joining team ...", id)
        
}
        return 
PLUGIN_HANDLED
    
}
    
    new 
tmp[1]
    
tmp[0] = id
    
    
//console_print(0, "[user %d] joined team : %d", id, get_user_team(id))
    //console_print(0, "[user %d] printing rules after %d seconds", id, get_cvar_num("rules_join_timeout"))
    
    
set_task(get_cvar_float("rules_join_timeout"), "printrules"idtmp1)  // not yet in server
    
    
return PLUGIN_HANDLED
}

public 
printrules(pid[])
{
    new 
id pid[0]
    if (
file_exists(base))
        {
        
        
//console_print(0, "[user] printing rules for user %d", id)
        
        
set_hudmessage 1101101100.020.2520.1get_cvar_float("rules_hudmessage_time"), 0.051.01)
        
format(hudmsg439"")
        
        
// read all the rules
        
for(i=0read_file(baseitext127num); i++) {
            if (
num && text[0] != ';') {
                
// display with predefined delay
                
add(hudmsg,439,text)
                
add(hudmsg,439,"^n")
            }
        }
        
        
// show hudmessages
        
show_hudmessage(idhudmsg)
        
    }
    
    return 
PLUGIN_HANDLED
}


public 
r_enable(idlevelcid)
{
    if (!
cmd_access(idlevelcid0)) {  // NOT ADMIN
        
return PLUGIN_HANDLED
    
}
    
    new 
arg[3]
    
    
read_argv(1arg2)
    new 
value str_to_num(arg)
    
    if (!
isalnum(arg[0]))
        
value = -1
    
    
if (value == 0) {
        
        if (
task_exists(2)) // close task
            
remove_task(2)    
        
        
console_print(id"You have disabled automatic messages")
        return 
PLUGIN_HANDLED
        
    
}
    if (
value == 1) {
        
// activate task, reload if already exist
        
if (task_exists(2)) {
            
change_task(2get_cvar_float("rules_interval"))
            } else {
            
set_task(get_cvar_float("rules_interval"), "rules"2""0"b")
        }    
        
console_print(id"You have enabled automatic messages")
        return 
PLUGIN_HANDLED        
    
}
    if (
task_exists(2)) {
        
console_print(id"automessages is ON.")
        } else {
        
console_print(id"automessages is OFF.")
    }
    
console_print(id"rules_enable <1|0> (1 = ON, 0 = OFF)")
    return 
PLUGIN_HANDLED        
    
}

public 
clientrules(idlevelcid) {
    new 
pID[1]
    
pID[0] = id
    
    
//console_print(0,"[user %d]Print rules for me only",pID[0])
    
printrules(pID[0])
}

public 
rules(idlevelcid)
{
    new 
pID[1]
    
pID[0] = id
            
    
if (!cmd_access(idlevelcid1)) {  // NOT ADMIN
        
return PLUGIN_HANDLED
    
}
    
    
// read file to all users
    
pID[0] = 0
    
//console_print(0,"[user %d]Print rules for all",id)
    
printrules(pID[0])
    
    
// Reset scheduled task after display
    
if (get_cvar_float("rules_interval") > 0) {
        if (
task_exists(2)) {
            
change_task(2get_cvar_float("rules_interval"))
            } else {
            
set_task(get_cvar_float("rules_interval"), "rules"200""0"b")
        }
    }
    
    return 
PLUGIN_HANDLED

tryout101 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 15:34.


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