Quote:
Originally Posted by jc980
JUST POST THE GODDAMN CODE!!!!!!!!!!! OF INVISO ZOMBIE!!!!!!!!
|
Im Just Got "Three sections of jump" Code
PHP Code:
CVARS:
zp_tight_jump 4 (Default)
*/
#include <amxmodx>
#include <engine>
#include <zombieplague>
#define SUPPORT_BOT_TO_USE
#if defined SUPPORT_BOT_TO_USE
new Float:bot_jump_time[33], Float:bot_jump_wait_time[33]
#endif
// Tight Zombie Atributes
new const zclass_name[] = { "多重跳殭屍" } // 喪屍名字
new const zclass_info[] = { "使用多重跳" } // 喪屍說明
new const zclass_model[] = { "zombie_resident" } // 喪屍模型
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" } // 爪的模型
const zclass_health = 1800 // 血量
const zclass_speed = 250 // 速度
const Float:zclass_gravity = 1.0 // 重力
const Float:zclass_knockback = 1.25 // 擊退
new g_zclass_tight
new jumpznum[33]
new bool:dozjump[33] = false
new jump_count_num[33]
new cvar_jumps, cvar_max_jumps
new maxplayers
public plugin_init()
{
register_plugin("[ZP] Class:Tight", "1.0c", "http://cs.unethost.com")
cvar_jumps = register_cvar("zp_tight_jumps", "2") // 使用多段跳時,繼續連跳的最大次數
cvar_max_jumps = register_cvar("zp_tight_max_jumps", "0") // 單一回合能使用多段跳的可用次數 (設定成 0 代表不限制次數)
register_event("ResetHUD","NewRound","be")
register_event("DeathMsg", "Death", "a")
maxplayers = get_maxplayers()
}
public plugin_precache()
{
g_zclass_tight = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
}
public zp_user_infected_post(id, infector)
{
// Check if the infected player is using our custom zombie class
if (zp_get_user_zombie_class(id) == g_zclass_tight)
{
client_print(id, print_chat, "[殭屍功能提示] 您能使用%d次多重跳!", get_pcvar_num(cvar_jumps))
}
}
public zp_user_humanized_post(id)
{
jumpznum[id] = 0
dozjump[id] = false
jump_count_num[id] = get_pcvar_num(cvar_max_jumps)
}
public client_putinserver(id)
{
jumpznum[id] = 0
dozjump[id] = false
jump_count_num[id] = get_pcvar_num(cvar_max_jumps)
}
public client_disconnect(id)
{
jumpznum[id] = 0
dozjump[id] = false
jump_count_num[id] = get_pcvar_num(cvar_max_jumps)
}
public NewRound(id)
{
jumpznum[id] = 0
dozjump[id] = false
jump_count_num[id] = get_pcvar_num(cvar_max_jumps)
}
public Death()
{
new player = read_data(2)
if ((player <= 0) || (player > maxplayers))
return;
jumpznum[player] = 0
dozjump[player] = false
jump_count_num[player] = get_pcvar_num(cvar_max_jumps)
}
public client_PreThink(id)
{
if(!is_user_alive(id))
return PLUGIN_CONTINUE
if (zp_get_user_nemesis(id))
return PLUGIN_CONTINUE
if(!zp_get_user_zombie(id) || (zp_get_user_zombie_class(id) != g_zclass_tight))
return PLUGIN_CONTINUE
if (get_pcvar_num(cvar_max_jumps) > 0)
{
show_message_center(id, "[多重跳次數剩餘:%d]", jump_count_num[id])
if (jump_count_num[id] <= 0)
return PLUGIN_CONTINUE
}
new nzbut = get_user_button(id)
new ozbut = get_user_oldbutton(id)
#if defined SUPPORT_BOT_TO_USE
if (is_user_bot(id))
{
if ((nzbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
{
jumpznum[id] = random_num(1, get_pcvar_num(cvar_jumps))
bot_jump_time[id] = get_gametime()
bot_jump_wait_time[id] = float(0)
}
if (jumpznum[id]>0)
{
if (get_gametime() - bot_jump_time[id] >= bot_jump_wait_time[id])
{
dozjump[id] = true
jumpznum[id]--
if (get_pcvar_num(cvar_max_jumps) > 0)
{
jump_count_num[id]--
if (jump_count_num[id] <= 0)
return PLUGIN_CONTINUE
}
bot_jump_wait_time[id] = random_float(0.4, 1.2)
bot_jump_time[id] = get_gametime()
return PLUGIN_CONTINUE
}
}
if (get_entity_flags(id) & FL_ONGROUND)
jumpznum[id] = 0
return PLUGIN_CONTINUE
}
#endif
if((nzbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(ozbut & IN_JUMP))
{
if (jumpznum[id] < get_pcvar_num(cvar_jumps))
{
dozjump[id] = true
jumpznum[id]++
if (get_pcvar_num(cvar_max_jumps) > 0)
{
jump_count_num[id]--
if (jump_count_num[id] <= 0)
client_print(id, print_center, "[您已用完多重跳次數]")
}
return PLUGIN_CONTINUE
}
}
if((nzbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
{
jumpznum[id] = 0
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
if(!is_user_alive(id))
return PLUGIN_CONTINUE
if (zp_get_user_nemesis(id))
return PLUGIN_CONTINUE
if(!zp_get_user_zombie(id) || (zp_get_user_zombie_class(id) != g_zclass_tight))
return PLUGIN_CONTINUE
if(dozjump[id] == true)
{
new Float:vezlocityz[3]
entity_get_vector(id, EV_VEC_velocity, vezlocityz)
vezlocityz[2] = random_float(265.0, 285.0)
entity_set_vector(id, EV_VEC_velocity, vezlocityz)
dozjump[id] = false
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
show_message_center(target, const message[], any:...)
{
new buffer[256]
vformat(buffer, sizeof buffer - 1, message, 3)
message_begin(MSG_ONE, get_user_msgid("StatusText"), {0, 0, 0}, target)
write_byte(0)
write_string(buffer)
message_end()
}