陳維亨
|
分享:
▲
▼
敢請大大幫我察看哪裡出了問題? 拜託!拜託! humanme(id, survivor, silentmode) { // User humanize attempt forward ExecuteForward(g_fwUserHumanize_attempt, g_fwDummyResult, id, survivor) // One or more plugins blocked the "humanization". Only allow this after making sure it's // not going to leave us with no humans. Take into account a last player leaving case. // BUGFIX: only allow after a mode has started, to prevent blocking first survivor e.g. if (g_fwDummyResult >= ZP_PLUGIN_HANDLED && g_modestarted && fnGetHumans() > g_lastplayerleaving) return; // Pre user humanize forward ExecuteForward(g_fwUserHumanized_pre, g_fwDummyResult, id, survivor) // Remove previous tasks remove_task(id+TASK_MODEL) remove_task(id+TASK_BLOOD) remove_task(id+TASK_AURA) remove_task(id+TASK_BURN) remove_task(id+TASK_NVISION) // Reset some vars g_zombie[id] = false g_nemesis[id] = false g_survivor[id] = false g_firstzombie[id] = false g_canbuy[id] = true g_nvision[id] = false g_nvisionenabled[id] = false // Remove survivor's aura (bugfix) set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_BRIGHTLIGHT) // Remove spawn protection (bugfix) g_nodamage[id] = false set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_NODRAW) // Reset burning duration counter (bugfix) g_burning_duration[id] = 0 // Drop previous weapons drop_weapons(id, 1) drop_weapons(id, 2) // Strip off from weapons fm_strip_user_weapons(id) fm_give_item(id, "weapon_knife") // Set human attributes based on the mode if (survivor) { // Survivor g_survivor[id] = true // Set Health [0 = auto] if (get_pcvar_num(cvar_survhp) == 0) { if (get_pcvar_num(cvar_survbasehp) == 0) fm_set_user_health(id, get_pcvar_num(cvar_humanhp) * fnGetAlive()) else fm_set_user_health(id, get_pcvar_num(cvar_survbasehp) * fnGetAlive()) } else fm_set_user_health(id, get_pcvar_num(cvar_survhp)) // Set gravity, unless frozen if (!g_frozen[id]) set_pev(id, pev_gravity, get_pcvar_float(cvar_survgravity)) // Give survivor his own weapon static survweapon[32] get_pcvar_string(cvar_survweapon, survweapon, charsmax(survweapon)) fm_give_item(id, survweapon) ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[cs_weapon_name_to_id(survweapon)], AMMOTYPE[cs_weapon_name_to_id(survweapon)], MAXBPAMMO[cs_weapon_name_to_id(survweapon)]) // Turn off his flashlight turn_off_flashlight(id) // Give the survivor a bright light if (get_pcvar_num(cvar_survaura)) set_pev(id, pev_effects, pev(id, pev_effects) | EF_BRIGHTLIGHT) // Survivor bots will also need nightvision to see in the dark if (g_isbot[id]) { g_nvision[id] = true cs_set_user_nvg(id, 1) } }
|
|
x0
[2 樓]
From:臺灣中華電信股份有限公司 | Posted:2013-12-26 01:35 |
|
|
a7811311622
我…在工作了…
級別: 版主
版區: CS提問區
x771
x2152
|
分享:
▲
▼
下面是引用 陳維亨 於 2013-12-26 01:35 發表的 : 敢請大大幫我察看哪裡出了問題? 拜託!拜託! humanme(id, survivor, silentmode) { // User humanize attempt forward ....... 別說這就是全部的內容… 如果真的是…這段根本殘廢了… 我手邊一個乾淨(姑且是?)的ZP4.3源碼是這樣: 複製程式
// Function Human Me (player id, turn into a survivor, silent mode)
humanme(id, survivor, silentmode)
{
// User humanize attempt forward
ExecuteForward(g_fwUserHumanize_attempt, g_fwDummyResult, id, survivor)
// One or more plugins blocked the "humanization". Only allow this after making sure it's
// not going to leave us with no humans. Take into account a last player leaving case.
// BUGFIX: only allow after a mode has started, to prevent blocking first survivor e.g.
if (g_fwDummyResult >= ZP_PLUGIN_HANDLED && g_modestarted && fnGetHumans() > g_lastplayerleaving)
return;
// Pre user humanize forward
ExecuteForward(g_fwUserHumanized_pre, g_fwDummyResult, id, survivor)
// Remove previous tasks
remove_task(id+TASK_MODEL)
remove_task(id+TASK_BLOOD)
remove_task(id+TASK_AURA)
remove_task(id+TASK_BURN)
remove_task(id+TASK_NVISION)
// Reset some vars
g_zombie[id] = false
g_nemesis[id] = false
g_survivor[id] = false
g_firstzombie[id] = false
g_canbuy[id] = true
g_nvision[id] = false
g_nvisionenabled[id] = false
// Remove survivor's aura (bugfix)
set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_BRIGHTLIGHT)
// Remove spawn protection (bugfix)
g_nodamage[id] = false
set_pev(id, pev_effects, pev(id, pev_effects) &~ EF_NODRAW)
// Reset burning duration counter (bugfix)
g_burning_duration[id] = 0
// Drop previous weapons
drop_weapons(id, 1)
drop_weapons(id, 2)
// Strip off from weapons
fm_strip_user_weapons(id)
fm_give_item(id, "weapon_knife")
// Set human attributes based on the mode
if (survivor)
{
// Survivor
g_survivor[id] = true
// Set Health [0 = auto]
if (get_pcvar_num(cvar_survhp) == 0)
{
if (get_pcvar_num(cvar_survbasehp) == 0)
fm_set_user_health(id, get_pcvar_num(cvar_humanhp) * fnGetAlive())
else
fm_set_user_health(id, get_pcvar_num(cvar_survbasehp) * fnGetAlive())
}
else
fm_set_user_health(id, get_pcvar_num(cvar_survhp))
// Set gravity, unless frozen
if (!g_frozen[id]) set_pev(id, pev_gravity, get_pcvar_float(cvar_survgravity))
// Give survivor his own weapon
static survweapon[32]
get_pcvar_string(cvar_survweapon, survweapon, charsmax(survweapon))
fm_give_item(id, survweapon)
ExecuteHamB(Ham_GiveAmmo, id, MAXBPAMMO[cs_weapon_name_to_id(survweapon)], AMMOTYPE[cs_weapon_name_to_id(survweapon)], MAXBPAMMO[cs_weapon_name_to_id(survweapon)])
// Turn off his flashlight
turn_off_flashlight(id)
// Give the survivor a bright light
if (get_pcvar_num(cvar_survaura)) set_pev(id, pev_effects, pev(id, pev_effects) | EF_BRIGHTLIGHT)
// Survivor bots will also need nightvision to see in the dark
if (g_isbot[id])
{
g_nvision[id] = true
cs_set_user_nvg(id, 1)
}
}
else
{
// Human taking an antidote
// Set health
fm_set_user_health(id, get_pcvar_num(cvar_humanhp))
// Set gravity, unless frozen
if (!g_frozen[id]) set_pev(id, pev_gravity, get_pcvar_float(cvar_humangravity))
// Show custom buy menu?
if (get_pcvar_num(cvar_buycustom))
set_task(0.2, "show_menu_buy1", id+TASK_SPAWN)
// Silent mode = no HUD messages, no antidote sound
if (!silentmode)
{
// Antidote sound
static sound[64]
ArrayGetString(sound_antidote, random_num(0, ArraySize(sound_antidote) - 1), sound, charsmax(sound))
emit_sound(id, CHAN_ITEM, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Show Antidote HUD notice
set_hudmessage(0, 0, 255, HUD_INFECT_X, HUD_INFECT_Y, 0, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "NOTICE_ANTIDOTE", g_playername[id])
}
}
// Switch to CT
if (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 (g_survivor[id])
{
iRand = random_num(0, ArraySize(model_survivor) - 1)
ArrayGetString(model_survivor, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_survivor, iRand))
}
else
{
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)
// Set survivor glow / remove glow on player model entity, unless frozen
if (!g_frozen[id])
{
if (g_survivor[id] && get_pcvar_num(cvar_survglow))
fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25)
else
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 (g_survivor[id])
{
size = ArraySize(model_survivor)
for (i = 0; i < size; i++)
{
ArrayGetString(model_survivor, i, tempmodel, charsmax(tempmodel))
if (equal(currentmodel, tempmodel)) already_has_model = true
}
if (!already_has_model)
{
iRand = random_num(0, size - 1)
ArrayGetString(model_survivor, iRand, g_playermodel[id], charsmax(g_playermodel[]))
if (g_set_modelindex_offset) fm_cs_set_user_model_index(id, ArrayGetCell(g_modelindex_survivor, iRand))
}
}
else
{
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)
}
// Set survivor glow / remove glow, unless frozen
if (!g_frozen[id])
{
if (g_survivor[id] && get_pcvar_num(cvar_survglow))
fm_set_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25)
else
fm_set_rendering(id)
}
}
// Restore FOV?
if (get_pcvar_num(cvar_zombiefov) != 90 && get_pcvar_num(cvar_zombiefov) != 0)
{
message_begin(MSG_ONE, g_msgSetFOV, _, id)
write_byte(90) // angle
message_end()
}
// Disable nightvision
if (g_isbot[id]) cs_set_user_nvg(id, 0)
else if (!get_pcvar_num(cvar_customnvg) && g_nvisionenabled[id]) set_user_gnvision(id, 0)
// Post user humanize forward
ExecuteForward(g_fwUserHumanized_post, g_fwDummyResult, id, survivor)
// Last Zombie Check
fnCheckLastZombie()
}
|
|
x0
[3 樓]
From:臺灣中華電信股份有限公司 | Posted:2013-12-26 10:22 |
|
|
|