Raised This Month: $100 Target: $400
 25% 

Super Condition Amount


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands        Approver:   Exolent[jNr] (178)
Texnux
Member
Join Date: Mar 2008
Location: Denmark
Old 10-28-2008 , 18:22   Super Condition Amount
Reply With Quote #1

Super Condition Amount, by Texnux, version 1.2, updated 28-10-2008

Info:
Was only tested on CZ but should work with every mod with armor, uploaded one only with the health command.

Notice that neither health or armor (in the hud) can show the right amount, use this to show health http://forums.alliedmods.net/showthr...ht=show+health, I might make my own, but just use his for the time being.

Description
This plugin gives the ability, as sooo many other plugins, to give health and/or amount but with an unheard amount sky high limit and can do something more.

Features:
- Set target's/all's/teams health, armor or both and even at each spawn
- Is much more advanced in some ways
- Does only use one command for everything
- Has an in game (console) how to guide
- Gives information about the player you want to change health, armor or both
- Support maximum value: 2.147.000.000 (test worked up to that and some over, but it can't get even close to the max int value (2147483647))

Manual:
It has five parameter, I'll go through how it works and what with what and whatnot.

Notice that if you use the one only with health the second parameter wont exist leaving only four parameters!

amx_csa_user target/@all/@ct/@t hp/ap/both add/set/take/start/stop amount (yes)

The first parameter is about the target(s).
The second parameter is either health, armor or both to do action on.
The third parameter is the action add, set, take is self explaining, start is the amout the target(s) will get each round, stop is to stop it.
The fourth is amount
The fifth is yes and will only work if the action is set, it will set the health/ap or both to the amount right now and each round.

The plugin will tell you what you are doing wrong if you did something wrong.

Modules:
- Hamsanwich
- Fun

Command usage:
amx_csa_user - shows the manual
amx_csa_user [target] - shows information about that targets health and armor
amx_csa_user [target] [hp/ap/both] [set] [amount] [yes] - Sets amount right now and each round for the target(s)
amx_csa_user [target] [hp/ap/both] [action] [amount] - Will do whatever action on the target(s)

Why:
This was a request (pm):
Quote:
Originally Posted by krededk99
I'm seeking a plugin where i can specify someones health. Were talking big numbers, not just 4000 hp max. The ones i'd been able to find doesnt support more, so would it be possible for you to make a plugin where i can set a players HP to, say 25000 or more?

like amx_sethealth player <hp> <armor>

Thanks for helping me.

Kristian.
Sorry Kristian, but I just had to do it a little more advanced than just that , hope you enjoy it and I really wonders what you need 25000 hp for?!?

Bugs:
There is no known bugs, I've tested it quite throughly, but if you discover one, please tell. Please tell me if you want something done differently/better or find some bugs!

Changelog:
Quote:
Version 1.0
- Public release

Version 1.1
- Changed from start to spawn
- Gives health on each player spawn instead of round start
- Split plugin to one with armor and health and one with only health to support all mods without armor

Version 1.2
- Small message fixes/additions
- Small optimatizions
- Able to use action spawn and stop on dead players

- Texnux
Attached Files
File Type: sma Get Plugin or Get Source (sca_no_ap.sma - 1150 views - 7.6 KB)
File Type: sma Get Plugin or Get Source (sca.sma - 1139 views - 10.1 KB)

Last edited by Texnux; 10-28-2008 at 20:51.
Texnux is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-28-2008 , 18:45   Re: Super Condition Amount
Reply With Quote #2

I think your plugin title is not well chosen. I mean since it's only for ap/hp.


When you're using : !equal(target,"") or !equal(target,"@") , it's better to do : !target[0] or target[0] != '@' . It avoids to use extra native.
Also I think that you can use more often a switch instead of a lot of if() else if() etc..
__________________

Last edited by Arkshine; 10-28-2008 at 18:53.
Arkshine is offline
Texnux
Member
Join Date: Mar 2008
Location: Denmark
Old 10-28-2008 , 19:22   Re: Super Condition Amount
Reply With Quote #3

Quote:
Originally Posted by arkshine View Post
I think your plugin title is not well chosen. I mean since it's only for ap/hp.
Most games and mods have 3 conditions: health, armor and some type of energy. What else do you suggest? hp_ap, in the title would just seem so wrong/stupid. Super Condition Amount is about what condition (health/armor) and what amount.

I'm open for ideas/suggestions.

Quote:
Originally Posted by arkshine View Post
When you're using : !equal(target,"") or !equal(target,"@") , it's better to do : !target[0] or target[0] != '@' . It avoids to use extra native.
Will do, thanks for the advice.

Quote:
Originally Posted by arkshine View Post
Also I think that you can use more often a switch instead of a lot of if() else if() etc..
I will look into what I can do about that, it's just if I use a switch the code will properly be alot longer because I have to check for multiple values, and I can't check strings with an switch.


- Texnux
Texnux is offline
krededk99
Senior Member
Join Date: Nov 2007
Old 10-29-2008 , 14:31   Re: Super Condition Amount
Reply With Quote #4

ha great This is perfect. + Karma

Oh and well, its going to be used primarely to have fun with, like predator mod. 1 guy with knife vs a bunch with guns. I just needed much more than a few thousand hp for that. And i diddnt want all the stuff the zombie/predator mods come with, just the hp modifier.

Regarding the name of the plugin, i kinda agree with arkshine. It's not obvious what this plugin is really about. What about something simple and original like.. Advanced Health/Condition Modifier.. or.. nah i dont know.

Last edited by krededk99; 10-29-2008 at 14:35.
krededk99 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-29-2008 , 14:35   Re: Super Condition Amount
Reply With Quote #5

PHP Code:
public PlayerSpawn(id)
{
    if (
is_user_alive(id))
    {
        if(
csa_health[id] != 100)
        {
            
set_user_health(id,csa_health[id]);
        }    
    }

You should also set pev_max_health to csa_health[id] (<- float).
So i suggest you to set pev_health and pev_max_health, so you can also get rid of fun module.
__________________
- tired and retired -
ConnorMcLeod is offline
Texnux
Member
Join Date: Mar 2008
Location: Denmark
Old 10-29-2008 , 15:18   Re: Super Condition Amount
Reply With Quote #6

Quote:
Originally Posted by connorr View Post
PHP Code:
public PlayerSpawn(id)
{
    if (
is_user_alive(id))
    {
        if(
csa_health[id] != 100)
        {
            
set_user_health(id,csa_health[id]);
        }    
    }

I fail to see what is different between this and my own?


Quote:
Originally Posted by connorr View Post
You should also set pev_max_health to csa_health[id] (<- float).
So i suggest you to set pev_health and pev_max_health, so you can also get rid of fun module.
So pev_max_health is the client's max health, meaning players health can go over the 100 limit if there is some sort of healing plugin running?

The way you said "also get rid of fun module" makes it sound like you have a way to remove the hamandswich module?

Will update ones I'm clear I've understood you correctly.

New version will include:
- Fakemeta instead of fun
- Plugin rename to Advanced Condition Modifier (title will be renamed to Advanced Condition Modifier (ap/hp) for making it clear what it does)

Anything else can still make it to 1.3.

- Texnux
Texnux is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-29-2008 , 15:39   Re: Super Condition Amount
Reply With Quote #7

Quote:
Originally Posted by Texnux View Post
So pev_max_health is the client's max health, meaning players health can go over the 100 limit if there is some sort of healing plugin running?
Not only plugins, but yeah you get it.

Quote:
Originally Posted by Texnux View Post
The way you said "also get rid of fun module" makes it sound like you have a way to remove the hamandswich module?
Well, FM and HAM should be the 2 modules the most use now, so i think it's fine to let hamsandwich, even to only detect (re)spawn.
In case you don't want to include it, read this tut http://forums.alliedmods.net/showthread.php?t=42159


Have a look at fakemeta_util.inc if you want to know how to convert fun natives.
Note that they are conversions and that you would have better to directly use floats in your plugin.
__________________
- tired and retired -
ConnorMcLeod is offline
Texnux
Member
Join Date: Mar 2008
Location: Denmark
Old 10-29-2008 , 16:12   Re: Super Condition Amount
Reply With Quote #8

Properly will reduce it only to fakemeta, do you know anything about how to set max armor or is it just not possible?

Updates coming to new version:
- New name
- Only fakemeta module
- A new parameter to set users max health
- A small bug fix

- Texnux

Last edited by Texnux; 10-29-2008 at 16:23.
Texnux is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-30-2008 , 02:44   Re: Super Condition Amount
Reply With Quote #9

cstrike natives to fakemeta :

PHP Code:
#define OFFSET_ARMORTYPE            112

enum CsArmorType {
    
CS_ARMOR_NONE 0// no armor
    
CS_ARMOR_KEVLAR 1// armor
    
CS_ARMOR_VESTHELM // armor and helmet
};

stock cs_get_user_armor(id, &CsArmorType:iArmorType)
{
    new 
Float:flArmorValue;
    
pev(idpev_armorvalueflArmorValue);

    
iArmorType CsArmorType:get_pdata_int(idOFFSET_ARMORTYPE);

    return 
floatround(flArmorValue);
}

stock cs_set_user_armor(idiArmorValueCsArmorType:iArmorType)
{
    
set_pdata_int(id OFFSET_ARMORTYPE_:iArmorType);
    
set_pev(idpev_armorvaluefloat(_:iArmorValue));

    if ( 
iArmorType )
    {
        static 
iMsgArmorType;
        if( !
iMsgArmorType )
        {
            
iMsgArmorType get_user_msgid("ArmorType");
        }
        
message_beginMSG_ONE_UNRELIABLE iMsgArmorType id );
        
write_byteiArmorType == CS_ARMOR_VESTHELM );
        
message_end();
    }

fun natives to fakemeta (from fakemeta_util.inc) :
PHP Code:
stock fm_set_user_armor(indexarmor) {
    
set_pev(indexpev_armorvaluefloat(armor));

    return 
1;

__________________
- tired and retired -

Last edited by ConnorMcLeod; 10-30-2008 at 02:46.
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 05:18.


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