Raised This Month: $ Target: $400
 0% 

Biohazard anti-dote


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 09-30-2014 , 09:33   Biohazard anti-dote
Reply With Quote #1

How to make this a extra item (feel free to use ZP natives,I will edit for biohazard) and how to set that can be purchased only if have more than 3 zombies alive??

PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <biohazard> 

#if !defined _biohazard_included 
        #assert Biohazard functions file required! 
#endif 

#define PLUGIN "biohazard Zombie Antidote" 
#define VERSION "1.0" 
#define AUTHOR "ds811888" 

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    if(!
is_biomod_active()) pause("ad"
    
register_clcmd("say /antidote""infect_antidote"


public 
infect_antidote(id

    if(!
is_user_alive(id) && !is_user_zombie(id)) 
        return; 
     
    new 
money cs_get_user_money(id
    new 
cost 5000 

    
if(money <= cost
    { 
        
client_print(idprint_center"You need 5000$ to buy an antidote!"
    } 
    else 
    { 
        
cs_set_user_money(idmoney cost)   
        
client_print(idprint_center"You have used an antidote!"
        
cs_set_user_team(idCS_TEAM_CT)
        
cure_user(id
    } 


Last edited by Krtola; 09-30-2014 at 09:36.
Krtola is offline
Send a message via Skype™ to Krtola
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 09-30-2014 , 11:08   Re: Biohazard anti-dote
Reply With Quote #2

Simple, add a new var like "g_itemid_antidote", then add this in plugin_init:
PHP Code:
g_itemid_antidote zp_register_extra_item("Antidote"40ZP_TEAM_HUMAN
After that, add:
PHP Code:
public zp_extra_item_selected(iditemid)
{
    if(
itemid != g_itemid_antidote || zp_get_zombie_count() <= 3)
        return

    
infect_antidote(id)

And for the cure_user part, take a look at zp source code.
RateX is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 09-30-2014 , 11:40   Re: Biohazard anti-dote
Reply With Quote #3

Quote:
Originally Posted by RateX View Post
Simple, add a new var like "g_itemid_antidote", then add this in plugin_init:
PHP Code:
g_itemid_antidote zp_register_extra_item("Antidote"40ZP_TEAM_HUMAN
After that, add:
PHP Code:
public zp_extra_item_selected(iditemid)
{
    if(
itemid != g_itemid_antidote || zp_get_zombie_count() <= 3)
        return

    
infect_antidote(id)

And for the cure_user part, take a look at zp source code.
The problem is I can not use zp_get_zombie_count() <= 3) or any other zombie count in my biohazard mod. Maybe we can check TS team?

Last edited by Krtola; 09-30-2014 at 11:41.
Krtola is offline
Send a message via Skype™ to Krtola
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 09-30-2014 , 12:24   Re: Biohazard anti-dote
Reply With Quote #4

Yep, here's how:
PHP Code:
    new Players[32]
    new 
ts
    get_players
(Playersts"ae""TERRORIST"
ts will contain the number of zombies
RateX is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 09-30-2014 , 13:37   Re: Biohazard anti-dote
Reply With Quote #5

You can use this, but i don't know much about biohazard native so just change it ok.

Code
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 09-30-2014 at 13:38. Reason: Some fix :)
yokomo is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 10-01-2014 , 02:00   Re: Biohazard anti-dote
Reply With Quote #6

Quote:
Originally Posted by yokomo View Post
You can use this, but i don't know much about biohazard native so just change it ok.

Code
Isn't a zombie in T team already?
RateX is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 10-01-2014 , 02:31   Re: Biohazard anti-dote
Reply With Quote #7

Ok yokomo version seems to work.

Is this the correct way of creating extra item?


PHP Code:
public bh_extra_item_selected(iditemid)
{
    if(
itemid != g_itemid_antidote || FnGetAliveZombies() <= MIN_ZOMBIE)
        return

    
infect_antidote(id)

Krtola is offline
Send a message via Skype™ to Krtola
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-01-2014 , 02:53   Re: Biohazard anti-dote
Reply With Quote #8

Yes maybe.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 10-01-2014 , 03:24   Re: Biohazard anti-dote
Reply With Quote #9

I will try.
Thanks.
Krtola is offline
Send a message via Skype™ to Krtola
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode