Veteran Member
|
10-02-2020
, 18:18
Disconnect & Connected detection
|
#1
|
Quote:
Before all the strange questions how it's supposed to work according to 2 alive people then countdown and the running game that needs to transmit the virus and then last survives and wins, and again countdown
|
ill did SET_TASK check online about enough player to keep run or not enough if someone Left the game at run the game just stopped automatic and start task of new game, that should randomly infected any from alive if there is +1 Alive the disease, the problem that it doesn't work: doesn't continue from the last the moment he broke away
Even when someone connect on to SERVER, on game running sometimes that make again Task Countdown as begin like new roundrestart
I don't find the problem it could be putinserver
disconnect
checkOnline not configured correctly
HTML Code:
LogEventHook_RoundEnd();
LogEventHook_RoundStart();
That there's no particular test there
How did I check?
For example there is
Game will start in 15 Second
and i kick a bot , at countdown/or not Will start recounting and will not continue the game
Code:
enum (+= 35) {
TASK_ID_INFECT,
TASK_ID_TIMELEFT,
TASK_ID_SELECT,
TASK_ID_GAMESTART,
TASK_ID_GAMEEND,
TASK_ID_VOTE_DAY_MODE_TIMER,
TASK_INDEX_SHOW_INFORMER,
TASK_INDEX_WAVE,
TASK_INDEX_SPAWN,
TASK_FIREWORKS
};
new g_iPlayer;
new g_iGame = -1;
Code:
#include <amxmodx>
#include <reapi>
public plugin_init()
{
RegisterHookChain( RG_RoundEnd, "RoundEnd", 0 );
}
public RoundEnd( WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay )
{
if ( event == ROUND_GAME_COMMENCE )
{
set_member_game( m_bGameStarted, true );
SetHookChainReturn( ATYPE_INTEGER, false );
return(HC_SUPERCEDE);
}
return(HC_CONTINUE);
}
Someone was told to use it for blocking those who enter in the middle game but does not help
if you need more info from code i will edit:
PHP Code:
public client_putinserver(id) { if(is_user_bot(id)) return; if(g_iGame > -1) set_task(1.0, "main_informer", id+TASK_INDEX_SHOW_INFORMER, _, _, "b"); loadUser(id); block_user_spawn(id); NextCashTime[ id ] = get_gametime(); }
public client_disconnected(id) { remove_task(id+TASK_INDEX_SHOW_INFORMER); remove_task(id+TASK_INDEX_WAVE); remove_task(id+TASK_FIREWORKS); saveUser(id); if(id == g_iPlayer || task_exists(id+TASK_ID_TIMELEFT)) { client_print_color(0, print_team_default, "%s ^3^"%n^3^" ^1left the^4 game^1", PREFIX, id); if(_get_alive_players() > 2) // what im trying to do remain the infected after player disconnected // What I'm trying to do here, once there's a SET TASK test and it recognizes that PLAYER DISCONNCETED? // Then continue SelectPlayer as Infected and do not do AGAIN COUNTDOWN 15 SEC { remove_task(id+TASK_ID_SELECT); remove_task(id+TASK_ID_INFECT); client_print_color(0, print_team_default, "%s ^3%n^1 was the infected and has ^4disconnected^1.", PREFIX, g_iPlayer); client_print_color(0, print_team_default, "%s Selecting new^4 random infected^1 in ^3%.1f seconds^1!", PREFIX, SELECT_PLAYER_DELAY); selectPlayer(0, 0, .bMsg = true, .bTask = true, .bSound = true); // there i want it remain and not show countdown 15 second } else { client_print_color(0, print_team_default, "%s Game has been^4 stopped ^1because there is only^4 1 alive^1", PREFIX); remove_task(id+TASK_ID_TIMELEFT); } } for(new i = 0; i <= HIGH_SPEED; i++) g_bUserExtra[id][i] = false;
for(new i = 0; i <= TOTAL_PLAYED_R; i++) g_iUserRounds[id][i] = 0;
set_task(0.1, "checkOnline"); }
public checkOnline() { //What I'm trying to do here, once there's a SET TASK test and it recognizes that PLAYER DISCONNCETED? //Then continue SelectPlayer as Infected and do not do AGAIN COUNTDOWN 15 SEC if (_get_alive_players() >= 2 && g_bGameStart) // Game wont stop if there is 2 > + Alive, check g_bGameStart { LogEventHook_RoundEnd(); LogEventHook_RoundStart(); } else { taskGameend(); } //client_print(0, 3, "%s", g_bGameStart ? "true" : "false"); // is always false /*if(_get_alive_players() < 1) { if(g_bGameStart) taskGameend(); else { LogEventHook_RoundEnd(); LogEventHook_RoundStart(); } }*/ }
public LogEventHook_RoundStart() { if(g_iGame > -1) set_task(1.0, "main_informer", TASK_INDEX_SHOW_INFORMER, _, _, "b"); for(new i = 1; i <= g_iMaxPlayers; i++) { if(!is_user_connected(i)) continue; if(task_exists(i+TASK_INDEX_WAVE)) remove_task(i+TASK_INDEX_WAVE);
remove_task(i+TASK_FIREWORKS); } if(task_exists(TASK_ID_GAMEEND)) remove_task(TASK_ID_GAMEEND); client_cmd(0, "mp3 stop"); set_lights("m"); g_iTimeToStart = 15;
if(g_iDay % SPECIAL_DAY != 0) { if(_get_alive_players() > 1) { g_szText = ""; set_task(1.0, "taskInfect", TASK_ID_INFECT, _, _, "a", g_iCountDown = g_iTimeToStart + 1); }else { client_print_color(0, print_team_red, "%s The game can't start at least^3 2^1 players are required!", PREFIX); set_task(10.0, "LogEventHook_RoundStart", TASK_ID_GAMESTART); // default is 10.0 } } return PLUGIN_CONTINUE; }
public LogEventHook_RoundEnd() { for(new i = 1; i <= g_iMaxPlayers; i++) { if(!is_user_connected(i)) continue; if(task_exists(i+TASK_INDEX_SHOW_INFORMER)) remove_task(i+TASK_INDEX_SHOW_INFORMER); if(task_exists(i+TASK_INDEX_WAVE)) remove_task(i+TASK_INDEX_WAVE);
//remove_task(i+TASK_FIREWORKS); if(pev(i, pev_renderfx) != kRenderFxNone || pev(i, pev_rendermode) != kRenderNormal) { fm_set_rendering(i, kRenderFxNone, 0, 0, 0, kRenderNormal, 0); }
g_iUserRounds[i][PLAYED_R] += 1; g_iUserRounds[i][TOTAL_PLAYED_R] += 1;
for(new j = 0; j <= HIGH_SPEED; j++) g_bUserExtra[i][j] = false; } g_bIsNoScopeRound = false; invisibil = false; g_bGameStart = false; g_iLastHiter = 0; g_iPlayer = 0; g_szName = ""; if (g_iGame == 1) CreateFog(0, 128, 128, 128, 0.0018, true); set_lights("m"); remove_task(TASK_ID_SELECT); remove_task(TASK_ID_INFECT); remove_task(TASK_ID_TIMELEFT); remove_task(TASK_ID_GAMESTART); remove_task(TASK_ID_GAMEEND); remove_task(TASK_ID_VOTE_DAY_MODE_TIMER); }
public LogEventHook_RestartGame() { if(!g_bGameRestart) g_iDay = 0;
g_bGameRestart = false; LogEventHook_RoundEnd(); }
Code:
stock _get_alive_players()
{
new players[32], pnum;
get_players(players, pnum, "a");
return pnum;
}
PHP 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))]); }
It's something I'm really sitting for a while
Last edited by Fuck For Fun; 10-02-2020 at 18:29.
|
|