求救!如何在ZP4.1選中殭屍後出現提示訊息!!

Home Home
引用 | 編輯 j28489545
2008-12-28 13:34
樓主
推文 x0
小弟我想幫爬牆殭屍增加提示訊息...
也就是說 我變成爬牆殭屍後
會出現"住" 蹲下+跳就可以爬牆了"

#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <fakemeta_util>
#define STR_T 32
#define MAX_PLAYERS 32
// Climbing Zombie Atributes
new const zclass_name[] = { "爬牆殭屍" } // name
new const zclass_info[] = { "可以爬上牆壁的殭屍" } // description
new const zclass_model[] = { "zombie_source" } // model
new const zclass_clawmodel[] = { "v_knife_zombie2.mdl" } // claw model
const zclass_health = 1800 // health
const zclass_speed = 225 // speed
const Float:zclass_gravity = 1.0 // gravity
const Float:zclass_knockback = 0.7 // knockback

new g_zclass_climb
new cvar_speed, g_smoke, cvar_minillum, cvar_damage, cvar_delay, cvar_damagelight

new Float:g_wallorigin[33][3]
new Float:g_nextdmg[33]
new Float:g_shoottime[33]
public plugin_init() {        
 register_plugin("[ZP] Climbing Zombie","1.3","bipbip")
 cvar_speed = register_cvar("zp_climbingspeed", "80")
 cvar_minillum = register_cvar("zp_minlight", "10.0")
 cvar_damage = register_cvar("zp_lightdamage", "30.0")
 cvar_delay = register_cvar("zp_climbdelay", "0.3")
 cvar_damagelight = register_cvar("zp_damagebylight", "1")
 
 RegisterHam(Ham_Touch, "player", "cheese_player_touch", 1)
 RegisterHam(Ham_Player_PreThink, "player", "cheese_player_prethink", 1)
 RegisterHam(Ham_TakeDamage, "player", "cheese_takedamage", 1)
}
public plugin_precache() {
 g_zclass_climb = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
 g_smoke = precache_model( "sprites/steam1.spr" )
}

 // Check if the infected player is using our custom zombie class
 if (zp_register_zombie_class(id) == g_zclass_climb)
 {
  client_print(id,print_chat,"[嵐犬提醒您] "案住" 蹲下+跳就可以爬牆了!)
 }

 
public cheese_player_touch(id, world) {
 
 if(!is_user_alive(id))
  return HAM_IGNORED
 
 new classname[STR_T]
 pev(world, pev_classname, classname, (STR_T-1))
 
 if(equal(classname, "worldspawn") || equal(classname, "func_wall") || equal(classname, "func_breakable"))
  pev(id, pev_origin, g_wallorigin[id])
 return HAM_IGNORED 
 
}
public cheese_player_prethink(id) {
 // Player not alive or not zombie
 if(!is_user_alive(id) || !zp_get_user_zombie(id)) {
  return HAM_IGNORED
 }
 static Float:test ; pev(id, pev_light_level, test)
 
 // Player has not our zombie class or Nemesis
 if(zp_is_nemesis_round() || zp_get_user_zombie_class(id) != g_zclass_climb) {
  return HAM_IGNORED
 }
 static Float:origin[3]
 pev(id, pev_origin, origin)
 
 if (get_pcvar_num(cvar_damagelight)) {
  if (get_gametime() > g_nextdmg[id]) {
   static Float:lightlevel; pev(id,pev_light_level, lightlevel)
   
   if (lightlevel > get_pcvar_float(cvar_minillum)) {
    fm_fakedamage(id, "light", get_pcvar_float(cvar_damage), DMG_BURN)
    
    // do some smokes
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
    write_byte( TE_SMOKE )
    engfunc(EngFunc_WriteCoord, origin[ 0 ] )
    engfunc(EngFunc_WriteCoord, origin[ 1 ] )
    engfunc(EngFunc_WriteCoord, origin[ 2 ] )
    write_short( g_smoke )
    write_byte( 20 )
    write_byte( 10 )
    message_end()
    g_nextdmg[id] = get_gametime() + 1.0
   }
  }
 }
 // from Cheap_Suit's  Upgrades Mod eXtended
 static button ; button = pev(id, pev_button)
 if(button & IN_JUMP && button & IN_DUCK)
 {
  if(get_distance_f(origin, g_wallorigin[id]) > 10.0)
   return HAM_IGNORED
  
  if(pev(id, pev_flags) & FL_ONGROUND)
   return HAM_IGNORED
  
  if (get_gametime() < g_shoottime[id]) {
   return HAM_IGNORED
  }
  
  if(button & IN_FORWARD)
  {
   static Float:velocity[3]
   velocity_by_aim(id, get_pcvar_num(cvar_speed), velocity)
   fm_set_user_velocity(id, velocity)
  }
  else if(button & IN_BACK)
  {
   static Float:velocity[3]
   velocity_by_aim(id, -get_pcvar_num(cvar_speed), velocity)
   fm_set_user_velocity(id, velocity)
  }
 } 
 
 
 return HAM_IGNORED
}
public event_infect(victim, attacker) {
 g_nextdmg[victim] = 0.0
 g_shoottime[victim] = 0.0 
}
public cheese_takedamage(victim, inflictor, attacker, Float:damage, damagetype)
{
 if (is_user_alive(victim)) {
  if (zp_get_user_zombie_class(victim) != g_zclass_climb) {
   g_shoottime[victim] = get_gametime() + get_pcvar_float(cvar_delay);
  }
 }
 return HAM_IGNORED
}
/*
Float:getillumination(id) {
 static Float:i ; i = float(engfunc(EngFunc_GetEntityIllum, id))
 if (i > 75.0) i = 75.0
 return (100.0 * xs_sqrt(i / 75.0));
}*/

可是我改好後..將這個sma檔編譯...卻一直出錯!!


本帖包含附件
檔名: zip zp_climbingzombie.rar   (2022-06-09 14:07 / 2 KB)  
爬牆殭屍sma
下載次數:41


獻花 x0
引用 | 編輯 epic
2008-12-30 18:45
1樓
  
你试试把你红字的部份改为

public zp_user_infected_post(id, infector)
{
 if (zp_get_user_zombie_class(id) == g_zclass_climb)
  client_print(id, print_chat, "内容")
}

獻花 x0
引用 | 編輯 j28489545
2008-12-30 23:12
2樓
  
謝謝大大!! 表情

獻花 x0