Page 1 of 2

Antidote

Posted: 05 Mar 2018, 17:02
by Rain1153
Well i got this idea from jack's plugin "T-Virus".Given the credit to him :D
DESCRIPTION:-
The extra item is antidote. It is for zombies of course .Its a simple logic behind "use it to become human".
Installation and instruction
Just copy the code and compile in the compiler and install it like any other plugin after getting the amxx file :)




You don't need screenshots for antidote do you :P ?

CODE:-
  1. #include <zombie_escape>
  2.  
  3. new g_iAntidote, bool:g_bCanUse
  4.  
  5. public plugin_init()
  6. {
  7.     register_plugin("[ZE] Extra Item: Antidote", "1.1", "Rain1153/Jack GamePlay")
  8.     g_iAntidote = ze_register_item("Antidote", 30, 0)
  9. }
  10.  
  11. public ze_zombie_appear()
  12. {
  13.     g_bCanUse = false
  14. }
  15.  
  16. public ze_zombie_release()
  17. {
  18.     g_bCanUse = true
  19. }
  20.  
  21. public ze_select_item_pre(id, itemid, ignorecost)
  22. {
  23.     if (itemid != g_iAntidote)
  24.         return ZE_ITEM_AVAILABLE
  25.  
  26.     if (!ze_is_user_zombie(id))
  27.         return ZE_ITEM_DONT_SHOW
  28.  
  29.     if (!g_bCanUse || ze_get_zombies_number() <= 1)
  30.         return ZE_ITEM_UNAVAILABLE
  31.  
  32.     return ZE_ITEM_AVAILABLE
  33. }
  34.  
  35. public ze_select_item_post(id, itemid, ignorecost)
  36. {
  37.     if (itemid != g_iAntidote)
  38.         return
  39.  
  40.     new szName[32]
  41.     ze_set_user_human(id)
  42.     get_user_name(id, szName, charsmax(szName))
  43.     set_hudmessage(0, 255, 0, -0.05, -0.45, 1, 0.0, 5.0, 1.0, 1.0, -1)
  44.     show_hudmessage(0, "%s has used antidote!", szName)
  45. }

Re: Antidote

Posted: 05 Mar 2018, 17:39
by Raheem
Make nice posting style bro... This style make me :lol: btw, it's good idea.

Re: Antidote

Posted: 05 Mar 2018, 17:42
by Rain1153
Raheem wrote: 6 years ago Make nice posting style bro... This style make me :lol: btw, it's good idea.
Yeah next time :D

Re: Antidote

Posted: 06 Apr 2018, 16:15
by Night Fury
I edited your code. Now, it's clean. Re-edit the post.

Re: Antidote

Posted: 09 Apr 2018, 05:21
by Rain1153
Thanks jack

Re: Antidote

Posted: 27 Jun 2018, 18:08
by Spir0x
[mention]Jack GamePlay[/mention] bro check his code.

When i'm human i see it on extra-items menu. and when i'm zombie it will be hided. this item is for zombies not for humans.

how can i fix it ?

Code: Select all

#include <ze_vip>
 
 
#define VIP_ACCESS ADMIN_RCON
new g_iAntidote
 
public plugin_init()
{
  register_plugin("[ZE] Extra Item: Antidote", "1.0", "Spi")
  g_iAntidote = ze_register_item("Antidote \w[\rOWNER\w]", 1, 0)
}
 
public ze_select_item_pre(id, itemid, ignorecost)
{
  if (itemid != g_iAntidote)
    return ZE_ITEM_UNAVAILABLE
 
    // Available for Humans only, So don't show it for zombies
  if (!ze_is_user_zombie(id))
    return ZE_ITEM_DONT_SHOW
    
    // Player not owner ?
  if (get_user_flags(id) & VIP_ACCESS)
    return ZE_ITEM_DONT_SHOW
 
  return ZE_ITEM_AVAILABLE
}
 
public ze_select_item_post(id, itemid, ignorecost)
{
  if (itemid != g_iAntidote)
    return
 
  new szName[32]
  ze_set_user_human(id)
  get_user_name(id, szName, charsmax(szName))
  set_hudmessage(0, 0, 255, -0.05, -0.45, 1, 0.0, 5.0, 1.0, 1.0, -1)
  show_hudmessage(0, "%s has used antidote!", szName)
}
 

Re: Antidote

Posted: 27 Jun 2018, 18:34
by SexY DeviL CJ
Bro u are not showing this extra for zombies check on line 18 its used when you make extra item only for humans did u got me ? I guess should use
if_user_alive(id)

Re: Antidote

Posted: 27 Jun 2018, 18:39
by Spir0x
See this bro not correct ?

// Available for Zombies only, So don't show it for Humans
if (!ze_is_user_zombie(id))
return ZE_ITEM_DONT_SHOW

Re: Antidote

Posted: 27 Jun 2018, 18:55
by Night Fury
Your code is fine.

Re: Antidote

Posted: 27 Jun 2018, 18:59
by Spir0x
Where bro. i see it on extra menu 3. Antidote when i'm human. and when i'm as zombie i see only madness i dont see anti dote.

Re: Antidote

Posted: 28 Jun 2018, 19:18
by Night Fury
Spir0x wrote: 5 years ago Where bro. i see it on extra menu 3. Antidote when i'm human. and when i'm as zombie i see only madness i dont see anti dote.
Try to change this

Code: Select all

// Player not owner ?
  if (get_user_flags(id) & VIP_ACCESS)
    return ZE_ITEM_DONT_SHOW
to this

Code: Select all

// Player not owner ?
  if (!(get_user_flags(id) & VIP_ACCESS))
    return ZE_ITEM_DONT_SHOW

Re: Antidote

Posted: 04 Jul 2018, 21:39
by Spir0x
ok. this code miss some optimizations. when i set this plugin active all items on the Extra-items menu will be transparent like i have no escape coins and i cant buy anything only antidote from all the extra items. and when i use it nightvision still working. thanks

Re: Antidote

Posted: 04 Jul 2018, 21:48
by Night Fury
Found the problem!
Edit this:

Code: Select all

if (itemid != g_iAntidote)
    return ZE_ITEM_UNAVAILABLE
To this:

Code: Select all

if (itemid != g_iAntidote)
    return ZE_ITEM_AVAILABLE

Re: Antidote

Posted: 04 Jul 2018, 21:49
by Night Fury
*BUMB*

Re: Antidote

Posted: 05 Jul 2018, 00:03
by Spir0x
Ok, it's too late now i'll test it tomorrow and what about fixing nightvision when using antidote.

Re: Antidote

Posted: 05 Jul 2018, 02:45
by Rain1153
:lol:

Re: Antidote

Posted: 05 Jul 2018, 02:46
by Rain1153
Well you can off it when u were zombie by pressing N ( in a simple term)

Re: Antidote

Posted: 05 Jul 2018, 02:47
by Rain1153
And just take the antidote you'll be fine

Re: Antidote

Posted: 06 Jul 2018, 19:05
by Spir0x
And why ? you just need to fix and update your plugin.

Re: Antidote

Posted: 03 Nov 2018, 16:32
by DarkZombie
During the game's preparation period, if someone uses it then the game will be buggy. That someone fix it?