Raised This Month: $ Target: $400
 0% 

T-Virus Antidote


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 05-08-2009 , 17:29   T-Virus Antidote
Reply With Quote #1

PHP Code:
/* Plugin generated by Emilioneri */

#include <amxmodx>
#include <amxmisc>
#include <biohazard>
#include <cstrike>

#define PLUGIN "T-Virus Antidote"
#define VERSION "1.0"
#define AUTHOR "Emilioneri"

new g_Cost


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
g_Cost register_cvar("amx_antidotecost""5000")
    
register_clcmd("say /antidote""cmd_antidote")
    
register_logevent("Event_Round_Start"2"1=Round_Start")
}

public 
Event_Round_Start()
{
    
client_print(0print_chat"To buy an Antidote type in chat: /antidote")
}

public 
cmd_antidote(id)
{       
    if(!
is_user_alive(id))
    {
        
client_print(idprint_chat"You can't buy an antidote while you are dead!")
    }
    
    if(!
is_user_zombie(id))
    {
        
client_print(idprint_chat"You can't buy an antidote, because you are a human")
    }
    
    new 
iMoney cs_get_user_money(id)
    new 
iCost get_pcvar_num(g_Cost)
    
    if(
iMoney >= iCost)
    {
        
cs_set_user_money(idiMoney iCost)
        
cure_user(id)
        
client_print(idprint_chat"You have used an antidote")
    }
    else
    {
        
client_print(idprint_chat"You don't have enaugh moeny! $%i needed!"iCost)
    }

I've got 2 questions:
1. Why this code doesn't work
2. Why is "cs_get_user_money" useless And what way Biohazard uses to set money
3. +k who will help me!
__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 05-09-2009 , 07:53   Re: T-Virus Antidote
Reply With Quote #2

You have to return a value in that if statement. If you do that, the rest of the code won't be executed.

Code:
if(!is_user_alive(id)) 
    { 
        client_print(id, print_chat, "You can't buy an antidote while you are dead!");
        return PLUGIN_HANDLED;
    }



Biohazard uses fakemeta to retreive & set a player's amount of money. Cstrike is faster than fm, so your method is fine.

__________________

anakin_cstrike is offline
Old 05-09-2009, 12:04
Emilioneri
This message has been deleted by Emilioneri.
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 05-09-2009 , 12:06   Re: T-Virus Antidote
Reply With Quote #4

so, this code will work
PHP Code:
/* Plugin generated by Emilioneri */

#include <amxmodx>
#include <amxmisc>
#include <biohazard>
#include <cstrike>

#define PLUGIN "T-Virus Antidote"
#define VERSION "1.0"
#define AUTHOR "Emilioneri"

new g_Cost


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
g_Cost register_cvar("amx_antidotecost""5000")
    
register_clcmd("say /antidote""cmd_antidote")
    
register_logevent("Event_Round_Start"2"1=Round_Start")
}

public 
Event_Round_Start()
{
    
client_print(0print_chat"To buy an Antidote type in chat: /antidote")
}

public 
cmd_antidote(id)
{       
    if(!
is_user_alive(id))
    {
        
client_print(idprint_chat"You can't buy an antidote while you are dead!");
        return 
PLUGIN_HANDLED;
    }
    
    if(!
is_user_zombie(id))
    {
        
client_print(idprint_chat"You can't buy an antidote, because you are a human");
        return 
PLUGIN_HANDLED;
    }
    
    new 
iMoney cs_get_user_money(id)
    new 
iCost get_pcvar_num(g_Cost)
    
    if(
iMoney >= iCost)
    {
        
cs_set_user_money(idiMoney iCost)
        
cure_user(id)
        
client_print(idprint_chat"You have used an antidote");
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_print(idprint_chat"You don't have enaugh moeny! $%i needed!"iCost)
    }
    return 
PLUGIN_HANDLED;

__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 05-09-2009 , 13:27   Re: T-Virus Antidote
Reply With Quote #5

The best way to know that, is testing it. Should work tough.
__________________

anakin_cstrike is offline
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 05-09-2009 , 13:53   Re: T-Virus Antidote
Reply With Quote #6

I can't test it cuz I don't have a biohazard server
__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-09-2009 , 13:59   Re: T-Virus Antidote
Reply With Quote #7

Quote:
Originally Posted by Emilioneri View Post
I can't test it cuz I don't have a biohazard server
make one :} listen + bots or something
__________________
Hunter-Digital is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 05-09-2009 , 13:55   Re: T-Virus Antidote
Reply With Quote #8

Too lazy now...

Ask Mando128
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-09-2009 , 14:01   Re: T-Virus Antidote
Reply With Quote #9

Bots dont work on them They are to stupid
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 05-09-2009 , 14:05   Re: T-Virus Antidote
Reply With Quote #10

Quote:
Originally Posted by TitANious View Post
Bots dont work on them They are to stupid
Yeah, they are shooting at their teamates and zombie is trying to kill another zombie
__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
Reply



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 01:31.


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