AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   equali with cvar (https://forums.alliedmods.net/showthread.php?t=40720)

shino 07-02-2006 12:28

equali with cvar
 
so, here's the code:

Code:

public plugin_init() {
        register_plugin( PLUGIN, VERSION, AUTHOR );
        register_cvar( "amx_teamA", "A" );
        register_clcmd( "say" , "check" );
}
public check() {
        new CheckSay[126]
        read_args( CheckSay, 125 );
        remove_quotes( CheckSay );       
        if( equali( CheckSay, "%s ready", get_cvar_float( "amx_team") ) ) {
                set_cvar_num( "sv_restartround", 1 );
        }
}

it keeps throwing out warning on that line...

how should i use it?

KoST 07-02-2006 12:30

Re: equali with cvar
 
:rtfm:http://www.amxmodx.org/funcwiki.php?...uali&go=search

jtp10181 07-02-2006 13:40

Re: equali with cvar
 
you cannot format strings like that in an equali, you need to setup a var and format the string into that then use it in the equal.... also %s is string, %f is float. And your cvars is registered as "amx_teamA". This might work.

Code:
new temp[32] get_cvar_string(temp,31,"amx_team") format(temp,31, "%s ready", temp) if ( equali( CheckSay, temp ) ) {         set_cvar_num( "sv_restartround", 1 )     }

shino 07-03-2006 14:53

Re: equali with cvar
 
thanks, but i will just correct you - it should be like this:
Code:
get_cvar_string(  "amx_teamA", temp, 31 )


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

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