Raised This Month: $ Target: $400
 0% 

how to set heal points ???


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 02-23-2009 , 09:55   how to set heal points ???
Reply With Quote #1

Code:
#include <amxmodx>
#include <fun>

#define PLUGIN "heal"
#define VERSION "1.0"
#define AUTHOR "emilioneri"


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_clcmd("say /heal", "heal")
}

public heal(id)
{
	set_user_health(<what to write here ???>)
}
Can anyone help me ?? This is very, very simple for you.
__________________

Last edited by Emilioneri; 02-23-2009 at 10:05.
Emilioneri is offline
Send a message via Skype™ to Emilioneri
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-23-2009 , 09:59   Re: heal
Reply With Quote #2

Read the Function Wiki for usage on commands
http://amxmodx.org/funcwiki.php?sear...alth&go=search

As per the Global Forum Rules, you need to have a descriptive topic title. If you wish for this topic to stay open, please correct the topic title before you post again.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 02-23-2009 , 10:09   Re: how to set heal points ???
Reply With Quote #3

Thanks for helping . +karma
__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 02-23-2009 , 10:14   Re: how to set heal points ???
Reply With Quote #4

And how to set cost ?? For example when I type "/heal" I get 75hp and I lost 5000$.
__________________
Emilioneri is offline
Send a message via Skype™ to Emilioneri
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-23-2009 , 10:15   Re: how to set heal points ???
Reply With Quote #5

Use the FuncWiki and look for a function that deals with money or use the forum search feature
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-23-2009 , 10:24   Re: how to set heal points ???
Reply With Quote #6

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

new g_Cost;

public 
plugin_init() {
    
register_plugin"Heal 4 Money""1.0""xPaw" );
    
    
g_Cost register_cvar"sv_heal4money""5000" );
    
    
register_clcmd"say /heal""cmdHeal" );
}

public 
cmdHealid ) {
    new 
iMoney cs_get_user_moneyid );
    
    if( 
iMoney >= g_Cost ) {
        new 
iHealth get_user_healthid );
        new 
iHCheck iHealth 75;
        
        if( 
iHCheck 100 )
            
set_pev(idpev_health100.0);
        else
            
set_pev(idpev_healthiHealth 100.0);
        
        
cs_set_user_money(idiMoney g_Cost);
    } else
        
client_print(idprint_chat"* You dont have enough money.");

__________________
xPaw is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-23-2009 , 10:33   Re: how to set heal points ???
Reply With Quote #7

@xpaw

iHeath is an integer, I think you need to convert it to float for set_pev.
Also, you check for 75 but add 100.
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-23-2009 , 10:48   Re: how to set heal points ???
Reply With Quote #8

You could also make it so the full $5000 is not spent if the user doesn't utilize the full 75 of health.

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

new g_Cost;

public 
plugin_init() 
{
        
register_plugin"Buy Health""1.0""xpaw\bugsy" );
        
        
g_Cost register_cvar"sv_healcost""5000" );
        
        
register_clcmd"say /heal""cmdHeal" );
}

public 
cmdHealid 
{
    new 
Float:fHealth;
    
pev(idpev_healthfHealth);

    if( 
fHealth 100.0 )
    {
        new 
iMoney cs_get_user_moneyid );
        
        if( 
iMoney >= get_pcvar_num(g_Cost) ) 
        {
            new 
Float:fHCheck fHealth 75.0;
        
            
set_pev(idpev_health, (fHCheck 100.0) ? 100.0 fHCheck);
            
            
cs_set_user_money(idiMoney get_pcvar_num(g_Cost));
        } 
        else
        {
            
client_print(idprint_chat"* You dont have enough money.");
        }
    }

__________________

Last edited by Bugsy; 02-23-2009 at 22:21.
Bugsy is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-23-2009 , 11:23   Re: how to set heal points ???
Reply With Quote #9

new Float:fHealth = pev(id, pev_health);
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-23-2009 , 11:27   Re: how to set heal points ???
Reply With Quote #10

t3h right :]
__________________
xPaw is offline
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 17:04.


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