Raised This Month: $344 Target: $400
 86%   Almost there!

[Any] Set players health (with Spawn Health)


Post New Thread Reply   
 
Thread Tools Display Modes
Weshola
Junior Member
Join Date: Oct 2012
Old 05-10-2014 , 04:55   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #21

Have u come up with an solution yet ?

Last edited by Weshola; 05-10-2014 at 04:57.
Weshola is offline
joac1144
Senior Member
Join Date: Dec 2012
Location: Copenhagen, Denmark
Old 05-10-2014 , 09:46   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #22

Quote:
Originally Posted by Weshola View Post
Have u come up with an solution yet ?
No, not yet.
And I'm quite sure I can't do it without help yet
__________________
joac1144 is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 06-19-2014 , 11:04   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #23

Quote:
Originally Posted by joac1144 View Post
No, not yet.
And I'm quite sure I can't do it without help yet

This plugin sets 35HP on spawn:
https://forums.alliedmods.net/showthread.php?t=233685

Maybe that can help?
Ejziponken is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 06-19-2014 , 11:43   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #24

PHP Code:
    for (new 0target_counti++)
    {
        if (
spawnHealth[target_list[i]] <= 0)
        {
            
ReplyToCommand(client"[SM] Please choose a higher value!");
            return 
Plugin_Handled;
        }
        else
        {
            if (
args >= && GetCmdArg(2hpsizeof(hp)))
            {
                
spawnHealth[target_list[i]] = StringToInt(hp);
            }
            
            
spawnHealthOn[target_list[i]] = true;
            
LogAction(clienttarget_list[i], "Admin %L set %L to spawn with %d HP"clienttarget_list[i], spawnHealth);
        }
    } 
This can not work. You check spawnHealth <= 0 (which is always 0 at this point) before even reading the argument. Change the code to behave just like sm_hp: Read the argument once at the beginning of the function and store it into a variable, then check that variable. It makes no sense to convert the argument inside the loop as it will stay the same.

There are some other minor issues with the code but I got to go.
__________________
In Flames we trust!
Nextra is offline
GOATrider
Junior Member
Join Date: Jul 2014
Old 07-28-2014 , 08:15   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #25

Bump. Please update.
GOATrider is offline
joac1144
Senior Member
Join Date: Dec 2012
Location: Copenhagen, Denmark
Old 07-28-2014 , 16:08   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #26

Quote:
Originally Posted by GOATrider View Post
Bump. Please update.
I'm sorry, but I'm not coding in Sourcepawn anymore.
__________________

Last edited by joac1144; 12-11-2017 at 18:04.
joac1144 is offline
joac1144
Senior Member
Join Date: Dec 2012
Location: Copenhagen, Denmark
Old 12-11-2017 , 18:31   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #27

*After 3 years*

The plugin should now be working.
__________________
joac1144 is offline
Kashinoda
Member
Join Date: Dec 2017
Old 12-14-2017 , 13:29   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #28

Quote:
Originally Posted by joac1144 View Post
*After 3 years*

The plugin should now be working.
Thanks mate, works perfectly
Kashinoda is offline
TankClash
New Member
Join Date: Sep 2017
Old 01-20-2018 , 16:25   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #29

Any way to make it so it can refill a percentage of health? (basically eliminate overheal)

Last edited by TankClash; 01-20-2018 at 16:27.
TankClash is offline
joac1144
Senior Member
Join Date: Dec 2012
Location: Copenhagen, Denmark
Old 01-22-2018 , 03:57   Re: [Any] Set players health (with Spawn Health)
Reply With Quote #30

Quote:
Originally Posted by TankClash View Post
Any way to make it so it can refill a percentage of health? (basically eliminate overheal)
I'm not sure what you mean.
A command to give health in addition to your current health instead of setting a specific amount?
__________________
joac1144 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 16:10.


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