AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Biohazard anti-dote (https://forums.alliedmods.net/showthread.php?t=249106)

Krtola 09-30-2014 09:33

Biohazard anti-dote
 
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
    } 



RateX 09-30-2014 11:08

Re: Biohazard anti-dote
 
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.

Krtola 09-30-2014 11:40

Re: Biohazard anti-dote
 
Quote:

Originally Posted by RateX (Post 2205281)
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?

RateX 09-30-2014 12:24

Re: Biohazard anti-dote
 
Yep, here's how:
PHP Code:

    new Players[32]
    new 
ts
    get_players
(Playersts"ae""TERRORIST"

ts will contain the number of zombies

yokomo 09-30-2014 13:37

Re: Biohazard anti-dote
 
You can use this, but i don't know much about biohazard native so just change it ok.

Code

RateX 10-01-2014 02:00

Re: Biohazard anti-dote
 
Quote:

Originally Posted by yokomo (Post 2205367)
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?

Krtola 10-01-2014 02:31

Re: Biohazard anti-dote
 
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)



yokomo 10-01-2014 02:53

Re: Biohazard anti-dote
 
Yes maybe.

Krtola 10-01-2014 03:24

Re: Biohazard anti-dote
 
I will try.
Thanks.


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

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