AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Undefined symbol "id" (https://forums.alliedmods.net/showthread.php?t=308518)

blAck. 06-23-2018 08:27

Undefined symbol "id"
 
Why am I getting error message "undefined symbol 'id'" on this code?
Code:

if(get_user_flags(id) & ADMIN_CHAT)

DJ Tsunami 06-23-2018 08:31

Re: Undefined symbol "id"
 
Because the variable 'id' doesn't exist.

blAck. 06-23-2018 08:32

Re: Undefined symbol "id"
 
Quote:

Originally Posted by DJ Tsunami (Post 2598866)
Because the variable 'id' doesn't exist.

So what should I do?

DJ Tsunami 06-23-2018 08:44

Re: Undefined symbol "id"
 
You should create that variable and assign the client index. Since you only posted one line of code, I don't know where the client index is supposed to come from.

Rohanlogs 06-23-2018 11:38

Re: Undefined symbol "id"
 
Tsunami gave you a perfect answer but if you don't know what a client index is then show us the whole function and we can fix it for you.
Also, this is the Sourcemod section, only SourcePawn is related here.
That's one of AMXX core functions so I'm assuming that's Pawn language which should be posted in the AMXX scripting section.

Natsheh 06-23-2018 18:22

Re: Undefined symbol "id"
 
Quote:

Originally Posted by Rohanlogs (Post 2598898)
Tsunami gave you a perfect answer but if you don't know what a client index is then show us the whole function and we can fix it for you.
Also, this is the Sourcemod section, only SourcePawn is related here.
That's one of AMXX core functions so I'm assuming that's Pawn language which should be posted in the AMXX scripting section.

You are on the wrong section.

Rohanlogs 06-23-2018 18:40

Re: Undefined symbol "id"
 
Quote:

Originally Posted by Natsheh (Post 2598973)
You are on the wrong section.

I wasn't. This was originally posted in the SourceMod section.

DJ Tsunami 06-24-2018 03:09

Re: Undefined symbol "id"
 
Here's the code that he PM'ed me. Apparently he's new to coding.

PHP Code:

public plugin_init()
{
    
register_plugin("blAck-pack""1.0""blAck.")
    
    new 
flags get_user_flags(id)
    
    if(
flags ADMIN_CHAT)
    {
        
register_clcmd("say /apravila","apravila_motd")
        
register_clcmd("say_team /apravila","apravila_motd")
    }
    else    
    { 

I don't know if he needs to use client_authorized or if AMXX has another post admin check forward.

Ghosted 06-24-2018 03:42

Re: Undefined symbol "id"
 
I was scripting like this when i started coding first time :D

instinctpt1 06-24-2018 06:33

Re: Undefined symbol "id"
 
PHP Code:

// INCLUDE Amxmodx and amxmisc here

public plugin_init()
{
   
// register plugin here
   
register_clcmd("say /apravila""apravila_motd"ADMIN_CHAT )
}

public 
apravila_motd(id,lvl,cid)
{
   if(!
cmd_access(id,lvl,cid,0) return PLUGIN_HANDLED
   
   
// do your thing now
   


Wrote on phone sorry... Figure it out yourself


All times are GMT -4. The time now is 02:35.

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