Hi, im making a sub-plugin for a core-plugin.
The core is not open-source but the sub is so here we go:
I was developing a feature that gives *cash* every roundend to terrorists and here is what i got atm:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <cashmod>
#define PLUGIN "CM: RoundEnd Cash"
#define VERSION "0.0.5"
#define AUTHOR "ReCon"
new end_mode;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
//Register Round End
register_logevent( "eRound_end", 2, "1=Round_End" );
//Register A CVAR
end_mode = register_cvar("cm_endmode", "0");
}
public eRound_end()
{
new mode = get_pcvar_num(end_mode);
new cash;
if( !EnoughPlayers() )
{
return PLUGIN_HANDLED;
}
//Bunch of variables
new iPlayers[32], iNum, iPid, format_text[128];
//Get all players
get_players( iPlayers, iNum, "a" );
//Browse through all players
for( new i; i < iNum; i++ )
{
iPid = iPlayers[i];
new CsTeams:team = cs_get_user_team(iPid);
if( team == CS_TEAM_T )
{
switch( mode )
{
case 0:
{
if( is_user_alive(iPid) )
{
if( cm_get_user_admin(iPid) )
{
cash = 100;
formatex(format_text, sizeof(format_text) - 1, "^x03You got 100 cash for surviving as a Terrorist!");
}
else
{
cash = 80;
formatex(format_text, sizeof(format_text) - 1, "^x03You got 80 cash for surviving as a Terrorist!");
}
}
}
case 1:
{
if( is_user_alive(iPid) )
{
if( cm_get_user_admin(iPid) )
{
cash = 100;
formatex(format_text, sizeof(format_text) - 1, "^x03You got 100 cash for surviving as a Terrorist!");
}
else
{
cash = 80;
formatex(format_text, sizeof(format_text) - 1, "^x03You got 80 cash for surviving as a Terrorist!");
}
}
else
{
if( cm_get_user_admin(iPid) )
{
cash = 45;
formatex(format_text, sizeof(format_text) - 1, "^x03You got 45 cash for being a Terrorist!");
}
else
{
cash = 25;
formatex(format_text, sizeof(format_text) - 1, "^x03You got 25 cash for being a Terrorist!");
}
}
}
case 2:
{
cash = 0;
return PLUGIN_HANDLED;
}
}
cm_set_user_cash(iPid, cm_get_user_cash(iPid) + cash);
Print(iPid, format_text);
}
}
return PLUGIN_HANDLED;
}
My problem is that , when i have cm_endmode set to 1 and im dead when the roundend occours i dont get the message printed or the cash added.
However if i have cm_endmode set to 1 and i am alive at round end i do get cash, and if i have cm_endmode 2 i get nothing just like it should, but when im dead with cm_endmode 1 i dont get anything. Im suppose to get cash and there suppose to be a message to.
Why doesnt it print hte message and give the cash?
__________________