AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_pcvar_num (https://forums.alliedmods.net/showthread.php?t=214487)

jonnzus 04-27-2013 14:41

get_pcvar_num
 
Hey, when I try compile this, I got this error:
Code:

admins.sma(31) : error 035: argument type mismatch (argument 1)
So how I should do this?
PHP Code:

if (get_pcvar_num ("amx_adminnotify") == 1

PHP Code:

public client_putinserver(id) {

    new 
g_maxplayers get_maxplayers();

        if (
get_user_flags(id) & ADMIN) {
            
AdminCount++;
        }
    
        if (
get_user_flags(id) & HIDDEN) {
            return 
PLUGIN_HANDLED
        
}

    if (
get_pcvar_num ("amx_adminnotify") == 1) {
        for(
id 1;id <= g_maxplayers;id++){
            
client_print  (idprint_chat"Admin connected to server");

        }
    }
    return 
PLUGIN_HANDLED;



didoWEE 04-27-2013 14:46

Re: get_pcvar_num
 
PHP Code:

new p_sth

public plugin_init()
{
     
p_sth register_cvar("cvar""1");
}

public 
func()
{
     if(
get_pcvar_num(p_sth) == 1)
     {
           
// do sth
     
}



YamiKaitou 04-27-2013 14:48

Re: get_pcvar_num
 
You are using pcvars incorrectly.

Code:

new cvar;

public plugin_init()
    cvar = register_cvar("amx_adminnotify", "1");

public client_putinserver(id)
    if (get_pcvar_num(cvar))
        console_print("amx_adminnotify is 1");
    else
        console_print("amx_adminnotify is 0");


jonnzus 04-27-2013 14:50

Re: get_pcvar_num
 
Thanks ;D


All times are GMT -4. The time now is 20:45.

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