Raised This Month: $51 Target: $400
 12% 

Regenerator


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
<<<Anonysmous>>>
BANNED
Join Date: Apr 2008
Old 08-11-2008 , 05:04   Regenerator
Reply With Quote #1

Hello all People, I am very very new with Amx Mod X Scrpiting and I have just made this little thing that regenerates players health!!!
Description:
This is a little admin thing that regenerates person's health/Armour...
When You Use this command , it will regenerate the chosen player's health and to the customizable value...
CVARS!!!:
amx_reg_enabled 0/1 - Enables this plugin
amx_reg_speed - 0.1 is default, this is the speed of regeneration
amx_reg_hp - 50 is default, HOw much shall a player recieve.
amx_type 1/2 -1=Regenerator will stop at mod's max health/armor 2= Will stop from the values below.
amx_reg_max_xp - At what health shall the regenerator stop?
amx_reg_max_armor - At what armour shall the regenerator stop?
Commands!!!:
amx_regenerate "player" / @all -Starts the regeneration on player or whole server!!!
Credits:
Steve139 - My AMXX Teacher!!!!
Notes:
Works Fine For CS,CS CZ,TFC,HL,OP4,NS,SC,SCXP
If you want this for Fakemeta, ask me I will add it here!
Works With Any Half-Life Mod From now on
FUN/ENGINE MODULE IS REQUIRED!!!!
Attached Files
File Type: sma Get Plugin or Get Source (regenerator.sma - 1070 views - 4.4 KB)

Last edited by <<<Anonysmous>>>; 12-17-2008 at 14:43. Reason: ...Try find out yourself xD
<<<Anonysmous>>> is offline
Sam Tsuki
Senior Member
Join Date: Apr 2008
Location: KoKoRo!
Old 08-11-2008 , 05:31   Re: Regenerator
Reply With Quote #2

This is all you have to do:
PHP Code:
#include <amxmodx>
#include <fun>

public plugin_init()
{
    
register_cvar("regen_hp""2")
    
register_cvar("regen_maxhp""100")
    
register_cvar("regen_time""1.0")
    
register_cvar("regen_enable""1")
    
    
set_task(get_cvar_float("regen_time"),"regen_lunch",0,"",0)
}

public 
regen_lunch() {
    if(
get_cvar_num("regen_enable") == 0) return PLUGIN_HANDLED
    
    
for(new 1<= 32i++) {
        if(
is_user_alive(i)) {
            if(
get_user_health(i) < get_cvar_num("regen_maxhp"))
                
set_user_health(iget_user_health(i) + get_cvar_num("regen_hp"))
            else
                
set_user_health(iget_cvar_num("regen_maxhp"))
        }
    }
    
set_task(get_cvar_float("regen_time"),"regen_lunch",0,"",0)
    return 
PLUGIN_HANDLED

__________________
My Approved Plugins:
Sam Tsuki

HvM XP Mod's addons:
Co-op Maps
Money System
Sam Tsuki is offline
Old 08-11-2008, 10:39
<<<Anonysmous>>>
This message has been deleted by <<<Anonysmous>>>. Reason: ...
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-11-2008 , 16:12   Re: Regenerator
Reply With Quote #3

Please add the SMA to the first post
__________________
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
Sam Tsuki
Senior Member
Join Date: Apr 2008
Location: KoKoRo!
Old 08-11-2008 , 18:19   Re: Regenerator
Reply With Quote #4

hmm...
That's not bad for a start
But try using more cvars next time ;)
__________________
My Approved Plugins:
Sam Tsuki

HvM XP Mod's addons:
Co-op Maps
Money System
Sam Tsuki is offline
<<<Anonysmous>>>
BANNED
Join Date: Apr 2008
Old 08-12-2008 , 05:44   Re: Regenerator
Reply With Quote #5

I'm working on a CVar that enables this whole thing.... I'll try too do that myself
EDIT: Done =)

Last edited by <<<Anonysmous>>>; 08-12-2008 at 06:16. Reason: ...
<<<Anonysmous>>> is offline
Howdy!
Senior Member
Join Date: Feb 2007
Old 08-12-2008 , 14:57   Re: Regenerator
Reply With Quote #6

Description?
__________________
[IMG]http://img221.**************/img221/5608/howdyfinnishhq2.jpg[/IMG]
Howdy! is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 08-13-2008 , 05:35   Re: Regenerator
Reply With Quote #7

PHP Code:
if(( is_user_connected(i) && is_user_alive(i) )) 
This is bad, it's enough if you check if the user(s) are alive..if they are alive, shure they're connected
__________________

anakin_cstrike is offline
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 08-16-2008 , 03:53   Re: Regenerator
Reply With Quote #8

I suggest using pcvars and changing your checks on health so that they use less than checks as opposed to the not equals check as if health was manually set above the hardcoded limit the plugin will continue to increase their health.
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.

Last edited by Lord_Destros; 08-16-2008 at 03:56.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
<<<Anonysmous>>>
BANNED
Join Date: Apr 2008
Old 08-28-2008 , 07:51   Re: Regenerator
Reply With Quote #9

Quote:
Originally Posted by anakin_cstrike View Post
PHP Code:
if(( is_user_connected(i) && is_user_alive(i) )) 
This is bad, it's enough if you check if the user(s) are alive..if they are alive, shure they're connected
Sure, I will change it....
<<<Anonysmous>>> is offline
Old 08-28-2008, 08:05
<<<Anonysmous>>>
This message has been deleted by <<<Anonysmous>>>.
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 09-07-2008 , 01:15   Re: Regenerator
Reply With Quote #10

A few things, I would cache the armor and such like new armor = get_user_armor(id)

And instead of doing if life != 100 or seomthign do if life < 100 (since what if there life was 250 from another plugin, that sucks to reset it.)
Styles is offline
Send a message via AIM to Styles
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 14:11.


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