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

OciXCrom's Rank System [XP|Levels|Ranks]


Post New Thread Reply   
 
Thread Tools Display Modes
ALonsoVIP4141
BANNED
Join Date: May 2021
Location: https://t.me/pump_upp
Old 06-02-2022 , 16:48   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #801

Quote:
Originally Posted by ZaX View Post
Use crxranks_get_user_rank the same way you use get_user_authid
PHP Code:
/*================================================================================
    
    ----------------------------
    -*- [ZP] HUD Information -*-
    ----------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <cromchat>
#include <crxranks_const>
#include <csx>
#include <zp50_class_human>
#include <zp50_class_zombie>
#define LIBRARY_NEMESIS "zp50_class_nemesis"
#include <zp50_class_nemesis>
#define LIBRARY_DRAGON "zp50_class_dragon"
#include <zp50_class_dragon>
#define LIBRARY_NIGHTCRAWLER "zp50_class_nightcrawler"
#include <zp50_class_nightcrawler>
#define LIBRARY_ASSASSIN "zp50_class_assassin"
#include <zp50_class_assassin>
#define LIBRARY_SURVIVOR "zp50_class_survivor"
#include <zp50_class_survivor>
#define LIBRARY_SNIPER "zp50_class_sniper"
#include <zp50_class_sniper>
#define LIBRARY_KNIFER "zp50_class_knifer"
#include <zp50_class_knifer>
#define LIBRARY_AMMOPACKS "zp50_ammopacks"
#include <zp50_ammopacks>

native crxranks_get_user_level(id)
native crxranks_get_user_xp(id)
native crxranks_get_user_rank(id)

new 
PlayerRank[33

new const 
rankNames[20][] =
{
    
"Noob",
    
"Noobie",  
    
"Killer",
    
"Pro",
    
"Swat",  
    
"Hitman",
    
"Spy"
    
"Savage",  
    
"Devil",
    
"Guardian"
    
"Headtaker",  
    
"Dragon",
    
"Skyfall"
    
"Rocketman",  
    
"Monster",
    
"Dominator",
    
"Demon Slayer",  
    
"Legendary",
    
"Nemesis",
    
"GodLike"
}
new const 
packNames[20] =
{
    
0,
    
100,  
    
200,
    
300,
    
400,  
    
500,
    
600
    
700,  
    
800,
    
900
    
1000,
    
1100,
    
1500,
    
2000,
    
5000,
    
10000,
    
20000,
    
50000,
    
10000,
         
250000,
}



const 
Float:HUD_SPECT_X 0.6
const Float:HUD_SPECT_Y 0.8
const Float:HUD_STATS_X 0.02
const Float:HUD_STATS_Y 0.9

const HUD_STATS_ZOMBIE_R 200
const HUD_STATS_ZOMBIE_G 250
const HUD_STATS_ZOMBIE_B 0

const HUD_STATS_HUMAN_R 0
const HUD_STATS_HUMAN_G 200
const HUD_STATS_HUMAN_B 250

const HUD_STATS_SPEC_R 255
const HUD_STATS_SPEC_G 255
const HUD_STATS_SPEC_B 255

#define TASK_SHOWHUD 100
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)
new g_iUserFPS[32+1];
const 
PEV_SPEC_TARGET pev_iuser2
#define MAX_PLAYERS    32
new g_MsgSync

public plugin_init()
{
    
register_plugin("[ZP] HUD Information"ZP_VERSION_STRING"ZP Dev Team")
    
register_forward(FM_CmdStart"fw_CmdStart");    
    
g_MsgSync CreateHudSyncObj()
}

public 
plugin_natives()
{
    
set_module_filter("module_filter")
    
set_native_filter("native_filter")
}
public 
module_filter(const module[])
{
    if (
equal(moduleLIBRARY_NEMESIS) || equal(moduleLIBRARY_DRAGON) || equal(moduleLIBRARY_NIGHTCRAWLER) || equal(moduleLIBRARY_AMMOPACKS))
        return 
PLUGIN_HANDLED;
    
    return 
PLUGIN_CONTINUE;
}
public 
native_filter(const name[], indextrap)
{
    if (!
trap)
        return 
PLUGIN_HANDLED;
    
    return 
PLUGIN_CONTINUE;
}

public 
client_putinserver(id)
{
    if (!
is_user_bot(id))
    {
        
// Set the custom HUD display task
        
set_task(1.0"ShowHUD"id+TASK_SHOWHUD__"b")
    }
}

public 
client_disconnect(id)
{
    
remove_task(id+TASK_SHOWHUD)
}
public 
fw_CmdStart(iduc_handle)
{
    
// Get player's FPS accurately
    
g_iUserFPS[id] = floatround(/ (get_uc(uc_handleUC_Msec) * 0.001));
}
// Show HUD Task
public ShowHUD(taskid)
{
    new 
player ID_SHOWHUD


    
new currentPlayerRank 0;  
    while(
currentPlayerRank < (20 1)) 
    {        
        if(
zp_ammopacks_get(player) >= packNames[currentPlayerRank 1])         
        ++
currentPlayerRank;     
        else      
        break ;
    }  
    
PlayerRank[player] = currentPlayerRank;      

    
// Player dead?
    
if (!is_user_alive(player))
    {
        
// Get spectating target
        
player pev(playerPEV_SPEC_TARGET)
        
        
// Target not alive
        
if (!is_user_alive(player))
            return;
    }
    
    
// Format classname
    
static class_name[32], transkey[64]
    new 
redgreenblue
    
    
if (zp_core_is_zombie(player)) // zombies
    
{
        
red HUD_STATS_ZOMBIE_R
        green 
HUD_STATS_ZOMBIE_G
        blue 
HUD_STATS_ZOMBIE_B
        
        
// Nemesis Class loaded?
        
if (LibraryExists(LIBRARY_NEMESISLibType_Library) && zp_class_nemesis_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_NEMESIS")

        
// Dragon Class loaded?
        
if (LibraryExists(LIBRARY_DRAGONLibType_Library) && zp_class_dragon_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_DRAGON")

        
// Nightcrawler Class loaded?
        
if (LibraryExists(LIBRARY_NIGHTCRAWLERLibType_Library) && zp_class_nightcrawler_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_NIGHTCRAWLER")
            
        
// Assassin Class loaded?
        
else if (LibraryExists(LIBRARY_ASSASSINLibType_Library) && zp_class_assassin_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_ASSASSIN")
        else
        {
            
zp_class_zombie_get_name(zp_class_zombie_get_current(player), class_namecharsmax(class_name))
            
            
// ML support for class name
            
formatex(transkeycharsmax(transkey), "ZOMBIENAME %s"class_name)
            if (
GetLangTransKey(transkey) != TransKey_Badformatex(class_namecharsmax(class_name), "%L"ID_SHOWHUDtranskey)
        }
    }
    else 
// humans
    
{
        
red HUD_STATS_HUMAN_R
        green 
HUD_STATS_HUMAN_G
        blue 
HUD_STATS_HUMAN_B
        
        
// Survivor Class loaded?
        
if (LibraryExists(LIBRARY_SURVIVORLibType_Library) && zp_class_survivor_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_SURVIVOR")

        
// Sniper Class loaded?
        
else if (LibraryExists(LIBRARY_SNIPERLibType_Library) && zp_class_sniper_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_SNIPER")
                                             
                  
// Knifer Class loaded?
        
else if (LibraryExists(LIBRARY_KNIFERLibType_Library) && zp_class_knifer_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_KNIFER")
                                 
        else
        {
            
zp_class_human_get_name(zp_class_human_get_current(player), class_namecharsmax(class_name))
            
            
// ML support for class name
            
formatex(transkeycharsmax(transkey), "HUMANNAME %s"class_name)
            if (
GetLangTransKey(transkey) != TransKey_Badformatex(class_namecharsmax(class_name), "%L"ID_SHOWHUDtranskey)
        }
    }
    
    
// Spectating someone else?
    
if (player != ID_SHOWHUD)
    {
        new 
player_name[32]
        
get_user_name(playerplayer_namecharsmax(player_name))
        
        
// Show name, health, class, and money
        
set_hudmessage(HUD_STATS_SPEC_RHUD_STATS_SPEC_GHUD_STATS_SPEC_BHUD_SPECT_XHUD_SPECT_Y06.01.10.00.0, -1)
        
        if (
LibraryExists(LIBRARY_AMMOPACKSLibType_Library))
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"%L: %s^nHP: %d - %L %s - %L %d - FPS: %d"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(player), g_iUserFPS[player])
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"%L: %s^nHP: %d - %L %s - %L $ %d - FPS: %d"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"MONEY1"cs_get_user_money(player), g_iUserFPS[player])
    }
    else
    {
        new 
ranks[32]
        
crxranks_get_user_rank(ID_SHOWHUD,ranks,charsmax(ranks)
        new 
id_authid[32]
        
get_user_authid(ID_SHOWHUD,id_authid,charsmax(id_authid))
        
        
// Show health, class
        
set_hudmessage(redgreenblueHUD_STATS_XHUD_STATS_Y06.01.10.00.0, -1)
        
        if (
LibraryExists(LIBRARY_AMMOPACKSLibType_Library))
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"[ HP: %d | %L %s | Surf Coins: %d ]^n[ Level: %d | Xp: %d | Rank: %s ]^n[ AuthID: %s | FPS: %d ]"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_namezp_ammopacks_get(ID_SHOWHUD), crxranks_get_user_level(ID_SHOWHUD), crxranks_get_user_xp(ID_SHOWHUD), ranksid_authidg_iUserFPS[player])
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"HP: %d - %L %s - %s^nFPS: %d - SteamID: %s"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_namerankNames[currentPlayerRank], g_iUserFPS[player], id_authid)
    }

Tried it but it gives me an error


Last edited by ALonsoVIP4141; 06-02-2022 at 16:49.
ALonsoVIP4141 is offline
Send a message via ICQ to ALonsoVIP4141 Send a message via AIM to ALonsoVIP4141 Send a message via Yahoo to ALonsoVIP4141 Send a message via Skype™ to ALonsoVIP4141
ZaX
Senior Member
Join Date: Jan 2015
Old 06-02-2022 , 21:41   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #802

Where did you copy the native from? Check include file before using it.
At the top of the plugin replace the native with native crxranks_get_user_rank(id, buffer[], len) or simply include the file

Also youre missing a bracket at line 270 at the end, and dont forget to replace the native with the registered variable 'ranks' in ShowSyncHudMsg

Last edited by ZaX; 06-02-2022 at 21:41.
ZaX is offline
ALonsoVIP4141
BANNED
Join Date: May 2021
Location: https://t.me/pump_upp
Old 06-03-2022 , 16:14   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #803

Quote:
Originally Posted by ZaX View Post
Where did you copy the native from? Check include file before using it.
At the top of the plugin replace the native with native crxranks_get_user_rank(id, buffer[], len) or simply include the file

Also youre missing a bracket at line 270 at the end, and dont forget to replace the native with the registered variable 'ranks' in ShowSyncHudMsg


Thanks brother, it worked successfully. The error was that I forgot to add native crxranks_get_user_rank(id, buffer[], len)
ALonsoVIP4141 is offline
Send a message via ICQ to ALonsoVIP4141 Send a message via AIM to ALonsoVIP4141 Send a message via Yahoo to ALonsoVIP4141 Send a message via Skype™ to ALonsoVIP4141
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-04-2022 , 06:44   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #804

There's no need to manually add natives. Just do #include <crxranks> and you won't have to worry about getting something wrong.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
ALonsoVIP4141
BANNED
Join Date: May 2021
Location: https://t.me/pump_upp
Old 06-07-2022 , 12:49   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #805

Quote:
Originally Posted by OciXCrom View Post
There's no need to manually add natives. Just do #include <crxranks> and you won't have to worry about getting something wrong.

Yeah
ALonsoVIP4141 is offline
Send a message via ICQ to ALonsoVIP4141 Send a message via AIM to ALonsoVIP4141 Send a message via Yahoo to ALonsoVIP4141 Send a message via Skype™ to ALonsoVIP4141
per4shK
Junior Member
Join Date: Jan 2022
Location: Georgia
Old 06-07-2022 , 15:26   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #806

Can you make it so we can reset ALL players rank data? I don't want everyone to be max, and I want to reset everyone's stats.
per4shK is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-09-2022 , 14:33   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #807

Quote:
Originally Posted by per4shK View Post
Can you make it so we can reset ALL players rank data? I don't want everyone to be max, and I want to reset everyone's stats.
Simply change the name of the vault file or SQL table where the data is saved (via the .ini file).
Having a command to do this is very dangerous.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
per4shK
Junior Member
Join Date: Jan 2022
Location: Georgia
Old 06-10-2022 , 10:08   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #808

Still the same, not changed. And also I made the language in Georgian (The Country), I've also tested it myself.

Code:
[ge] -- per4shK
CRXRANKS_RANKINFO_NORMAL = Shen gaqvs &x04%i/%i XP&x01. Sheni wodeba aris &x04#%i&x01: &x03%s&x01. Shemdegi wodeba: &x03%s&x01.
CRXRANKS_RANKINFO_FINAL = Shen gaqvs &x04%i XP&x01. Sheni wodeba aris &x04#%i&x01: &x03%s&x01. Shen gaqvs bolo wodeba!
CRXRANKS_GIVE_XP = &x03%s &x01misca &x03%s&x01's &x04%i XP.
CRXRANKS_TAKE_XP = &x03%s &x01waartva &x04%i XP &x03%s&x01'gan.
CRXRANKS_RESET_XP = &x03%s &x01gadatvirta &x03%s&x01's XP.
CRXRANKS_LEVEL_REACHED = &x03%s &x01miagwia &x04Level %i&x01'ze &x01[&x03%s&x01]
CRXRANKS_LEVEL_LOST = &x03%s &x01dabrunda &x04Level %i&x01'ze &x01[&x03%s&x01]
CRXRANKS_MENU_TITLE = \rOciXCrom'is \yWodebis Sistema: \rXP Listi
CRXRANKS_ITEM_FORMAT = \d[%i XP] \w%s \r[\yLevel %i: %s\r]
CRXRANKS_XP_NOTIFIER_GET = +%i XP
CRXRANKS_XP_NOTIFIER_LOSE = -%i XP
CRXRANKS_NOTIFY_KILL_GET = Shen miige &x04%i XP &x01motamashe &x03%s&x01's &x01mokvlistvis.
CRXRANKS_NOTIFY_KILL_LOSE = Shen waage &x04%i XP &x01motamashe &x03%s&x01's &x01mokvlistvis.
CRXRANKS_NOTIFY_SUICIDE_GET = Shen miige &x04%i XP &x01shentavis &x03mokvlistvis&x01.
CRXRANKS_NOTIFY_SUICIDE_LOSE = Shen waage &x04%i XP &x01shentavis &x03mokvlistvis&x01.
CRXRANKS_NOTIFY_DEATH_GET = Shen miige &x04%i XP &x01sikvdilistvis.
CRXRANKS_NOTIFY_DEATH_LOSE = Shen waage &x04%i XP &x01sikvdilistvis.
CRXRANKS_MYSQL_FAILED = MySQL ver chairto. Plagini gamoiyenebs nVault's mis nacvlad.
CRXRANKS_HUDINFO_UNAVAILABLE = HUD informacia &x07gaitisha &x04mier Adminisgan&x01.
CRXRANKS_HUDINFO_ENABLED = HUD informacia &x06Chairto&x01.
CRXRANKS_HUDINFO_DISABLED = HUD informacia &x07Gaitisha&x01.

Last edited by per4shK; 08-13-2022 at 12:00. Reason: grammar mistakes fixed.
per4shK is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-10-2022 , 14:03   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #809

Thanks for the translation.

It cannot be the same if you changed it. After map change it will start reading data from a fresh new file so no old data could possible be there.

You need to change either the VAULT_NAME or SQL_TABLE option depending on which save method you're using.
__________________

Last edited by OciXCrom; 06-10-2022 at 14:05.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
per4shK
Junior Member
Join Date: Jan 2022
Location: Georgia
Old 06-10-2022 , 14:28   Re: OciXCrom's Rank System [XP|Levels|Ranks]
Reply With Quote #810

I did the same thing you said, but the issue still occcurs. If you want detailed info, I renamed/deleted the file in the following path: addons/amxmods/data/vault/CRXRanks.vault I also tried to download the latest version of the Rank System, I already had the latest but I just wanted to try if something changed. Yet the error still occurs. Here's a picture if you wondered, and I'm using FTP.



Last edited by per4shK; 06-10-2022 at 14:29.
per4shK is offline
Reply


Thread Tools
Display Modes

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 10:11.


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