Senior Member
Join Date: Dec 2014
Location: Iraq
|
12-09-2015
, 14:24
[Tutorial] Sixth lesson in a series develop [ZPA 1.61] - State Disconnect Zm/Human.
|
#1
|
Sixth Lesson Add (State Disconnect)
- all rights reserved to arvEL.-, in : 9/12/2015 In these lesson i will explain how to develop [Zombie Plague Advance v1.6.1]
re write state disconnect zombie/human.
first go to this topic [ # ] and download[ZPA 1.6.1]
after that open the file [zombie_plague_advance_v1-6-1.sma] in [notepad++]
first press [Ctrl + F] and find this line:
PHP Code:
// Check Round Task -check that we still have both zombies and humans on a round
it's have codes:
PHP Code:
// Check Round Task -check that we still have both zombies and humans on a round- check_round(leaving_player) { // Round ended or make_a_zombie task still active if (g_endround || task_exists(TASK_MAKEZOMBIE)) return; // Get alive players count static iPlayersnum, id iPlayersnum = fnGetAlive() // Last alive player, don't bother if (iPlayersnum < 2) return; // Last zombie disconnecting if (g_zombie[leaving_player] && fnGetZombies() == 1) { // Only one CT left, don't bother if (fnGetHumans() == 1 && fnGetCTs() == 1) return; // Pick a random one to take his place while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) { /* keep looping */ } // Show last zombie left notice zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "LAST_ZOMBIE_LEFT", g_playername[id]) // Set player leaving flag g_lastplayerleaving = true // Turn into a Nemesis, Assassin or just a zombie? if (g_nemesis[leaving_player]) zombieme(id, 0, 1, 0, 0, 0) else if (g_assassin[leaving_player]) zombieme(id, 0, 0, 0, 0, 1) else zombieme(id, 0, 0, 0, 0, 0) // Remove player leaving flag g_lastplayerleaving = false // If Nemesis, set chosen player's health to that of the one who's leaving if (get_pcvar_num(cvar_keephealthondisconnect) && g_nemesis[leaving_player]) fm_set_user_health(id, pev(leaving_player, pev_health)) // If Assassin, set chosen player's health to that of the one who's leaving if (get_pcvar_num(cvar_keephealthondisconnect) && g_assassin[leaving_player]) fm_set_user_health(id, pev(leaving_player, pev_health)) } // Last human disconnecting else if (!g_zombie[leaving_player] && fnGetHumans() == 1) { // Only one T left, don't bother if (fnGetZombies() == 1 && fnGetTs() == 1) return; // Pick a random one to take his place while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) { /* keep looping */ } // Show last human left notice zp_colored_print(0, "^x04[ZP]^x01 %L", LANG_PLAYER, "LAST_HUMAN_LEFT", g_playername[id]) // Set player leaving flag g_lastplayerleaving = true // Turn into a Survivor, Sniper or just a human? if (g_survivor[leaving_player]) humanme(id, 1, 0, 0) else if (g_sniper[leaving_player]) humanme(id, 0, 0, 1) else humanme(id, 0, 0, 0) // Remove player leaving flag g_lastplayerleaving = false // If Survivor, set chosen player's health to that of the one who's leaving if (get_pcvar_num(cvar_keephealthondisconnect) && g_survivor[leaving_player]) fm_set_user_health(id, pev(leaving_player, pev_health)) // If Sniper, set chosen player's health to that of the one who's leaving if (get_pcvar_num(cvar_keephealthondisconnect) && g_sniper[leaving_player]) fm_set_user_health(id, pev(leaving_player, pev_health)) } }
replace all codes to:
PHP Code:
// Check Round Task -check that we still have both zombies and humans on a round- check_round(leaving_player) { // Round ended or make_a_zombie task still active if (g_endround || task_exists(TASK_MAKEZOMBIE)) return; // Get alive players count static iPlayersnum, id iPlayersnum = fnGetAlive() // Last alive player, don't bother if (iPlayersnum < 2) return; // Last zombie disconnecting if (g_zombie[leaving_player] && fnGetZombies() == 1) { // Only one CT left, don't bother if (fnGetHumans() == 1 && fnGetCTs() == 1) return; // Pick a random one to take his place while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) { /* keep looping */ } // Show last zombie left notice client_print_color(0, Grey, "^x04[ZP]^x01 Last zombie,^x03 %s^x01 disconnected,^x04 %s^x01 is the last zombie!", g_playername[leaving_player], g_playername[id]) // Set player leaving flag g_lastplayerleaving = true // Turn into a Nemesis, Assassin or just a zombie? if (g_nemesis[leaving_player]) zombieme(id, 0, 1, 0, 0, 0) else if (g_assassin[leaving_player]) zombieme(id, 0, 0, 0, 0, 1) else zombieme(id, 0, 0, 0, 0, 0) // Remove player leaving flag g_lastplayerleaving = false // If Nemesis, set chosen player's health to that of the one who's leaving if (get_pcvar_num(cvar_keephealthondisconnect) && g_nemesis[leaving_player]) fm_set_user_health(id, pev(leaving_player, pev_health)) // If Assassin, set chosen player's health to that of the one who's leaving if (get_pcvar_num(cvar_keephealthondisconnect) && g_assassin[leaving_player]) fm_set_user_health(id, pev(leaving_player, pev_health)) } // Last human disconnecting else if (!g_zombie[leaving_player] && fnGetHumans() == 1) { // Only one T left, don't bother if (fnGetZombies() == 1 && fnGetTs() == 1) return; // Pick a random one to take his place while ((id = fnGetRandomAlive(random_num(1, iPlayersnum))) == leaving_player ) { /* keep looping */ } // Show last human left notice client_print_color(0, Grey, "^x04[ZP]^x01 Last human,^x03 %s^x01 disconnected,^x04 %s^x01 is the last human!", g_playername[leaving_player], g_playername[id]) // Set player leaving flag g_lastplayerleaving = true // Turn into a Survivor, Sniper or just a human? if (g_survivor[leaving_player]) humanme(id, 1, 0, 0) else if (g_sniper[leaving_player]) humanme(id, 0, 0, 1) else humanme(id, 0, 0, 0) // Remove player leaving flag g_lastplayerleaving = false // If Survivor, set chosen player's health to that of the one who's leaving if (get_pcvar_num(cvar_keephealthondisconnect) && g_survivor[leaving_player]) fm_set_user_health(id, pev(leaving_player, pev_health)) // If Sniper, set chosen player's health to that of the one who's leaving if (get_pcvar_num(cvar_keephealthondisconnect) && g_sniper[leaving_player]) fm_set_user_health(id, pev(leaving_player, pev_health)) } }
now make compile and ejnoy
all rights reserved to arvEL.-
__________________
Last edited by arvEL.; 12-09-2015 at 14:25.
|
|