can anyone make this code for cs 1.6 not for zp ?
this plugin by natsheh
PHP Code:
#include <amxmodx>
#include <zp50_core>
#include <hamsandwich>
#include <cstrike>
new gCvar_respawn_enable
new gCvar_respawn_team
new gCvar_respawn_time
new bool:gConnectSpawn[33]
new g_maxplayers
public plugin_init()
{
register_plugin("[ZP] Connect-Respawn", "1.0", "natsheh")
gCvar_respawn_enable = register_cvar("zp_connect_respawn_enable", "1")
gCvar_respawn_team = register_cvar("zp_connect_respawn_team", "0")
gCvar_respawn_time = register_cvar("zp_connect_respawn_time", "3.0")
register_message(get_user_msgid("ShowMenu"), "message_ShowMenu")
register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu")
RegisterHam(Ham_Spawn, "player", "fw_user_spawn", 1)
RegisterHam(Ham_Respawn, "player", "fw_user_spawn", 1)
g_maxplayers = get_maxplayers()
}
public fw_user_spawn(id)
{
if(get_pcvar_num(gCvar_respawn_enable) && gConnectSpawn[id] && is_user_alive(id))
{
gConnectSpawn[id] = false
}
}
public client_join_task(id, iMsgid)
{
new param[2]
param[0] = iMsgid
set_task(0.1, "client_join", id, param[0], sizeof(param))
}
public message_ShowMenu(iMsgid, iDest, id)
{
if(get_pcvar_num(gCvar_respawn_enable) && gConnectSpawn[id])
{
client_join_task(id, iMsgid)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public message_VGUIMenu(iMsgid, iDest, id)
{
if(get_pcvar_num(gCvar_respawn_enable) && gConnectSpawn[id])
{
client_join_task(id, iMsgid)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public Auto_Spawn(id)
{
static CsTeams:team
team = cs_get_user_team(id)
if(team == CS_TEAM_UNASSIGNED || team == CS_TEAM_SPECTATOR)
return PLUGIN_HANDLED
if(!get_first_zombie() || get_player_team() == 2)
{
zp_core_respawn_as_zombie(id, false)
}
else if(!get_player_team())
{
if(zp_core_get_human_count() > zp_core_get_zombie_count())
{
zp_core_respawn_as_zombie(id, true)
}
else if(zp_core_get_human_count() < zp_core_get_zombie_count())
{
zp_core_respawn_as_zombie(id, false)
}
else
{
static b; b = random_num(1, 2)
zp_core_respawn_as_zombie(id, (b == 1 ? true:false))
}
}
else if(get_player_team() == 1)
zp_core_respawn_as_zombie(id, true)
if(!is_user_alive(id) && is_user_connected(id))
{
gConnectSpawn[id] = false
set_task(get_pcvar_float(gCvar_respawn_time), "Spawn_Player", id)
}
return PLUGIN_CONTINUE
}
public client_connect(id)
{
gConnectSpawn[id] = true
}
public client_putinserver(id)
{
if(!is_user_bot(id))
{
gConnectSpawn[id] = true
}
}
public client_disconnect(id)
{
gConnectSpawn[id] = false
}
public Spawn_Player(id)
{
if(!is_user_alive(id) && is_user_connected(id))
{
ExecuteHamB(Ham_CS_RoundRespawn, id)
}
}
public client_join(param[], id)
{
if(gConnectSpawn[id] && get_pcvar_num(gCvar_respawn_enable))
{
new iMsgBlock = get_msg_block(param[0])
set_msg_block(param[0], BLOCK_SET)
new gTeam[2]; gTeam[0] = get_player_team();
client_cmd(id, "jointeam %i", gTeam[0])
new gClass[2]; gClass[0] = get_player_class();
client_cmd(id, "joinclass %i", gClass[0])
set_task(1.0, "Auto_Spawn", id)
set_msg_block(param[0], iMsgBlock)
}
}
stock get_player_team()
{
new a
switch( get_pcvar_num(gCvar_respawn_team) )
{
case 0:
{
a = random_num(1,2)
}
case 1:
{
a = 1
}
case 2:
{
a = 2
}
}
return a
}
stock get_player_class()
{
return random_num(1,4)
}
public get_first_zombie()
{
new id
for(new i = 1; i < g_maxplayers; i++)
{
if(!is_user_connected(i))
continue;
if(zp_core_is_first_zombie(i) && is_user_alive(i))
{
id = i
break;
}
}
return id
}