下面是引用 eadwe147 于 2009-12-06 15:36 发表的 :
有zp4.3的吗
一样是CTRL+F搜寻public fw_PlayerSpawn_Post(id)
就会找到
public fw_PlayerSpawn_Post(id)
{
// Not alive or didn't join a team yet
if (!is_user_alive(id) || !fm_cs_get_user_team(id))
return;
// Player spawned
g_isalive[id] = true
// Remove previous tasks
remove_task(id+TASK_SPAWN)
remove_task(id+TASK_MODEL)
remove_task(id+TASK_BLOOD)
remove_task(id+TASK_AURA)
remove_task(id+TASK_BURN)
remove_task(id+TASK_CHARGE)
remove_task(id+TASK_FLASH)
remove_task(id+TASK_NVISION)
// Spawn at a random location?
if (get_pcvar_num(cvar_randspawn)) do_random_spawn(id)
// Hide money?
if (get_pcvar_num(cvar_removemoney))
set_task(0.4, "task_hide_money", id+TASK_SPAWN)
// Respawn player if he dies because of a worldspawn kill?
if (get_pcvar_num(cvar_respawnworldspawnkill))
set_task(2.0, "respawn_player_task", id+TASK_SPAWN)
// Spawn as zombie?
if (g_respawn_as_zombie[id] && !g_newround)
{
reset_vars(id, 0) // reset player vars
zombieme(id, 0, 0, 0, 0) // make him zombie right away
return;
}
// Reset player vars
reset_vars(id, 0)
// Show custom buy menu?
if (get_pcvar_num(cvar_buycustom))
set_task(0.2, "show_menu_buy1", id+TASK_SPAWN)
// Set health and gravity
fm_set_user_health(id, get_pcvar_num(cvar_humanhp))
set_pev(id, pev_gravity, get_pcvar_float(cvar_humangravity))
// Switch to CT if spawning mid-round
if (!g_newround && fm_cs_get_user_team(id) != FM_CS_TEAM_CT) // need to change team?
{
remove_task(id+TASK_TEAM)
fm_cs_set_user_team(id, FM_CS_TEAM_CT)
fm_user_team_update(id)
}
// Custom models stuff
static currentmodel[32], tempmodel[32], already_has_model, i, iRand, size
already_has_model = false
if (g_handle_models_on_separate_ent)
{
// Set the right model
if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
iRand = random_num(0, ArraySize(model_admin_human) - 1)
ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}
else
{
iRand = random_num(0, ArraySize(model_human) - 1)
ArrayGetString(model_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_human, iRand))
}
// Set model on player model entity
fm_set_playermodel_ent(id)
// Remove glow on player model entity
fm_set_rendering(g_ent_playermodel[id])
}
else
{
// Get current model for comparing it with the current one
fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
// Set the right model, after checking that we don't already have it
if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
size = ArraySize(model_admin_human)
for (i = 0; i < size; i++)
{
ArrayGetString(model_admin_human, i, tempmodel, charsmax(tempmodel))
if (equal(currentmodel, tempmodel)) already_has_model = true
}
if (!already_has_model)
{
iRand = random_num(0, size - 1)
ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}
}
else
{
size = ArraySize(model_human)
for (i = 0; i < size; i++)
{
ArrayGetString(model_human, i, tempmodel, charsmax(tempmodel))
if (equal(currentmodel, tempmodel)) already_has_model = true
}
if (!already_has_model)
{
iRand = random_num(0, size - 1)
ArrayGetString(model_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_human, iRand))
}
}
// Need to change the model?
if (!already_has_model)
{
// An additional delay is offset at round start
// since SVC_BAD is more likely to be triggered there
if (g_newround)
set_task(5.0 * g_modelchange_delay, "fm_user_model_update", id+TASK_MODEL)
else
fm_user_model_update(id+TASK_MODEL)
}
// Remove glow
fm_set_rendering(id)
}
// Bots stuff
if (g_isbot[id])
{
// Turn off NVG for bots
cs_set_user_nvg(id, 0)
// Automatically buy extra items/weapons after first zombie is chosen
if (get_pcvar_num(cvar_extraitems))
{
if (g_newround) set_task(10.0 + get_pcvar_float(cvar_warmup), "bot_buy_extras", id+TASK_SPAWN)
else set_task(10.0, "bot_buy_extras", id+TASK_SPAWN)
}
}
// Enable spawn protection for humans spawning mid-round
if (!g_newround && get_pcvar_float(cvar_spawnprotection) > 0.0)
{
// Do not take damage
g_nodamage[id] = true
// Make temporarily invisible
set_pev(id, pev_effects, pev(id, pev_effects) | EF_NODRAW)
// Set task to remove it
set_task(get_pcvar_float(cvar_spawnprotection), "remove_spawn_protection", id+TASK_SPAWN)
}
// Set the flashlight charge task to update battery status
if (g_cached_customflash)
set_task(1.0, "flashlight_charge", id+TASK_CHARGE, _, _, "b")
// Replace weapon models (bugfix)
static weapon_ent
weapon_ent = fm_cs_get_current_weapon_ent(id)
if (pev_valid(weapon_ent)) replace_weapon_models(id, cs_get_weapon_id(weapon_ent))
// Last Zombie Check
fnCheckLastZombie()
}
改成
复制程式
public fw_PlayerSpawn_Post(id)
{
// Not alive or didn't join a team yet
if (!is_user_alive(id) || !fm_cs_get_user_team(id))
return;
// Player spawned
g_isalive[id] = true
// Remove previous tasks
remove_task(id+TASK_SPAWN)
remove_task(id+TASK_MODEL)
remove_task(id+TASK_BLOOD)
remove_task(id+TASK_AURA)
remove_task(id+TASK_BURN)
remove_task(id+TASK_CHARGE)
remove_task(id+TASK_FLASH)
remove_task(id+TASK_NVISION)
// Spawn at a random location?
if (get_pcvar_num(cvar_randspawn)) do_random_spawn(id)
// Hide money?
if (get_pcvar_num(cvar_removemoney))
set_task(0.4, "task_hide_money", id+TASK_SPAWN)
// Respawn player if he dies because of a worldspawn kill?
if (get_pcvar_num(cvar_respawnworldspawnkill))
set_task(2.0, "respawn_player_task", id+TASK_SPAWN)
// Spawn as zombie?
if (g_respawn_as_zombie[id] && !g_newround)
{
reset_vars(id, 0) // reset player vars
zombieme(id, 0, 0, 0, 0) // make him zombie right away
client_cmd(0,"spk ^"zombie_plague/zombi_comeback.wav^"")
return;
}
// Reset player vars
reset_vars(id, 0)
// Show custom buy menu?
if (get_pcvar_num(cvar_buycustom))
set_task(0.2, "show_menu_buy1", id+TASK_SPAWN)
// Set health and gravity
fm_set_user_health(id, get_pcvar_num(cvar_humanhp))
set_pev(id, pev_gravity, get_pcvar_float(cvar_humangravity))
// Switch to CT if spawning mid-round
if (!g_newround && fm_cs_get_user_team(id) != FM_CS_TEAM_CT) // need to change team?
{
remove_task(id+TASK_TEAM)
fm_cs_set_user_team(id, FM_CS_TEAM_CT)
fm_user_team_update(id)
}
// Custom models stuff
static currentmodel[32], tempmodel[32], already_has_model, i, iRand, size
already_has_model = false
if (g_handle_models_on_separate_ent)
{
// Set the right model
if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
iRand = random_num(0, ArraySize(model_admin_human) - 1)
ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}
else
{
iRand = random_num(0, ArraySize(model_human) - 1)
ArrayGetString(model_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_human, iRand))
}
// Set model on player model entity
fm_set_playermodel_ent(id)
// Remove glow on player model entity
fm_set_rendering(g_ent_playermodel[id])
}
else
{
// Get current model for comparing it with the current one
fm_cs_get_user_model(id, currentmodel, charsmax(currentmodel))
// Set the right model, after checking that we don't already have it
if (get_pcvar_num(cvar_adminmodelshuman) && (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MODELS]))
{
size = ArraySize(model_admin_human)
for (i = 0; i < size; i++)
{
ArrayGetString(model_admin_human, i, tempmodel, charsmax(tempmodel))
if (equal(currentmodel, tempmodel)) already_has_model = true
}
if (!already_has_model)
{
iRand = random_num(0, size - 1)
ArrayGetString(model_admin_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_admin_human, iRand))
}
}
else
{
size = ArraySize(model_human)
for (i = 0; i < size; i++)
{
ArrayGetString(model_human, i, tempmodel, charsmax(tempmodel))
if (equal(currentmodel, tempmodel)) already_has_model = true
}
if (!already_has_model)
{
iRand = random_num(0, size - 1)
ArrayGetString(model_human, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_human, iRand))
}
}
// Need to change the model?
if (!already_has_model)
{
// An additional delay is offset at round start
// since SVC_BAD is more likely to be triggered there
if (g_newround)
set_task(5.0 * g_modelchange_delay, "fm_user_model_update", id+TASK_MODEL)
else
fm_user_model_update(id+TASK_MODEL)
}
// Remove glow
fm_set_rendering(id)
}
// Bots stuff
if (g_isbot[id])
{
// Turn off NVG for bots
cs_set_user_nvg(id, 0)
// Automatically buy extra items/weapons after first zombie is chosen
if (get_pcvar_num(cvar_extraitems))
{
if (g_newround) set_task(10.0 + get_pcvar_float(cvar_warmup), "bot_buy_extras", id+TASK_SPAWN)
else set_task(10.0, "bot_buy_extras", id+TASK_SPAWN)
}
}
// Enable spawn protection for humans spawning mid-round
if (!g_newround && get_pcvar_float(cvar_spawnprotection) > 0.0)
{
// Do not take damage
g_nodamage[id] = true
// Make temporarily invisible
set_pev(id, pev_effects, pev(id, pev_effects) | EF_NODRAW)
// Set task to remove it
set_task(get_pcvar_float(cvar_spawnprotection), "remove_spawn_protection", id+TASK_SPAWN)
}
// Set the flashlight charge task to update battery status
if (g_cached_customflash)
set_task(1.0, "flashlight_charge", id+TASK_CHARGE, _, _, "b")
// Replace weapon models (bugfix)
static weapon_ent
weapon_ent = fm_cs_get_current_weapon_ent(id)
if (pev_valid(weapon_ent)) replace_weapon_models(id, cs_get_weapon_id(weapon_ent))
// Last Zombie Check
fnCheckLastZombie()
}
之后开启僵尸重生的方法跟0楼一样