Raised This Month: $ Target: $400
 0% 

Subplugin Submission [ZP] Addon: Respawn player on connect


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
naSTR
Veteran Member
Join Date: Dec 2011
Location: Asia, Mongolia
Old 03-03-2012 , 00:59   Re: [ZP] Addon: Respawn player on connect
Reply With Quote #8

Im using MeRcyLeZZ's script. Which one is better, you think?

PHP Code:
// todo:
// check cvar values for zp_respawn_after_last_human, zp_infection_allow_respawn, zp_nem_allow_respawn, etc.

#include <amxmodx>
#include <zombieplague>

const Float:AUTORESPAWN_DELAY 5.0
const TASK_AUTORESPAWN 100
#define ID_AUTORESPAWN (taskid - TASK_AUTORESPAWN)
new cvar_deathmatchg_maxplayers

public plugin_init()
{
    
register_plugin("[ZP] Addon: Respawn Player""0.1""MeRcyLeZZ")
    
register_clcmd("joinclass","cmd_joinclass"); // new menus
    
register_menucmd(register_menuid("Terrorist_Select",1),511,"cmd_joinclass"); // old menus
    
register_menucmd(register_menuid("CT_Select",1),511,"cmd_joinclass"); // old menus
    
cvar_deathmatch get_cvar_pointer("zp_deathmatch")
    
g_maxplayers get_maxplayers()
}

// Player selects model
public cmd_joinclass(id)
{
    if (!
get_pcvar_num(cvar_deathmatch))
        return;
    
    
set_task(AUTORESPAWN_DELAY"auto_respawn_player"id+TASK_AUTORESPAWN)
}

public 
client_disconnect(id)
{
    
remove_task(id+TASK_AUTORESPAWN)
}

public 
auto_respawn_player(taskid)
{
    
// Already alive?
    
if (is_user_alive(ID_AUTORESPAWN))
        return;
    
    
// Nemesis/Survivor round overrides
    
if (zp_is_survivor_round())
    {
        
zp_respawn_user(ID_AUTORESPAWNZP_TEAM_ZOMBIE)
        return;
    }
    if (
zp_is_nemesis_round())
    {
        
zp_respawn_user(ID_AUTORESPAWNZP_TEAM_HUMAN)
        return;
    }
    
    
// Respawn as zombie?
    
if (get_pcvar_num(cvar_deathmatch) == || (get_pcvar_num(cvar_deathmatch) == && random_num(01)) || (get_pcvar_num(cvar_deathmatch) == && zp_get_zombie_count() < fnGetAlive()/2))
        
zp_respawn_user(ID_AUTORESPAWNZP_TEAM_ZOMBIE)
    else
        
zp_respawn_user(ID_AUTORESPAWNZP_TEAM_HUMAN)
}

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

__________________
naSTR is offline
 



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 16:22.


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