If all that confused you, without getting any real answers....here is a
CORRECT example of how to define, initialize, and use a CVAR
This is pretty much a Copypasta of an old plugin of mine
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich> // WITH CHEESE!
#define PLUGIN "CVAR Example"
#define AUTHOR "LIverwiz"
#define VERSION "0.1"
new g_16k_pcvar // define your global cvar pointer (where your code stores the server's CVAR)
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_16k_pcvar = register_cvar("amxx_16k", "2") // Making that CVAR in the server (amxx_16k) and then storing the pointer to your global
// As you can see i chose 2 to be the default value (in case the OP doesn't give it one, the server just uses these defined default values
RegisterHam(Ham_Spawn, "player", "ham_startMoney", 1) // you get to learn some hamsandwich too!
}
public ham_startMoney(id)
{
new i_cvarFlag = get_pcvar_num(g_16k_pcvar) // This gets your CVAR and stores its actual value to a variable (i chose i_cvarFlag)
if( (i_cvarFlag == 2 || i_cvarFlag == 3) && !is_user_bot(id)) //This uses that variable and tests how the program is going to function, depending on what the OP defines it as
give_money(id)
}
Now i'm sure i got some of the lingo wrong for some of the PAWN purists. But This is a working example of how to give players money at spawn.
NOTE: give_money() function is NOT shown. It is defined later in the code. I just cut the code down for ease of reading. Good luck!
__________________