This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Skill points become negative


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stupid0303
Junior Member
Join Date: Sep 2012
Location: Taiwan
Old 04-28-2024 , 07:18   Skill points become negative
Reply With Quote #1

Parameters inside each_health 1
I changed it to each_health 5
There is only 1 skill point, and 5 parts can be deducted.
Skill points will become -4
How to solve it?
Attached Files
File Type: inc skills_menu.inc (6.0 KB, 22 views)
File Type: sma Get Plugin or Get Source (12Box_level.sma - 29 views - 25.1 KB)
stupid0303 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-28-2024 , 15:13   Re: Skill points become negative
Reply With Quote #2

If you need to just make sure that the value doesn't go below zero, you can add a check after every location that subtracts a value such as this:

PHP Code:
if( g_skills[id] < )
{
    
g_skills[id] = 0

__________________
fysiks is offline
stupid0303
Junior Member
Join Date: Sep 2012
Location: Taiwan
Old 04-28-2024 , 21:19   Re: Skill points become negative
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
If you need to just make sure that the value doesn't go below zero, you can add a check after every location that subtracts a value such as this:

PHP Code:
if( g_skills[id] < )
{
    
g_skills[id] = 0



Thank you, boss
But after I modified it (modify the life part first)
If you click on it, there will be no response and the menu will be closed.

It has now been changed to
100 skill points will be deducted by 100 and will no longer be negative.
But the points need to be 0 to be displayed. There are not enough points.
If it is 1, the menu will be closed directly.

if(g_hp[id] >= 100)
{
client_printc(id, "\g血量已升至最高等級了!!!")
cmd_skills(id)
}
else
if(g_skills[id] >= 100)
{
g_skills[id] -= get_cvar_num("each_health")
g_hp[id] ++
cmd_skills(id)
}
else
if(!g_skills[id])
{
client_printc(id, "\g沒有足夠的技能點數")
cmd_skills(id)

Last edited by stupid0303; 04-28-2024 at 22:05.
stupid0303 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-30-2024 , 22:59   Re: Skill points become negative
Reply With Quote #4

No idea what you just said.
__________________
fysiks is offline
stupid0303
Junior Member
Join Date: Sep 2012
Location: Taiwan
Old 04-30-2024 , 23:18   Re: Skill points become negative
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
No idea what you just said.
If the remaining points are 0, client_printc(id, "\gThe blood volume has reached the highest level!!!")
If the remaining points are 1 or less than 100, click the skill and the menu will close.
stupid0303 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-02-2024 , 12:24   Re: Skill points become negative
Reply With Quote #6

It would be more helpful if you could just explain correctly what you're looking for. I would say it looks like chinese but your code is literally that.

fysiks already gave u the answer more or less on the "question" u asked.

PHP Code:
if(g_skills[id] < 0
{
    
g_skills[id] = 0;
    
// client_printc()
}

else if (
g_skills[id] < 100
{
    
// click skill & close menu?

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
stupid0303
Junior Member
Join Date: Sep 2012
Location: Taiwan
Old 05-02-2024 , 20:57   Re: Skill points become negative
Reply With Quote #7

Quote:
Originally Posted by Napoleon_be View Post
It would be more helpful if you could just explain correctly what you're looking for. I would say it looks like chinese but your code is literally that.

fysiks already gave u the answer more or less on the "question" u asked.

PHP Code:
if(g_skills[id] < 0
{
    
g_skills[id] = 0;
    
// client_printc()
}

else if (
g_skills[id] < 100
{
    
// click skill & close menu?



PHP Code:
if(g_skills[id] >= //Click the skill point amount
{
g_skills[id] -= get_cvar_num("each_health")

}
else
if(
g_skills[id] < //If it is lower than this value, it will show that there are insufficient skill points and the menu will not disappear. 
Thank u
According to your method, no errors occurred when converting files.
Then I modified it myself and it was successful.
stupid0303 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-04-2024 , 11:18   Re: Skill points become negative
Reply With Quote #8

Quote:
Originally Posted by stupid0303 View Post
PHP Code:
if(g_skills[id] >= //Click the skill point amount
{
g_skills[id] -= get_cvar_num("each_health")

}
else
if(
g_skills[id] < //If it is lower than this value, it will show that there are insufficient skill points and the menu will not disappear. 
Thank u
According to your method, no errors occurred when converting files.
Then I modified it myself and it was successful.
Chief, another option you have is using clamp()

val = clamp( the value , minimum , maximum )

val will always result in a value between min and max.
__________________
Bugsy is offline
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 09:00.


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