Don't really get why this isn't working, it's suppose too, I've read around alot about the events of round start, round end, player spawn etc.
I'm trying to set the player maxspeed on round start, though it doesn't set it... Even if the id is correct and everything is a match.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta_util>
#define PLUGIN "Test Plugin"
#define VERSION "0.0.1"
#define AUTHOR "OFFBEAT"
new g_iDecals;
new g_cvarCount;
new g_iDecFreq;
new bool:g_bMaySpray = true;
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_logevent( "fnRoundStart", 2, "1=Round_Start" )
g_cvarCount = register_cvar( "mod_countspray", "1" );
g_iDecFreq = get_cvar_num( "decalfrequency" );
}
public fnRoundStart( )
{
new players[32], Max;
get_players( players, Max );
for( new i = 0; i < Max; i++ )
{
if( is_user_alive( players[i] ) )
fm_set_user_maxspeed( players[i], fm_get_user_maxspeed( players[i] ) + 50.0 );
}
return PLUGIN_HANDLED;
}
public client_impulse( id, impulse )
{
if( get_pcvar_num( g_cvarCount ) && impulse == 201 && g_bMaySpray )
{
g_iDecals++;
switch( g_iDecals )
{
case 5:
{
client_print( id, print_chat, "[DECAL COUNTER] You have sprayed %d decals, spray 5 more to increase in speed!", g_iDecals );
}
case 10:
{
client_print( id, print_chat, "[DECAL COUNTER] You have sprayed %d decals, increasing 50 units in speed", g_iDecals );
fm_set_user_maxspeed( id, fm_get_user_maxspeed( id ) + 50.0 );
}
default:
{
client_print( id, print_chat, "[DECAL COUNTER] You have now sprayed %d decal(s)", g_iDecals );
}
}
g_bMaySpray = false;
set_task( float( g_iDecFreq ), "fnMaySpray" );
return PLUGIN_CONTINUE;
} else if( get_pcvar_num( g_cvarCount ) && impulse == 201 && !g_bMaySpray )
{
// return handled
}
return PLUGIN_HANDLED;
}
public fnMaySpray( )
{
g_bMaySpray = true;
}
Don't worry about the other parts of the code, it's just the round start code i want to work, the other was just a test.
EDIT: Fixed it, thanks guys! Fixed code in my latest post.