I'm lost with this so I need to ask for help.
So what I'm trying to do/want to do is to increase the cvar "
sk_dmg" when more than 1 (> 1) player/client connect and decrease on disconnect, by 10% each.
It should always be the default value (20) when it's just 1 client on the server or empty.
Code:
cvar_t sk_dmg = {"sk_dmg","20"};
void mmClientConnect( edict_t *pEntity )
{
// check for a proxy/hltv
if ( ( pEntity->v.flags & FL_PROXY ) )
RETURN_META(MRES_SUPERCEDE);
int i = ENTINDEX(pEntity)-1;
if ((i >= 0) && (i < 32))
{
// balance sk_dmg after player count...
CVAR_SET_FLOAT( "sk_dmg", ... ); // increase 10%
}
RETURN_META(MRES_IGNORED);
}
void mmClientDisconnect( edict_t *pEntity )
{
// check for a proxy/hltv
if ( ( pEntity->v.flags & FL_PROXY ) )
RETURN_META(MRES_SUPERCEDE);
int i = ENTINDEX(pEntity)-1;
if ((i >= 0) && (i < 32))
{
// balance sk_dmg after player count...
CVAR_SET_FLOAT( "sk_dmg", ... ); // decrease 10%
}
RETURN_META(MRES_IGNORED);
}