Solved ZE Class Heal

Coding Help/Re-API Supported
Post Reply
Templaso
Senior Member
Senior Member
Romania
Posts: 119
Joined: 5 years ago
Location: Bucharest
Contact:

ZE Class Heal

#1

Post by Templaso » 4 years ago

  1. #include <zombie_escape>
  2. #include <ze_zombie_class>
  3.  
  4. native ze_is_user_nemesis(id)
  5.  
  6. #define heal_sound      "heal.wav"
  7.  
  8. new const zclass_name[] = "| Shaman |"
  9. new const zclass_info[] = ">> Restore his health <<"
  10. new const zclass_model[] = "heal"
  11. new const zclass_clawmodel[] = "v_heal_knife.mdl"
  12. const zclass_health = 20000
  13. const zclass_speed = 300
  14. const Float:zclass_gravity = 860
  15. const Float:zclass_knockback = 0.0
  16.  
  17. new g_zclass_heal;
  18. new Float:last_use[33];
  19.  
  20. #define USE_SHAMAN_MODEL
  21.  
  22. new const ZE_SETTING_FILE[] = "zombie_escape.ini"
  23.  
  24. #if defined USE_SHAMAN_MODEL
  25. // Default models
  26. new const g_szModels_Shaman_Player[][] = { "zombie_shaman" }
  27. new const g_szModels_Shaman_Claws[][] = { "models/zombie_escape/v_knife_shaman.mdl" }
  28.  
  29. new Array:g_aModels_Shaman_Player,
  30.     Array:g_aModels_Shaman_Claws
  31. #endif
  32.  
  33. public plugin_init()
  34. {
  35.     register_plugin("[ZP] Zombie Class: Heal Zombie", "0.1", "WPMG Team")
  36.     register_clcmd("drop", "use_skill")
  37. }
  38.  
  39. public plugin_precache()
  40. {
  41.     g_zclass_heal = ze_register_zombie_class(zclass_name, zclass_info, zclass_health, zclass_speed, zclass_gravity)
  42.  
  43.     precache_sound(heal_sound)
  44.  
  45.         new iIndex
  46.         #if defined USE_SHAMAN_MODEL
  47.         // Initialize arrays
  48.         g_aModels_Shaman_Player = ArrayCreate(32, 1)
  49.         g_aModels_Shaman_Claws = ArrayCreate(64, 1)
  50.        
  51.         // Load from external file
  52.         amx_load_setting_string_arr(ZE_SETTING_FILE, "Player Models", "SHAMAN MODEL", g_aModels_Shaman_Player)
  53.         amx_load_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE SHAMAN", g_aModels_Shaman_Claws)
  54.        
  55.         // If we couldn't load from file, use and save default ones
  56.         if (ArraySize(g_aModels_Shaman_Player) == 0)
  57.         {
  58.             for (iIndex = 0; iIndex < sizeof g_szModels_Shaman_Player; iIndex++)
  59.                 ArrayPushString(g_aModels_Shaman_Player, g_szModels_Shaman_Player[iIndex])
  60.            
  61.             // Save to external file
  62.             amx_save_setting_string_arr(ZE_SETTING_FILE, "Player Models", "SHAMAN", g_aModels_Shaman_Player)
  63.         }
  64.  
  65.         if (ArraySize(g_aModels_Shaman_Claws) == 0)
  66.         {
  67.             for (iIndex = 0; iIndex < sizeof g_szModels_Shaman_Claws; iIndex++)
  68.                 ArrayPushString(g_aModels_Shaman_Claws, g_szModels_Shaman_Claws[iIndex])
  69.            
  70.             // Save to external file
  71.             amx_save_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE SHAMAN", g_aModels_Shaman_Claws)
  72.         }
  73.        
  74.         // Precache models
  75.         new player_model[32], model[64], model_path[128]
  76.  
  77.         for (iIndex = 0; iIndex < ArraySize(g_aModels_Shaman_Player); iIndex++)
  78.         {
  79.             ArrayGetString(g_aModels_Shaman_Player, iIndex, player_model, charsmax(player_model))
  80.             formatex(model_path, charsmax(model_path), "models/player/%s/%s.mdl", player_model, player_model)
  81.             precache_model(model_path)
  82.             // Support modelT.mdl files
  83.             formatex(model_path, charsmax(model_path), "models/player/%s/%sT.mdl", player_model, player_model)
  84.             if (file_exists(model_path)) precache_model(model_path)
  85.         }
  86.  
  87.         for (iIndex = 0; iIndex < ArraySize(g_aModels_Shaman_Claws); iIndex++)
  88.         {
  89.             ArrayGetString(g_aModels_Shaman_Claws, iIndex, model, charsmax(model))
  90.             precache_model(model)
  91.         }
  92.     #endif
  93. }
  94.  
  95. public ze_user_infected(id, infector)
  96. {
  97.     if(ze_get_current_zombie_class(id) == g_zclass_heal)
  98.     {
  99.         last_use[id] = 0.0
  100.     }
  101.  
  102.         #if defined USE_SHAMAN_MODEL
  103.         new szPlayerModel[32], szModel[64]
  104.         ArrayGetString(g_aModels_Shaman_Player, random_num(0, ArraySize(g_aModels_Shaman_Player) - 1), szPlayerModel, charsmax(szPlayerModel))
  105.         rg_set_user_model(id, szPlayerModel)
  106.  
  107.         ArrayGetString(g_aModels_Shaman_Claws, random_num(0, ArraySize(g_aModels_Shaman_Claws) - 1), szModel, charsmax(szModel))
  108.         cs_set_player_view_model(id, CSW_KNIFE, szModel)
  109.     #endif
  110. }
  111.  
  112. public use_skill(id)
  113. {
  114.     if(is_user_alive(id) && !ze_is_user_nemesis(id) && ze_is_user_zombie(id) && (ze_get_current_zombie_class(id) == g_zclass_heal))
  115.     {
  116.         if((pev(id, pev_health) < float(ze_get_zombie_class_health(id)) && (last_use[id] + 20.0 <= get_gametime()))
  117.         {  
  118.                         last_use[id] = get_gametime();
  119.        
  120.             set_pev(id, pev_health, float(ze_get_zombie_class_health(id)))
  121.             emit_sound(id, CHAN_ITEM, heal_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  122.  
  123.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), { 0, 0, 0 }, id)
  124.             write_short(1<<10)
  125.             write_short(1<<12)
  126.             write_short(0x0000)
  127.             write_byte(50)
  128.             write_byte(150)
  129.             write_byte(50)
  130.             write_byte(200)
  131.             message_end()
  132.  
  133.             return PLUGIN_HANDLED;
  134.         }
  135.     }
  136.     return PLUGIN_CONTINUE;
  137. }
  138.  
  139. stock client_printcolor(const id, const input[], any:...)
  140. {
  141.     new iCount = 1, iPlayers[32]
  142.     static szMsg[191]
  143.  
  144.     vformat(szMsg, charsmax(szMsg), input, 3)
  145.     replace_all(szMsg, 190, "/g", "^4")
  146.     replace_all(szMsg, 190, "/y", "^1")
  147.     replace_all(szMsg, 190, "/t", "^3")
  148.     replace_all(szMsg, 190, "/w", "^0")
  149.  
  150.     if(id) iPlayers[0] = id
  151.     else get_players(iPlayers, iCount, "ch")
  152.  
  153.     for(new i = 0; i < iCount; i++)
  154.     {
  155.         if(is_user_connected(iPlayers[i]))
  156.         {
  157.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i])
  158.             write_byte(iPlayers[i])
  159.             write_string(szMsg)
  160.             message_end()
  161.         }
  162.     }
  163. }





ze_heal_zombie.sma(116) : error 088: number of arguments does not match definition
ze_heal_zombie.sma(120) : error 088: number of arguments does not match definition

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#2

Post by Night Fury » 4 years ago

ze_get_zombie_class_health(ze_get_current_zombie_class(id))
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

Templaso
Senior Member
Senior Member
Romania
Posts: 119
Joined: 5 years ago
Location: Bucharest
Contact:

#3

Post by Templaso » 4 years ago

Same error

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#4

Post by Night Fury » 4 years ago

ze_get_zombie_class_health(id, ze_get_current_zombie_class(id))
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

Templaso
Senior Member
Senior Member
Romania
Posts: 119
Joined: 5 years ago
Location: Bucharest
Contact:

#5

Post by Templaso » 4 years ago

Fixed

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 4 guests