Raised This Month: $ Target: $400
 0% 

Help / Support Zp 5.0 Survivor count on mode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Killer zm
Senior Member
Join Date: Jun 2011
Old 08-22-2013 , 07:23   Zp 5.0 Survivor count on mode
Reply With Quote #1

How can I get turned 2 ore more survivors on Survivor Mode in zp 5.0.8 ?


I find this in zp50_gamemode_survivor.sma but i dont know how to change for turning more survivors on this mode like on plague mode ....

PHP Code:
public zp_fw_gamemodes_choose_post(game_mode_idtarget_player)
{
    
// Pick player randomly?
    
g_TargetPlayer = (target_player == RANDOM_TARGET_PLAYER) ? GetRandomAlive(random_num(1GetAliveCount())) : target_player
}

public 
zp_fw_gamemodes_start()
{
    
// Turn player into survivor
    
zp_class_survivor_set(g_TargetPlayer)
    
    
// Turn the remaining players into zombies
    
new id
    
for (id 1id <= g_MaxPlayersid++)
    {
        
// Not alive
        
if (!is_user_alive(id))
            continue;
        
        
// Survivor or already a zombie
        
if (zp_class_survivor_get(id) || zp_core_is_zombie(id))
            continue;
        
        
zp_core_infect(id)
    }
    
    
// Play Survivor sound
    
if (get_pcvar_num(cvar_survivor_sounds))
    {
        new 
sound[SOUND_MAX_LENGTH]
        
ArrayGetString(g_sound_survivorrandom_num(0ArraySize(g_sound_survivor) - 1), soundcharsmax(sound))
        
PlaySoundToClients(sound)
    }
    
    if (
get_pcvar_num(cvar_survivor_show_hud))
    {
        
// Show Survivor HUD notice
        
new name[32]
        
get_user_name(g_TargetPlayernamecharsmax(name))
        
set_hudmessage(HUD_EVENT_RHUD_EVENT_GHUD_EVENT_BHUD_EVENT_XHUD_EVENT_Y10.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_HudSync"%L"LANG_PLAYER"NOTICE_SURVIVOR"name)
    }


Last edited by Killer zm; 08-22-2013 at 14:28.
Killer zm is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 08-22-2013 , 21:30   Re: Zp 5.0 Survivor count on mode
Reply With Quote #2

try this:

this should work for two survivor..

PHP Code:
/*================================================================================
    
    --------------------------------
    -*- [ZP] Game Mode: Survivor -*-
    --------------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <amx_settings_api>
#include <zp50_gamemodes>
#include <zp50_class_survivor>
#include <zp50_deathmatch>

// Settings file
new const ZP_SETTINGS_FILE[] = "zombieplague.ini"

// Default sounds
new const sound_survivor[][] = { "zombie_plague/survivor1.wav" "zombie_plague/survivor2.wav" }

#define SOUND_MAX_LENGTH 64

new Array:g_sound_survivor

// HUD messages
#define HUD_EVENT_X -1.0
#define HUD_EVENT_Y 0.17
#define HUD_EVENT_R 20
#define HUD_EVENT_G 20
#define HUD_EVENT_B 255

new g_MaxPlayers
new g_HudSync
new g_TargetPlayerg_TargetPlayer2

new cvar_survivor_chancecvar_survivor_min_players
new cvar_survivor_show_hudcvar_survivor_sounds
new cvar_survivor_allow_respawn

public plugin_precache()
{
    
// Register game mode at precache (plugin gets paused after this)
    
register_plugin("[ZP] Game Mode: Survivor"ZP_VERSION_STRING"ZP Dev Team")
    
zp_gamemodes_register("Survivor Mode")
    
    
// Create the HUD Sync Objects
    
g_HudSync CreateHudSyncObj()
    
    
g_MaxPlayers get_maxplayers()
    
    
cvar_survivor_chance register_cvar("zp_survivor_chance""20")
    
cvar_survivor_min_players register_cvar("zp_survivor_min_players""0")
    
cvar_survivor_show_hud register_cvar("zp_survivor_show_hud""1")
    
cvar_survivor_sounds register_cvar("zp_survivor_sounds""1")
    
cvar_survivor_allow_respawn register_cvar("zp_survivor_allow_respawn""0")
    
    
// Initialize arrays
    
g_sound_survivor ArrayCreate(SOUND_MAX_LENGTH1)
    
    
// Load from external file
    
amx_load_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND SURVIVOR"g_sound_survivor)
    
    
// If we couldn't load custom sounds from file, use and save default ones
    
new index
    
if (ArraySize(g_sound_survivor) == 0)
    {
        for (
index 0index sizeof sound_survivorindex++)
            
ArrayPushString(g_sound_survivorsound_survivor[index])
        
        
// Save to external file
        
amx_save_setting_string_arr(ZP_SETTINGS_FILE"Sounds""ROUND SURVIVOR"g_sound_survivor)
    }
    
    
// Precache sounds
    
new sound[SOUND_MAX_LENGTH]
    for (
index 0index ArraySize(g_sound_survivor); index++)
    {
        
ArrayGetString(g_sound_survivorindexsoundcharsmax(sound))
        if (
equal(sound[strlen(sound)-4], ".mp3"))
        {
            
format(soundcharsmax(sound), "sound/%s"sound)
            
precache_generic(sound)
        }
        else
            
precache_sound(sound)
    }
}

// Deathmatch module's player respawn forward
public zp_fw_deathmatch_respawn_pre(id)
{
    
// Respawning allowed?
    
if (!get_pcvar_num(cvar_survivor_allow_respawn))
        return 
PLUGIN_HANDLED;
    
    return 
PLUGIN_CONTINUE;
}

public 
zp_fw_core_spawn_post(id)
{
    
// Always respawn as zombie on survivor rounds
    
zp_core_respawn_as_zombie(idtrue)
}

public 
zp_fw_gamemodes_choose_pre(game_mode_idskipchecks)
{
    if (!
skipchecks)
    {
        
// Random chance
        
if (random_num(1get_pcvar_num(cvar_survivor_chance)) != 1)
            return 
PLUGIN_HANDLED;
        
        
// Min players
        
if (GetAliveCount() < get_pcvar_num(cvar_survivor_min_players))
            return 
PLUGIN_HANDLED;
    }
    
    
// Game mode allowed
    
return PLUGIN_CONTINUE;
}

public 
zp_fw_gamemodes_choose_post(game_mode_idtarget_player)
{
    
// Pick player randomly?
    
g_TargetPlayer = (target_player == RANDOM_TARGET_PLAYER) ? GetRandomAlive(random_num(1GetAliveCount())) : target_player
    
    g_TargetPlayer2 
= (target_player == RANDOM_TARGET_PLAYER) ? GetRandomAlive(random_num(1GetAliveCount())) : target_player
    
}

public 
zp_fw_gamemodes_start()
{
    
// Turn player into survivor
    
zp_class_survivor_set(g_TargetPlayer)
    
zp_class_survivor_set(g_TargetPlayer2)
    
    
// Turn the remaining players into zombies
    
new id
    
for (id 1id <= g_MaxPlayersid++)
    {
        
// Not alive
        
if (!is_user_alive(id))
            continue;
        
        
// Survivor or already a zombie
        
if (zp_class_survivor_get(id) || zp_core_is_zombie(id))
            continue;
        
        
zp_core_infect(id)
    }
    
    
// Play Survivor sound
    
if (get_pcvar_num(cvar_survivor_sounds))
    {
        new 
sound[SOUND_MAX_LENGTH]
        
ArrayGetString(g_sound_survivorrandom_num(0ArraySize(g_sound_survivor) - 1), soundcharsmax(sound))
        
PlaySoundToClients(sound)
    }
    
    if (
get_pcvar_num(cvar_survivor_show_hud))
    {
        
// Show Survivor HUD notice
        
new name[32]
        
get_user_name(g_TargetPlayernamecharsmax(name))
        
set_hudmessage(HUD_EVENT_RHUD_EVENT_GHUD_EVENT_BHUD_EVENT_XHUD_EVENT_Y10.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_HudSync"%L"LANG_PLAYER"NOTICE_SURVIVOR"name)
    }
}

// Plays a sound on clients
PlaySoundToClients(const sound[])
{
    if (
equal(sound[strlen(sound)-4], ".mp3"))
        
client_cmd(0"mp3 play ^"sound/%s^""sound)
    else
        
client_cmd(0"spk ^"%s^""sound)
}

// Get Alive Count -returns alive players number-
GetAliveCount()
{
    new 
iAliveid
    
    
for (id 1id <= g_MaxPlayersid++)
    {
        if (
is_user_alive(id))
            
iAlive++
    }
    
    return 
iAlive;
}

// Get Random Alive -returns index of alive player number target_index -
GetRandomAlive(target_index)
{
    new 
iAliveid
    
    
for (id 1id <= g_MaxPlayersid++)
    {
        if (
is_user_alive(id))
            
iAlive++
        
        if (
iAlive == target_index)
            return 
id;
    }
    
    return -
1;


Last edited by wicho; 08-22-2013 at 21:33.
wicho is offline
Killer zm
Senior Member
Join Date: Jun 2011
Old 08-23-2013 , 05:53   Re: Zp 5.0 Survivor count on mode
Reply With Quote #3

I already thing at that way and is working but i thought there is possible another way ...

Last edited by Killer zm; 08-23-2013 at 05:53.
Killer zm is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 08-23-2013 , 12:07   Re: Zp 5.0 Survivor count on mode
Reply With Quote #4

u want with cvars or what..
wicho is offline
Killer zm
Senior Member
Join Date: Jun 2011
Old 08-24-2013 , 17:31   Re: Zp 5.0 Survivor count on mode
Reply With Quote #5

yes with cvars

Last edited by Killer zm; 08-24-2013 at 17:31.
Killer zm is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:37.


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