AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   blockmaker healer (https://forums.alliedmods.net/showthread.php?t=146798)

Shadezz 01-01-2011 10:09

blockmaker healer
 
Hey, i just found out that on my SCM the healer wont heal to more than 100, and if ppl got 125 hp with CashMod for an example, healer will just heal to 100, so ive tried if i can make it heal to the right hp (125)

for that ive tried with this:

PHP Code:

ActionHeal(ident)
{
 new 
Float:gametime get_gametime();
 if ( !( 
gametime >= g_next_heal_time[id] ) ) return PLUGIN_HANDLED;
 
 
 new 
health get_user_health(id);
 if ( 
health playerHealth[id] );
 {
  static 
property[5];
 
  
GetProperty(ent1property);
  
health += str_to_num(property);
  
set_user_health(idmin(playerHealth[id], health));
  
  
GetProperty(ent2property);
  
g_next_heal_time[id] = gametime str_to_float(property);
 }
 
 return 
PLUGIN_HANDLED;


and then i get the errors:
Quote:

/home/groups/amxmodx/tmp3/phpNn3M6Y.sma(1468) : error 017: undefined symbol "playerHealth"
/home/groups/amxmodx/tmp3/phpNn3M6Y.sma(1468) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/phpNn3M6Y.sma(1468) : error 001: expected token: ";", but found "]"
/home/groups/amxmodx/tmp3/phpNn3M6Y.sma(1468) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpNn3M6Y.sma(1468) : fatal error 107: too many error messages on one line
could some1 help me? :S

SpeeDeeR 01-01-2011 11:59

Re: blockmaker healer
 
Which are the problem lines and what is
Code:

playerHealth[id]



Shadezz 01-01-2011 12:43

Re: blockmaker healer
 
i have a plugin named CashMod where u can buy a "upgrade" so u get more hp, for an example 125, then, i have my blockmaker(ShaDezz Course Maker) where there is a regenerate block(Healer block) which im trying to do so it can heal to 125 instead of just healing to 100, im trying to make it heal to 125 IF u have cashmod upgrade

GXLZPGX 01-01-2011 13:10

Re: blockmaker healer
 
Quote:

Originally Posted by Shadezz (Post 1383741)
i have a plugin named CashMod where u can buy a "upgrade" so u get more hp, for an example 125, then, i have my blockmaker(ShaDezz Course Maker) where there is a regenerate block(Healer block) which im trying to do so it can heal to 125 instead of just healing to 100, im trying to make it heal to 125 IF u have cashmod upgrade

If you want to do that, you'll have to add a native to cashmods include that returns the players health, and use it in the blockmaker.

Shadezz 01-01-2011 18:52

Re: blockmaker healer
 
yeah but i dno how to do that

trooligt 01-12-2011 14:15

Re: blockmaker healer
 
shadezz heres the code for heal block to heal over 100 :D

Code:

ActionHeal(id, ent)
{
        new Float:gametime = get_gametime();
        if ( !( gametime >= g_next_heal_time[id] ) ) return PLUGIN_HANDLED;
       
        new health = get_user_health(id);
        if ( health >= 250 ) return PLUGIN_HANDLED;
       
        static property[5];
       
        GetProperty(ent, 1, property);
        health += str_to_num(property);
        set_user_health(id, min(250, health));
       
        GetProperty(ent, 2, property);
        g_next_heal_time[id] = gametime + str_to_float(property);
       
        return PLUGIN_HANDLED;


Shadezz 01-12-2011 15:39

Re: blockmaker healer
 
Trooligt.. that will heal u instant to 250.. this was what needed
Quote:

ActionHeal(id, ent)
{
new Float:gametime = get_gametime();
if( !(gametime >= g_next_heal_time[id]) )
{
return PLUGIN_HANDLED;
}

static property[5];
GetProperty(ent, 1, property);

new Float:new_health = get_user_health(id) + str_to_float(property);
new CashHealth = (100 + (25 * cm_get_health_level(id)));

if( new_health < CashHealth )
{
entity_set_float(id, EV_FL_health, new_health);
}
else
{
entity_set_float(id, EV_FL_health, float(CashHealth));
}

static Float:interval;
GetProperty(ent, 2, property);
interval = str_to_float(property);
g_next_heal_time[id] = gametime + interval;

return PLUGIN_HANDLED;
}
fixed by nnajko


All times are GMT -4. The time now is 02:00.

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