View Single Post
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