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

heal and pack strings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Menethil
Senior Member
Join Date: Aug 2011
Old 02-21-2012 , 08:51   heal and pack strings
Reply With Quote #1

So i have a healing plugin ( say /heal) , where MAX_HEALTH is 100.

But at some points, some players will buy more HP 100 ++ and will have that HP , lets say 150 until map change.
So when they use /heal, theyr max HP is 100, but it should be the new value 150 , or depends per ID what've they bought from the shop.

So i need some teoretic indications or maybe an example ,how should i solve this, so theyr MAX HP allowed to be the new value and not 100 like each common player
Menethil is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 02-21-2012 , 11:41   Re: heal and pack strings
Reply With Quote #2

Check the health of the player when he spawns (with a short delay just to be sure he already received the extra HP) and save his health in a array. Then just use the health stored in the array instead of 100.
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-21-2012 , 11:50   Re: heal and pack strings
Reply With Quote #3

When player purchases more health from shop, increase their pev_max_health value.
When player heals, check their max health from that rather than the MAX_HEALTH constant.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 02-21-2012 , 20:33   Re: heal and pack strings
Reply With Quote #4

Didn't know about pev_max_health...
Just a off-topic question: If you change pev_max_health when a player respawns he will start with that HP?
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
Menethil
Senior Member
Join Date: Aug 2011
Old 02-22-2012 , 08:46   Re: heal and pack strings
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
When player purchases more health from shop, increase their pev_max_health value.
When player heals, check their max health from that rather than the MAX_HEALTH constant.
Ty exo, always a pleasure.
Menethil is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 02-22-2012 , 09:02   Re: heal and pack strings
Reply With Quote #6

Pawn supports packing strings. You can read more from the differences of packed and unpacked strings from The Pawn Language Guide.
SnoW is offline
Send a message via MSN to SnoW
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-22-2012 , 12:38   Re: heal and pack strings
Reply With Quote #7

Quote:
Originally Posted by SnoW View Post
Pawn supports packing strings. You can read more from the differences of packed and unpacked strings from The Pawn Language Guide.
It's useless to try to save memory using packed string, also amxx natives don't support them.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 02-22-2012 , 14:34   Re: heal and pack strings
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
It's useless to try to save memory using packed string, also amxx natives don't support them.
Very true. That does not however take purpose from my post as I simply replied to what the title clearly showed he wanted help with.
SnoW is offline
Send a message via MSN to SnoW
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 21:17.


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