AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Super Condition Amount (https://forums.alliedmods.net/showthread.php?t=79741)

Texnux 10-28-2008 17:22

Super Condition Amount
 
2 Attachment(s)
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 :P, hope you enjoy it and I really wonders what you need 25000 hp for?!? :shock:

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

Arkshine 10-28-2008 17:45

Re: Super Condition Amount
 
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..

Texnux 10-28-2008 18:22

Re: Super Condition Amount
 
Quote:

Originally Posted by arkshine (Post 706771)
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 (Post 706771)
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 (Post 706771)
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

krededk99 10-29-2008 13:31

Re: Super Condition Amount
 
ha great :D 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.

ConnorMcLeod 10-29-2008 13:35

Re: Super Condition Amount
 
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.

Texnux 10-29-2008 14:18

Re: Super Condition Amount
 
Quote:

Originally Posted by connorr (Post 707131)
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 (Post 707131)
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

ConnorMcLeod 10-29-2008 14:39

Re: Super Condition Amount
 
Quote:

Originally Posted by Texnux (Post 707142)
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 (Post 707142)
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.

Texnux 10-29-2008 15:12

Re: Super Condition Amount
 
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

ConnorMcLeod 10-30-2008 01:44

Re: Super Condition Amount
 
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;




All times are GMT -4. The time now is 21:24.

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