Quote:
Originally Posted by DJEarthQuake
Change_task instead of remove_task if I follow your condrumdrum. The subject line made it seem illusively easy as I believe one may already know there are both client_connect and client_disconnect functions to make works from.
|
that line:
Code:
selectPlayer(0, 0, .bMsg = true, .bTask = true, .bSound = true);
Hope I explained correctly is what causes the function to choose a character for the virus
Code:
stock selectPlayer(pId, pLastHitler, bool:bMsg, bool:bTask, bool:bSound)
{
if(!pId)
{
new iPlayers[32], iNum;
iNum = _get_players(iPlayers, .bAlive = true);
if(iNum < 2)
{
client_print_color(0, print_team_red, "%s Game requires^4 2 ^1players to start.", PREFIX);
g_bGameStart = false;
set_task(15.0, "LogEventHook_RoundStart", TASK_ID_GAMESTART);
return;
}
pId = iPlayers[random(iNum)];
}
if(!is_user_alive(pId))
return;
createEffect(pId);
if(is_user_alive(g_iPlayer))
{
fm_set_rendering(g_iPlayer, kRenderFxNone, 0, 0, 0, kRenderNormal, 0);
}
g_iLastHiter = pLastHitler;
g_iPlayer = pId;
get_user_name(pId, g_szName, charsmax(g_szName));
fm_set_rendering(pId, kRenderFxGlowShell, random_num(0, 255), random_num(0, 255), random_num(0, 255), kRenderTransAlpha, 25);
cs_set_player_model(pId, g_szInfectedModel);
if(task_exists(TASK_ID_SELECT))
remove_task(TASK_ID_SELECT);
if(bTask)
{
if(task_exists(TASK_ID_TIMELEFT))
remove_task(TASK_ID_TIMELEFT);
g_fTimeLeft = 20.0;
set_task(0.1, "taskTimeleft", TASK_ID_TIMELEFT, _, _, "b");
}
if(bMsg)
{
if(g_iLastHiter)
{
new szAttacker[MAX_NAME_LENGTH];
get_user_name(g_iLastHiter, szAttacker, charsmax(szAttacker));
cs_reset_player_model(g_iLastHiter);
new iOrigin[2][3];
get_user_origin(g_iPlayer, iOrigin[0]);
get_user_origin(g_iLastHiter, iOrigin[1]);
new iFeet = get_real_distance( iOrigin[ 0 ] , iOrigin[ 1 ] , Measure_Feet );
new Float:fVec[ 3 ];
IVecFVec( iOrigin[ 1 ] , fVec );
client_print_color(0, print_team_red, "%s ^3%s ^1hit ^3%s ^1from units [ ^4%d ^1] in ^1[ ^4%.1f Seconds ^1].", PREFIX, szAttacker, g_szName, iFeet, g_fTimeLeft);
CREATE_BEAMENTPOINT(pId, fVec, g_pSpriteLgtning, 0, 1, 1, 50, 50, random(255), random(255), random(255), 180, _);
}
else
client_print_color(0, print_team_red, "%s ^3%s ^1was randomly selected as the ^4infected!", PREFIX, g_szName);
}
if(bSound)
client_cmd(pId, "spk %s", g_szInfecteSounds[random(sizeof(g_szInfecteSounds))]);
}
Now I've been sitting on it for a few days and I've kicked out the option of
set_task(0.1, "checkOnline");
Because in general from there comes the problems that it makes checking whether to finish the game or continue
Having removed it, could say that 90% of everything works except every time someone left the game in the middle of a game it doesn't show the ad in the chat and also the game keeps running without stopping because there is no CHECK ONLINE