AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   [Tutorial] Sixth lesson in a series develop [ZPA 1.61] - State Disconnect Zm/Human. (https://forums.alliedmods.net/showthread.php?t=275837)

arvEL. 12-09-2015 14:24

[Tutorial] Sixth lesson in a series develop [ZPA 1.61] - State Disconnect Zm/Human.
 
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 iPlayersnumid
    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() == && fnGetCTs() == 1)
            return;
        
        
// Pick a random one to take his place
        
while ((id fnGetRandomAlive(random_num(1iPlayersnum))) == 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(id01000)
        else if (
g_assassin[leaving_player])
            
zombieme(id00001)
        else
            
zombieme(id00000)
        
        
// 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(idpev(leaving_playerpev_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(idpev(leaving_playerpev_health))
    }
    
    
// Last human disconnecting
    
else if (!g_zombie[leaving_player] && fnGetHumans() == 1)
    {
        
// Only one T left, don't bother
        
if (fnGetZombies() == && fnGetTs() == 1)
            return;
        
        
// Pick a random one to take his place
        
while ((id fnGetRandomAlive(random_num(1iPlayersnum))) == 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(id100)
        else if (
g_sniper[leaving_player])
            
humanme(id001)
        else
            
humanme(id000)
        
        
// 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(idpev(leaving_playerpev_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(idpev(leaving_playerpev_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 iPlayersnumid
    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() == && fnGetCTs() == 1)
            return;
        
        
// Pick a random one to take his place
        
while ((id fnGetRandomAlive(random_num(1iPlayersnum))) == leaving_player ) { /* keep looping */ }
        
        
// Show last zombie left notice
        
client_print_color(0Grey"^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(id01000)
        else if (
g_assassin[leaving_player])
            
zombieme(id00001)
        else
            
zombieme(id00000)
        
        
// 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(idpev(leaving_playerpev_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(idpev(leaving_playerpev_health))
    }
    
    
// Last human disconnecting
    
else if (!g_zombie[leaving_player] && fnGetHumans() == 1)
    {
        
// Only one T left, don't bother
        
if (fnGetZombies() == && fnGetTs() == 1)
            return;
        
        
// Pick a random one to take his place
        
while ((id fnGetRandomAlive(random_num(1iPlayersnum))) == leaving_player ) { /* keep looping */ }
        
        
// Show last human left notice
        
client_print_color(0Grey"^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(id100)
        else if (
g_sniper[leaving_player])
            
humanme(id001)
        else
            
humanme(id000)
        
        
// 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(idpev(leaving_playerpev_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(idpev(leaving_playerpev_health))
    }


now make compile and ejnoy :)
all rights reserved to arvEL.-


amir saiaoud 02-03-2016 22:14

Re: [Tutorial] Sixth lesson in a series develop [ZPA 1.61] - State Disconnect Zm/Huma
 
not an important thing anyway nice tuto that's will help

Kakarot47 02-04-2016 17:00

Re: [Tutorial] Sixth lesson in a series develop [ZPA 1.61] - State Disconnect Zm/Huma
 
lol not recomended but nice tut keep it up :D


All times are GMT -4. The time now is 23:15.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.