Levels-XP System
Raheem this plugin is not good i see example i'm level 10 and i want to be lvl 11 i need 40,000 exp WTF from where i'll get all this exp ?
please make it more easy for players to up. thanks
please make it more easy for players to up. thanks
You are noob? So these all cvars i add why?
He who fails to plan is planning to fail
where is that cvar who makes it easy ? and fast exp
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
pfff why you are joking give me that cvar..
-
- Veteran Member
- Posts: 678
- Joined: 7 years ago
- Location: Paraguay
- Contact:
It is in the sma :v
Change it :p
Nobody Is That Busy If They Make Time
Ok jhonny then give me your invisible code extra for zombies
Version 1.5 are out. Many things fixed in this version so kindly update your old one.
You should Restart levels by deleting levels.txt and ranks.txt from fVault folder.
This plugin will require AMXMODX v 1.8.3 to compile and to work.
You should Restart levels by deleting levels.txt and ranks.txt from fVault folder.
This plugin will require AMXMODX v 1.8.3 to compile and to work.
He who fails to plan is planning to fail
Bro i can compile it with our compiler? i dont know it's v1.8.2 or v1.8.3
Raheem i wanna do the hud color GREEN for both humans and zombies what i edit on that code?
dude i can not compile this.. test it with compiler v1.8.2 i think i'm using old one.
I uploaded 1.8.3 compiler: http://escapers-zone.xyz/viewtopic.php?f=6&p=3777#p3777
He who fails to plan is planning to fail
Thanks.
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
Nice job, man!
It's job bro not jop
He who fails to plan is planning to fail
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
I have great news for you.
Me & my players still lose our levels.
Me & my players still lose our levels.
This not great news, Second rest your old levels................
He who fails to plan is planning to fail
- sam_bhosale4
- Mod Tester
- Posts: 109
- Joined: 7 years ago
- Location: INDIA
- Contact:
same happening with my server!
few steamers and many non steamers loosing their levels..its just getting reset fix pls!
- Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
- Contact:
I kindly request everyone uses this mod to try this code.
NOTE: if you're using AMXMODX v183, you're gonna get some warning but it won't cause errors.
Good luck.
NOTE: if you're using AMXMODX v183, you're gonna get some warning but it won't cause errors.
Good luck.
Code: Select all
#include <zombie_escape>
// Defines
#define MAX_LEVEL 50
#define MAX_XP 500000
#define TASK_SHOWHUD 2020
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)
#define LEVELUP "levelup_ZE/ze_levelup.wav"
// Constants
new const g_szVaultName[] = "Levels"
new const g_szRankVaultName[] = "Ranks"
// Messages
const Float:HUD_SPECT_X = -1.0
const Float:HUD_SPECT_Y = 0.70
const Float:HUD_STATS_X = -1.0
const Float:HUD_STATS_Y = 0.90
const HUD_STATS_ZOMBIE_R = 200
const HUD_STATS_ZOMBIE_G = 220
const HUD_STATS_ZOMBIE_B = 0
const HUD_STATS_HUMAN_R = 0
const HUD_STATS_HUMAN_G = 200
const HUD_STATS_HUMAN_B = 210
const HUD_STATS_SPEC_R = 100
const HUD_STATS_SPEC_G = 100
const HUD_STATS_SPEC_B = 100
// Variables
new g_iLevel[33], g_iXP[33], g_iMaxXP[33],
Float:g_fDamage[33],
g_MsgSync
// Cvars
new Cvar_ZM_Infect, Cvar_Escape_Success, Cvar_Enable_DMG, Cvar_Required_DMG,
Cvar_DMG_Award, Cvar_Start_XP, Cvar_MaxLevels_Increment, Cvar_MaxXP_FirstLevel,
Cvar_Percentage_Style, Cvar_Start_From_Zero, Cvar_Add_Commas, Cvar_Enable_Rank,
Cvar_Levels_To_Show, Cvar_Save_Time, Cvar_Level_Effects
public plugin_natives()
{
register_native("ze_get_user_xp", "native_ze_get_user_xp", 1)
register_native("ze_set_user_xp", "native_ze_set_user_xp", 1)
register_native("ze_get_user_level", "native_ze_get_user_level", 1)
register_native("ze_set_user_level", "native_ze_set_user_level", 1)
register_native("ze_get_user_max_xp", "native_ze_get_user_max_xp", 1)
register_native("ze_set_user_max_xp", "native_ze_set_user_max_xp", 1)
}
public plugin_precache()
{
precache_sound(LEVELUP)
}
public plugin_init()
{
register_plugin("[ZE] Level-XP System", "1.5", "Raheem/JaCk")
// Hook Chains
RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
// Cvars
Cvar_ZM_Infect = register_cvar("ze_zombie_infect", "3")
Cvar_Escape_Success = register_cvar("ze_escape_success", "5")
Cvar_Enable_DMG = register_cvar("ze_enable_dmg", "1")
Cvar_Required_DMG = register_cvar("ze_required_dmg", "50.0")
Cvar_DMG_Award = register_cvar("ze_dmg_award", "3")
Cvar_Start_XP = register_cvar("ze_start_xp", "50")
Cvar_MaxLevels_Increment = register_cvar("ze_maxlevels_increment", "2.0")
Cvar_MaxXP_FirstLevel = register_cvar("ze_max_xp_first_level", "100")
Cvar_Percentage_Style = register_cvar("ze_enable_percentage_style", "1")
Cvar_Start_From_Zero = register_cvar("ze_new_level_zero_xp", "0")
Cvar_Add_Commas = register_cvar("ze_add_commas_to_xp", "1")
Cvar_Enable_Rank = register_cvar("ze_enable_rank_system", "1")
Cvar_Levels_To_Show = register_cvar("ze_levels_rank_number", "10")
Cvar_Save_Time = register_cvar("ze_save_every", "5.0")
Cvar_Level_Effects = register_cvar("ze_level_up_effects", "1")
// Commands
register_clcmd("say /lvlrank", "Cmd_Rank")
register_clcmd("say_team /lvlrank", "Cmd_Rank")
register_clcmd("say /myrank", "Cmd_Stats")
register_clcmd("say_team /myrank", "Cmd_Stats")
// Messages
g_MsgSync = CreateHudSyncObj()
}
public client_putinserver(id)
{
if(is_user_connected(id))
{
LoadData(id)
set_task(1.0, "Show_Hud", id+TASK_SHOWHUD, _, _, "b")
set_task(get_pcvar_float(Cvar_Save_Time), "Save_Levels", id, _, _, "b")
set_task(0.1, "Check_MaxXP", id, _, _, "b")
}
}
public client_disconnect(id)
{
if(is_user_connected(id))
{
SaveData(id)
}
remove_task(id+TASK_SHOWHUD)
remove_task(id)
}
public Save_Levels(id)
{
SaveData(id)
}
public Check_MaxXP(id)
{
new iCurrentMaxXP = g_iMaxXP[id]
new iMaxXP = get_pcvar_num(Cvar_MaxXP_FirstLevel)
for (new i = 1; i <= g_iLevel[id]; i++)
{
iMaxXP = floatround(float(iMaxXP) * get_pcvar_float(Cvar_MaxLevels_Increment))
}
if (iCurrentMaxXP != iMaxXP)
{
g_iMaxXP[id] = iMaxXP
}
}
public Show_Hud(taskid)
{
new iPlayer = ID_SHOWHUD
if (!is_user_alive(iPlayer))
{
iPlayer = pev(iPlayer, pev_iuser2)
if (!is_user_alive(iPlayer))
return
}
new iRed, iGreen, iBlue
if (ze_is_user_zombie(iPlayer))
{
iRed = HUD_STATS_ZOMBIE_R
iGreen = HUD_STATS_ZOMBIE_G
iBlue = HUD_STATS_ZOMBIE_B
}
else
{
iRed = HUD_STATS_HUMAN_R
iGreen = HUD_STATS_HUMAN_G
iBlue = HUD_STATS_HUMAN_B
}
if (get_pcvar_num(Cvar_Percentage_Style) != 0)
{
if(iPlayer != ID_SHOWHUD)
{
set_hudmessage(HUD_STATS_SPEC_R, HUD_STATS_SPEC_G, HUD_STATS_SPEC_B, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Level: %d | XP: %0.2f %", g_iLevel[iPlayer], (float(g_iXP[iPlayer])/float(g_iMaxXP[iPlayer])) * 100.0)
}
else
{
set_hudmessage(iRed, iGreen, iBlue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Level: %d | XP: %0.2f %", g_iLevel[ID_SHOWHUD], (float(g_iXP[ID_SHOWHUD])/float(g_iMaxXP[ID_SHOWHUD])) * 100.0)
}
}
else
{
if(iPlayer != ID_SHOWHUD)
{
if (get_pcvar_num(Cvar_Add_Commas) == 1)
{
new szSpecXP[15], szSpecMaxXP[15]
AddCommas(g_iXP[iPlayer], szSpecXP, charsmax(szSpecXP))
AddCommas(g_iMaxXP[iPlayer], szSpecMaxXP, charsmax(szSpecMaxXP))
set_hudmessage(HUD_STATS_SPEC_R, HUD_STATS_SPEC_G, HUD_STATS_SPEC_B, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Level: %d | XP: %s/%s", g_iLevel[iPlayer], szSpecXP, szSpecMaxXP)
}
else
{
set_hudmessage(HUD_STATS_SPEC_R, HUD_STATS_SPEC_G, HUD_STATS_SPEC_B, HUD_SPECT_X, HUD_SPECT_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Level: %d | XP: %d/%d", g_iLevel[iPlayer], g_iXP[iPlayer], g_iMaxXP[iPlayer])
}
}
else
{
if (get_pcvar_num(Cvar_Add_Commas) == 1)
{
new szPlayerXP[15], szPlayerMaxXP[15]
AddCommas(g_iXP[ID_SHOWHUD], szPlayerXP, charsmax(szPlayerXP))
AddCommas(g_iMaxXP[ID_SHOWHUD], szPlayerMaxXP, charsmax(szPlayerMaxXP))
set_hudmessage(iRed, iGreen, iBlue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Level: %d | XP: %s/%s", g_iLevel[ID_SHOWHUD], szPlayerXP, szPlayerMaxXP)
}
else
{
set_hudmessage(iRed, iGreen, iBlue, HUD_STATS_X, HUD_STATS_Y, 0, 6.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(ID_SHOWHUD, g_MsgSync, "Level: %d | XP: %d/%d", g_iLevel[ID_SHOWHUD], g_iXP[ID_SHOWHUD], g_iMaxXP[ID_SHOWHUD])
}
}
}
}
public ze_roundend(WinTeam)
{
for(new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
{
if (WinTeam == ZE_TEAM_HUMAN)
{
if(!is_user_alive(id) || ze_is_user_zombie(id))
continue
g_iXP[id] += get_pcvar_num(Cvar_Escape_Success)
}
Check_User_Level(id)
}
remove_task(TASK_SHOWHUD)
}
public Check_User_Level(id)
{
if(!is_user_connected(id))
return
if(g_iXP[id] >= g_iMaxXP[id])
{
if (get_pcvar_num(Cvar_Start_From_Zero) == 1)
{
g_iXP[id] = 0
}
new szName[32]
g_iLevel[id] ++
g_iMaxXP[id] = floatround(float(g_iMaxXP[id]) * get_pcvar_float(Cvar_MaxLevels_Increment))
get_user_name(id, szName, charsmax(szName))
ze_colored_print(0, "!g%s !tNow in Level %i!y!", szName, g_iLevel[id])
PlaySound(id, LEVELUP)
if (get_pcvar_num(Cvar_Level_Effects) != 0)
{
// Screen Fade
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
write_short(4096*2)
write_short(4096*5)
write_short(0x0001)
write_byte(random(256))
write_byte(random(256))
write_byte(random(256))
write_byte(150)
message_end()
// Screen Shake
message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0,0,0}, id)
write_short(255<<14)
write_short(10<<14)
write_short(255<<14)
message_end()
}
}
// Set Him to max if he Higher than Max Value
if(g_iLevel[id] > MAX_LEVEL)
{
g_iLevel[id] = MAX_LEVEL
}
if(g_iXP[id] > MAX_XP)
{
g_iXP[id] = MAX_XP
}
SaveData(id)
}
public ze_user_infected(iVictim, iInfector)
{
if (iInfector == 0 || !is_user_alive(iInfector))
return
g_iXP[iInfector] += get_pcvar_num(Cvar_ZM_Infect)
Check_User_Level(iInfector)
}
public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
// Player Damage Himself
if (iVictim == iAttacker || !is_user_alive(iVictim) || !is_user_alive(iAttacker) || !get_pcvar_num(Cvar_Enable_DMG) ||
get_member(iAttacker, m_iTeam) == get_member(iVictim, m_iTeam)) // Same Team?
return HC_CONTINUE
if (!ze_is_user_zombie(iAttacker) && ze_is_user_zombie(iVictim))
{
// Store Damage For every Player
g_fDamage[iAttacker] += fDamage
// Damage Calculator Equal or Higher than needed damage
if (g_fDamage[iAttacker] >= get_pcvar_float(Cvar_Required_DMG))
{
// Give Player The Coins
g_iXP[iAttacker] += get_pcvar_num(Cvar_DMG_Award)
Check_User_Level(iAttacker)
// Rest The Damage Calculator
g_fDamage[iAttacker] = 0.0
}
}
return HC_CONTINUE
}
LoadData(id)
{
new szData[256], szAuthID[35]
get_user_authid(id, szAuthID, sizeof(szAuthID) - 1)
if (equal(szAuthID, "STEAM_ID_LAN") || equal(szAuthID, "VALVE_ID_LAN"))
return
/*{
new szName[32]
get_user_name(id, szName, charsmax(szName))
if(fvault_get_data(g_szVaultName, szName, szData, charsmax(szData)))
{
new iLevel[32], iXP[32], iMaxLevel[32]
parse(szData, iLevel, charsmax(iLevel), iXP, charsmax(iXP), iMaxLevel, charsmax(iMaxLevel))
g_iLevel[id] = str_to_num(iLevel)
g_iXP[id] = str_to_num(iXP)
g_iMaxXP[id] = str_to_num(iMaxLevel)
}
else
{
g_iLevel[id] = 0
g_iXP[id] = get_pcvar_num(Cvar_Start_XP)
g_iMaxXP[id] = get_pcvar_num(Cvar_MaxXP_FirstLevel)
}
}
else
{*/
if(fvault_get_data(g_szVaultName, szAuthID, szData, sizeof(szData) - 1))
{
new iLevel[32], iXP[32], iMaxLevel[32]
parse(szData, iLevel, sizeof(iLevel) - 1, iXP, sizeof(iXP) - 1, iMaxLevel, sizeof(iMaxLevel) - 1)
g_iLevel[id] = str_to_num(iLevel)
g_iXP[id] = str_to_num(iXP)
g_iMaxXP[id] = str_to_num(iMaxLevel)
}
else
{
g_iLevel[id] = 0
g_iXP[id] = get_pcvar_num(Cvar_Start_XP)
g_iMaxXP[id] = get_pcvar_num(Cvar_MaxXP_FirstLevel)
}
//}
}
SaveData(id)
{
new szAuthID[35], szData[256], szName[32]
get_user_authid(id, szAuthID, sizeof(szAuthID) - 1)
get_user_name(id, szName, sizeof(szName) - 1)
formatex(szData , sizeof(szData) - 1, "%i %i %i", g_iLevel[id], g_iXP[id], g_iMaxXP[id])
// Saves His Data
if (equal(szAuthID, "STEAM_ID_LAN") || equal(szAuthID, "VALVE_ID_LAN"))
return
/*{
new szName[32]
get_user_name(id, szName, charsmax(szName))
fvault_set_data(g_szVaultName, szName, szData)
fvault_set_data(g_szRankVaultName, szName, szAuthID)
}
else
{*/
fvault_set_data(g_szVaultName, szAuthID, szData)
fvault_set_data(g_szRankVaultName, szAuthID, szName)
//}
}
// Rank System Writen by Raheem
public Cmd_Rank(id)
{
if (get_pcvar_num(Cvar_Enable_Rank) == 0)
return
// Max elements in Levels.txt and Rank.txt (They are same)
new iTotal = fvault_size(g_szVaultName)
new szKey[32], // To hold SteamID from Levels.txt
szData[64], // To hold Levels, XP from Levels.txt
szKeyRank[32], // To hold SteamID from Ranks.txt
szDataRank[64] // To hold Names from Ranks.txt
new Array:iLevels, // Dynamic Array to hold all Levels (szData) from Levels.txt
Array:iXPs, // Dynamic Array to hold all XPs (szData) from Levels.txt
Array:szLevelsSteamIDs, // Dynamic Array to hold all SteamIDs (szKey) from Levels.txt
Array:szRankSteamIDs, // Dynamic Array to hold all SteamIDs (szKeyRank) from Ranks.txt
Array:szName // Dynamic Array to hold all Names (szDataRank) from Ranks.txt
// Create Our Arrays with proper lengths [As we don't know iTotal Length so we use Dynamic]
iLevels = ArrayCreate(32)
iXPs = ArrayCreate(32)
szLevelsSteamIDs = ArrayCreate(35)
szRankSteamIDs = ArrayCreate(35)
szName = ArrayCreate(32)
// Some integer counters to be used down
new i, j, iIndex, iShowCount = 0
// Format motd Header
new szMotd[1501], iLen
iLen = formatex(szMotd, charsmax(szMotd), "<body bgcolor=#000000><font color=#CBA50B><h3><pre>")
iLen += formatex(szMotd[iLen], charsmax(szMotd) - iLen, "%-3s %-32s %-11s %s^n", "#", "Name", "# Level", "# XP")
// Loop through all elements in our Levels.txt and Rank.txt
for(i = 0; i < iTotal; i++)
{
// Get SteamID from Levels.txt and save to szKey
fvault_get_keyname(g_szVaultName, i, szKey, charsmax(szKey))
// Get Levels, XP for every SteamID from Levels.txt and save to szData
fvault_get_data(g_szVaultName, szKey, szData, charsmax(szData))
// Get SteamID from Ranks.txt and save to szKeyRank
fvault_get_keyname(g_szRankVaultName, i, szKeyRank, charsmax(szKeyRank))
// Get Name from Ranks.txt and save to szDataRank
fvault_get_data(g_szRankVaultName, szKeyRank, szDataRank, charsmax(szDataRank))
// Spliting szData to Level and XP and Save them
new iLevel[32], iXP[32], iMaxLevel[32]
parse(szData, iLevel, 31, iXP, 31, iMaxLevel, 31)
// Save our Level to Dynamic Array
ArrayPushCell(iLevels, str_to_num(iLevel))
// Save our XP to Dynamic Array
ArrayPushCell(iXPs, str_to_num(iXP))
// Save SteamID comes from Levels.txt to our Dynamic Array
ArrayPushString(szLevelsSteamIDs, szKey)
// Save SteamID from Rank.txt to our Dynamic Array
ArrayPushString(szRankSteamIDs, szKeyRank)
// Save Name comes from Rank.txt to our Dynamic array
ArrayPushString(szName, szDataRank)
}
// Loop through all elements in our Levels Dynamic Array [To Rank like 5, 4, 2, 0]
for (i = 0; i < ArraySize(iLevels); i++)
{
// Every time to compare i with element down him it's i+1
for (j = i + 1; j < ArraySize(iLevels); j++)
{
// The down element is higher than upper one?
if (ArrayGetCell(iLevels, j) > ArrayGetCell(iLevels, i))
{
// If yes change the two elements position (j to come upper and i to be down)
ArraySwap(iLevels, i, j);
ArraySwap(szLevelsSteamIDs, i, j); // Change also for steam so we get ranked steam ids
ArraySwap(iXPs, i, j); // Rank also XP
}
else if (ArrayGetCell(iLevels, j) == ArrayGetCell(iLevels, i)) // They are Equal?
{
// Rank now Depend on Who have much XP
if (ArrayGetCell(iXPs, j) > ArrayGetCell(iXPs, i))
{
ArraySwap(iLevels, i, j);
ArraySwap(szLevelsSteamIDs, i, j);
ArraySwap(iXPs, i, j);
}
}
}
}
// Loop through all elements in our texts
for(i = 0; i < iTotal; i++)
{
new szString[35];
ArrayGetString(szLevelsSteamIDs, i, szString, charsmax(szString))
// Another loop to get same SteamID from Rank.txt like one we get in szString [So we can get player name based on his steamid even if he was offline we already saved his name]
for (j = 0; j < iTotal; j++)
{
// Save SteamID from Ranks.txt to szTemp
new szTemp[35];
ArrayGetString(szRankSteamIDs, j, szTemp, charsmax(szTemp))
// Compare if the two steamids same save this index
if (equal(szString, szTemp))
{
iIndex = j
break
}
}
// Check how much values we formated if more than our cvar break the loop
if (iShowCount >= get_pcvar_num(Cvar_Levels_To_Show))
break
new szNameF[32]
ArrayGetString(szName, iIndex, szNameF, charsmax(szNameF))
if (equal(szNameF, "STEAM_ID_LAN") || equal(szNameF, "VALVE_ID_LAN"))
{
ArrayGetString(szRankSteamIDs, iIndex, szNameF, charsmax(szNameF))
}
else
{
ArrayGetString(szName, iIndex, szNameF, charsmax(szNameF))
}
for (j = 0; j < charsmax(szNameF); j++)
{
if (is_char_mb(szNameF[j]) > 0)
{
szNameF[j] = ' '
}
}
// Add player information to our Motd
iLen += formatex(szMotd[iLen], charsmax(szMotd) - iLen, "%-3d %-32s %-11d %d^n", i + 1, szNameF, ArrayGetCell(iLevels, i), ArrayGetCell(iXPs, i))
// Increase the counter by 1
iShowCount++
}
// Format end of motd
iLen += formatex(szMotd[iLen], charsmax(szMotd) - iLen, "</body></font></h3></pre>")
// Finally Show motd to the player
show_motd(id, szMotd, "Levels Rank")
// Free our memory
ArrayDestroy(iLevels)
ArrayDestroy(iXPs)
ArrayDestroy(szLevelsSteamIDs)
ArrayDestroy(szName)
ArrayDestroy(szRankSteamIDs)
}
public Cmd_Stats(id)
{
// Max elements in Levels.txt and Rank.txt (They are same)
new iTotal = fvault_size(g_szVaultName)
new szKey[32], // To hold SteamID from Levels.txt
szData[64] // To hold Levels, XP from Levels.txt
new Array:iLevels, // Dynamic Array to hold all Levels (szData) from Levels.txt
Array:iXPs // Dynamic Array to hold all XPs (szData) from Levels.txt
// Create Our Arrays with proper lengths [As we don't iTotal Length so we use Dynamic]
iLevels = ArrayCreate(32)
iXPs = ArrayCreate(32)
// Some integer counters to be used down
new i, j
// Loop through all elements in our Levels.txt and Rank.txt
for(i = 0; i < iTotal; i++)
{
// Get SteamID from Levels.txt and save to szKey
fvault_get_keyname(g_szVaultName, i, szKey, charsmax(szKey))
// Get Levels, XP for every SteamID from Levels.txt and save to szData
fvault_get_data(g_szVaultName, szKey, szData, charsmax(szData))
// Spliting szData to Level and XP and Save them
new iLevel[32], iXP[32], iMaxLevel[32]
parse(szData, iLevel, 31, iXP, 31, iMaxLevel, 31)
// Save our Level to Dynamic Array
ArrayPushCell(iLevels, str_to_num(iLevel))
// Save our XP to Dynamic Array
ArrayPushCell(iXPs, str_to_num(iXP))
}
// Loop through all elements in our Levels Dynamic Array [To Rank like 5, 4, 2, 0]
for (i = 0; i < ArraySize(iLevels); i++)
{
// Every time to compare i with element down him it's i+1
for (j = i + 1; j < ArraySize(iLevels); j++)
{
// The down element is higher than upper one?
if (ArrayGetCell(iLevels, j) > ArrayGetCell(iLevels, i))
{
// If yes change the two elements position (j to come upper and i to be down)
ArraySwap(iLevels, i, j);
ArraySwap(iXPs, i, j); // Rank also XP
}
else if (ArrayGetCell(iLevels, j) == ArrayGetCell(iLevels, i)) // They are Equal?
{
// Rank now Depend on Who have much XP
if (ArrayGetCell(iXPs, j) > ArrayGetCell(iXPs, i))
{
ArraySwap(iLevels, i, j);
ArraySwap(iXPs, i, j);
}
}
}
}
new iIndex = 0;
for (i = 0; i < ArraySize(iLevels); i++)
{
if (ArrayGetCell(iLevels, i) == g_iLevel[id] && ArrayGetCell(iXPs, i) == g_iXP[id])
{
iIndex = i
break;
}
}
ze_colored_print(id, "!tYour rank is !g%i !tof !g%i!y.", iIndex + 1, iTotal - 1)
// Free our memory
ArrayDestroy(iLevels)
ArrayDestroy(iXPs)
}
public native_ze_get_user_xp(id)
{
if(!is_user_connected(id))
{
log_amx("[ZE] Invalid Player.")
}
return g_iXP[id]
}
public native_ze_set_user_xp(id, amount)
{
if(!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d).", id)
return false
}
g_iXP[id] = amount
Check_User_Level(id)
return true
}
public native_ze_get_user_level(id)
{
if(!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d).", id)
return -1
}
return g_iLevel[id]
}
public native_ze_set_user_level(id, amount)
{
if(!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d).", id)
return false
}
g_iLevel[id] = amount
if (get_pcvar_num(Cvar_Start_From_Zero) == 1)
{
g_iXP[id] = 0
}
Check_User_Level(id)
return true
}
public native_ze_get_user_max_xp(id)
{
if(!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d).", id)
return -1
}
return g_iMaxXP[id]
}
public native_ze_set_user_max_xp(id, amount)
{
if(!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player (%d).", id)
return -1
}
g_iMaxXP[id] = amount
Check_User_Level(id)
return true
}
This can't help jack... You only removed support for old protocol users..
If someone can report the problem with more details i'll be able to solve it but for now i don't know the problem. Maybe problem from fVault system so we may migrate to another system but need details about the problem.
If someone can report the problem with more details i'll be able to solve it but for now i don't know the problem. Maybe problem from fVault system so we may migrate to another system but need details about the problem.
He who fails to plan is planning to fail
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Sign in
Who is online
Users browsing this forum: No registered users and 3 guests