AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to set heal points ??? (https://forums.alliedmods.net/showthread.php?t=86269)

Emilioneri 02-23-2009 09:55

how to set heal points ???
 
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. :)

YamiKaitou 02-23-2009 09:59

Re: heal
 
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.

Emilioneri 02-23-2009 10:09

Re: how to set heal points ???
 
Thanks for helping :). +karma :D

Emilioneri 02-23-2009 10:14

Re: how to set heal points ???
 
And how to set cost ?? For example when I type "/heal" I get 75hp and I lost 5000$. :)

YamiKaitou 02-23-2009 10:15

Re: how to set heal points ???
 
Use the FuncWiki and look for a function that deals with money or use the forum search feature

xPaw 02-23-2009 10:24

Re: how to set heal points ???
 
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.");



fysiks 02-23-2009 10:33

Re: how to set heal points ???
 
@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.

Bugsy 02-23-2009 10:48

Re: how to set heal points ???
 
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.");
        }
    }



AntiBots 02-23-2009 11:23

Re: how to set heal points ???
 
new Float:fHealth = pev(id, pev_health);

xPaw 02-23-2009 11:27

Re: how to set heal points ???
 
t3h right :]


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

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