AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ZP] Send only 1 message when level up (https://forums.alliedmods.net/showthread.php?t=312356)

pawnsito 11-28-2018 17:09

[ZP] Send only 1 message when level up
 
Hi guys, first of all, sorry for my bad english, you should know this is not my primary language so..

The problem is this i have this code

PHP Code:

public update_ap(idamountcheck)
{
    if (
check) goto check2 // Lo que hace el "goto" es, si la Funcion esta se llamo desde "check", el Plugin lo que hara, es llamar directamente a "check2".
   
    // Aca detectamos que si es Nivel Maximo no suba mas.
    
if (g_ammopacks[id] + amount NIVELES[sizeof NIVELES 1] - 1)
        return 
PLUGIN_HANDLED
    
    
// Le damos los APs correspondientes.
    
g_ammopacks[id] += amount
    
    
// Ya lo dijimos antes ^^.
    
check2:
    if(
amount 0)
    {
        if(
g_ammopacks[id] < NIVELES[g_level[id]] )
        {
            
g_level[id]--
            
client_print(idprint_center"Bajaste de nivel")
            
update_ap(id, -11)
        }

    }
    else
    {
        if(
g_ammopacks[id] >= NIVELES[g_level[id]] )
        {
            
g_level[id]++
            
client_print(idprint_center"Subiste de nivel")
            
update_ap(id01
        }
    }
    
    return 
PLUGIN_HANDLED


The problem is, whenever a player level up 2 or more levels, instantanly the print
PHP Code:

client_print(idprint_center"Subiste de nivel"

Is showed more than 1 times, it spawn a lot 2 , 3 , 4 .... 100 times depend on how many levels they level up,

How i can make it to send just one print with the final level you got?

example: if i level up with 1 hit from level 1 to 6 only show
CONGRATULATIONS YOU LEVEL UP TO LEVEL %d", g_level[id])

instead of get the 6 messages

ty.


All times are GMT -4. The time now is 07:38.

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