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

Solved Native: get_user_rank


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-30-2020 , 04:40   Re: Native: get_user_rank
Reply With Quote #21

Quote:
Originally Posted by Bugsy View Post
No, the code you used to create the HUD in your first post that isn't working correctly. This isn't that confusing, show all code that is causing you an issue if you want the problem resolved.
I added this hud just for test natives of plugin

PHP Code:
new syncObj
syncObj     
CreateHudSyncObj()

public 
ShowHud(id
{
    new 
iRank get_user_rank(id)
    new 
iXP get_user_xp(id)
    new 
iMaxLvl get_user_max_level(id)
    new 
iLevel get_user_level(id)
    
    
set_hudmessage(0212255, -1.00.006.012.0)
    
ShowSyncHudMsg(idsyncObj,"Rank: %s ^nXP: %i / %i ^nLevel: %i"iRankiXPiMaxLvliLevel)

}

public 
client_putinserverid ) {
    
set_task(1.0"ShowHud"id__"b")


I also have one more problem, I made give xp command but when i give XP for players or ZM or H or All, it's show me in show i have xp without getting upgraded on rank and level.
I give me self 10,000k XP but i have still in level 1 and max XP 50!!
Why i have this problem ?



PHP Code:
public cmdAddXP (iPlayerlevelcid)
{
    if(!
cmd_access(iPlayerlevelcid3))
        return 
PLUGIN_HANDLED;
        
    new 
arg [32]
    
read_argv (1arg31)
    
    new 
AddXP [32]
    
read_argv (2AddXPcharsmax (AddXP))
    
    new 
szPlayerXP get_user_xp(iPlayer)

    new 
szAdminName [32]
    new 
szPlayerName [32]
    
get_user_name (iPlayerszAdminNamecharsmax (szAdminName))
    
    if(
arg[0]=='@')
    {
        if(
equali(arg[1],"ALL") || equali(arg[1],"all"))
        {
            new 
iPlayers[32], totalplayersAll
            get_players
(iPlayerstotalplayers)
            
            for (new 
0totalplayersi++)
            {
                 
All iPlayers[i]
                 
set_user_xp(AllszPlayerXP str_to_num(AddXP))

            }
            
CheckLevel(All)
            
//client_print_color(0, print_chat, "[ADMIN]^1 ^3%s^1 dade^3 %i^1 XP na vsichki ^3igrachi^1!", AdminName, GiveXP)
        
}
        
        else if(
equali(arg[1],"ZM") || equali(arg[1],"zm") || equali(arg[1],"zombies") )
        {
            new 
iPlayers[32], totalplayersZOMBIE
            get_players
(iPlayerstotalplayers)
            
            for (new 
0totalplayersi++)
            {
                if (
get_user_team(iPlayers[i]) == 1)
                {
                    
ZOMBIE iPlayers[i]
                    
set_user_xp(ZOMBIEszPlayerXP str_to_num(AddXP))

                }
                
            }
            
CheckLevel(ZOMBIE)
            
//client_print_color(0, print_chat, "^4[Ranks]^1 ^3%s^1 dade^3 %i^1 XP na vsichki ^3 Teroristi^1.", AdminName, GiveXP)
        
}
        
        else if(
equali(arg[1],"H") || equali(arg[1],"h") || equali(arg[1],"humans"))
        {
            new 
iPlayers[32], totalplayersHUMAN
            get_players
(iPlayerstotalplayers)
            
            for(new 
0totalplayersi++)
            {
                if(
get_user_team(iPlayers[i]) == 2)
                {
                    
HUMAN iPlayers[i]
                    
set_user_xp(HUMANszPlayerXP str_to_num(AddXP))
                }
            }
            
CheckLevel(HUMAN)
            
//client_print_color(0, print_chat, "^4[Ranks]^1 ^3%s^1 dade^3 %i^1 XP na wsichki ^3 Kontra-Teroristi^1!", AdminName, GiveXP)
        
}
    }
    
    else
    {
        new 
iTarget cmd_target(iPlayerarg3)
        
get_user_name (iTargetszPlayerNamecharsmax (szPlayerName))
        
        if(
iTarget)
        {
            
set_user_xp(iTargetszPlayerXP str_to_num(AddXP))
            
CheckLevel(iTarget)
            
//LevelChat(0, "^1[ADMIN]^4 %s^1 dade^3 %i^1 XP na^3 %s^1.", AdminName, GiveXP, TargetName)
        
}
    }
    return 
PLUGIN_HANDLED

I want to know
var[] = buffer [] ???

I aslo want to know if i used style 0 with set it will be like this ?? amout = clamp ? Right ?
PHP Code:
// Native: set_user_xp
public _set_user_xp(iPlugin,iParams)
{
    
g_iPlayerXPget_param(1) ] = clamp(get_param(2), 0)

Supremache is offline
 



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 22:04.


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