Everything look fine but I don't know why you did that above. Your just putting more use code into your plugin that you really don't need too. Checking if it the cvar is zero and returning. When you can do like below and remove unnecessary code.
I suggest you try loading up the AMX Mod X Bin Logger. It will tell you the exact line it crashed on. It a useful tool when debugging stuff too
Code:
// Random number generator
public random_jam_gen()
{
// if random cvars is 0 (off) end function
if(get_pcvar_num(g_iRandom))
{
g_iRatio = random_num(get_pcvar_num(g_iRandom), get_pcvar_num(g_iRatio));
}
return PLUGIN_HANDLED;
}
__________________