Raised This Month: $70 Target: $400
 17% 

Rank System [ Ranks | Levels | EXP ]


Post New Thread Reply   
 
Thread Tools Display Modes
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-11-2020 , 07:24   Re: Rank System [ Ranks | Levels | EXP ]
Reply With Quote #11

charsmax = sizeof - 1

Also, those small hardcoded details are nothing compared to the entire ranks and XP being hardcoded, lacking a configuration file.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Supremache
BANNED
Join Date: Sep 2019
Location: Egypt
Old 10-11-2020 , 08:17   Re: Rank System [ Ranks | Levels | EXP ]
Reply With Quote #12

Well..
Supremache is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 10-11-2020 , 14:39   Re: Rank System [ Ranks | Levels | EXP ]
Reply With Quote #13

Quote:
Originally Posted by Supremache View Post
Well..
OciXCrom is right, take your time to study plugins that use .cfg files to configure the plugin. At the moment, users have to edit the code which is not efficient.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Supremache
BANNED
Join Date: Sep 2019
Location: Egypt
Old 10-11-2020 , 20:31   Re: Rank System [ Ranks | Levels | EXP ]
Reply With Quote #14

Quote:
Originally Posted by Napoleon_be View Post
OciXCrom is right, take your time to study plugins that use .cfg files to configure the plugin. At the moment, users have to edit the code which is not efficient.
I think I have experience to do ini file and cfg file but I want to make a new options like what you said.
Supremache is offline
Mohamed null
BANNED
Join Date: Sep 2020
Location: Algeria
Old 10-18-2020 , 11:33   Re: Rank System [ Ranks | Levels | EXP ]
Reply With Quote #15

Take this bro
Edit it
Add
!gEscape: !g
!gLevel: !g

!gCoins: !g
!gVips Online: !g
Quote:
#include < amxmodx >
#include < cstrike >
#include < amxmisc >
#include < fun >
#include < nvault >
#include < hamsandwich >

#define cm(%0) ( sizeof(%0) - 1 )
#define MAXLEVEL 100

new const g_szLevelUp[] = { "items/nvg_on.wav" };

#if !defined MAX_NAME_LENGTH
const MAX_NAME_LENGTH = 512
#endif

#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32
#endif

enum _:mData {
m_szRankName[ 32 ],
m_iRankESCAPE
};

new const g_mPlayerData[ ][ mData ] = {
{ "Lvl", 30 },
{ "Lvl", 60 },
{ "Lvl", 90 },
{ "Lvl", 130 },
{ "Lvl", 200 },
{ "Lvl", 280 },
{ "Lvl", 310 },
{ "Lvl", 400 },
{ "Lvl", 495 },
{ "Lvl", 600 },
{ "Lvl", 655 },
{ "Lvl", 755 },
{ "Lvl", 900 },
{ "Lvl", 1000 },
{ "Lvl", 1500 },
{ "Lvl", 2500 },
{ "Lvl", 3650 },
{ "Lvl", 4768 },
{ "Lvl", 6100 },
{ "Lvl", 6955 },
{ "Lvl", 8515 },
{ "Lvl", 9590 },
{ "Lvl", 19500 },
{ "Lvl", 25135 },
{ "Lvl", 30000 },
{ "Lvl", 55000 },
{ "Lvl", 75000 },
{ "Lvl", 100000 },
{ "Lvl", 133000 },
{ "Lvl", 151000 },
{ "Lvl", 170000 },
{ "Lvl", 190000 },
{ "Lvl", 211000 },
{ "Lvl", 233000 },
{ "Lvl", 256000 },
{ "Lvl", 280000 },
{ "Lvl", 305000 },
{ "Lvl", 331000 },
{ "Lvl", 358000 },
{ "Lvl", 386000 },
{ "Lvl", 415000 },
{ "Lvl", 445000 },
{ "Lvl", 476000 },
{ "Lvl", 508000 },
{ "Lvl", 541000 },
{ "Lvl", 575000 },
{ "Lvl", 610000 },
{ "Lvl", 646000 },
{ "Lvl", 683000 },
{ "Lvl", 721000 },
{ "Lvl", 760000 },
{ "Lvl", 800000 },
{ "Lvl", 842000 },
{ "Lvl", 886000 },
{ "Lvl", 974000 },
{ "Lvl", 1020000 },
{ "Lvl", 1068000 },
{ "Lvl", 1118000 },
{ "Lvl", 1170000 },
{ "Lvl", 1224000 },
{ "Lvl", 1280000 },
{ "Lvl", 1338000 },
{ "Lvl", 1398000 },
{ "Lvl", 1460000 },
{ "Lvl", 1524000 },
{ "Lvl", 1590000 },
{ "Lvl", 1658000 },
{ "Lvl", 1728000 },
{ "Lvl", 1800000 },
{ "Lvl", 1874000 },
{ "Lvl", 1950000 },
{ "Level", 7777777 }
};

// Integers
new g_iPlayerEscape[ 33 ] = 0;
new g_iPlayerLevel[ 33 ] = 0;

// Cvars
new g_Vault;
new g_SaveESCAPE, g_SaveType;
new g_HudRank, g_KillESCAPE, g_HeadShotESCAPE, g_GrenadeESCAPE, g_KnifeESCAPE;

// Hud
new SyncHudRankSystem;

public plugin_init()
{
// Register Plugin
register_plugin( "RankLevelESCAPESystem", "2.0", "Supremache" );

// Register Events
register_event( "DeathMsg", "Event_DeathMsg", "a" );

// Save ESCAPE
g_SaveType = register_cvar("levels_savetype","0") // Save Escape to : 0 = NVault.
g_SaveESCAPE = register_cvar("levels_save","1") // Save Escape by : 2 = Name, 1 = SteamID, 0 = IP.

// Register ESCAPE Kill Bonus & Hud Rank
g_HudRank = register_cvar( "hud_rank", "1" );
g_KillESCAPE = register_cvar( "kill_escape", "1" );
g_HeadShotESCAPE = register_cvar( "hs_escape", "2" );
g_GrenadeESCAPE = register_cvar( "he_escape", "2" );
g_KnifeESCAPE = register_cvar( "knife_escape", "3" );

// Register Client Commands
register_clcmd( "say /manage", "cmdManagePlayers", ADMIN_RCON);
register_clcmd( "say /escape", "cmdESCAPE", ADMIN_ALL );

// Register Hud
SyncHudRankSystem = CreateHudSyncObj( );
}

public plugin_cfg( )
{
//Open our vault and have g_Vault store the handle.
g_Vault = nvault_open("RankSystem")

//Make the plugin error if vault did not successfully open
if ( g_Vault == INVALID_HANDLE )
set_fail_state( "Error opening Rank System nVault, file does not exist!" )
}


public client_putinserver( id )
{
if(get_pcvar_num(g_HudRank) == 1)
set_task(1.0, "ShowHudRank", id, _, _, "b")

LoadData( id );
}


public client_disconnect( id )
{
SaveData( id );
}

public plugin_precache()
{
precache_sound(g_szLevelUp)
}

public ShowHudRank(id)
{
set_hudmessage(0, 255, 255, 0.01, 0.18, 0, 6.0, 1.0, 0.0, 0.0, -1)
ShowSyncHudMsg(id, SyncHudRankSystem,"[ Name: %s ]^n[ Rank: %s ]^n[ EXP: %i / %i ]^n[ Level: %i / %i ]",
get_nick(id),
g_mPlayerData[ g_iPlayerLevel[ id ] ][ m_szRankName ],
g_iPlayerESCAPE[ id ],
g_mPlayerData[ g_iPlayerLevel[ id ] + 1 ][ m_iRankESCAPE ],
g_iPlayerLevel[id],
MAXLEVEL );

}


public Event_DeathMsg( )
{
new iKiller = read_data( 1 );
new iVictim = read_data( 2 );

if( iKiller == iVictim|| ! is_user_connected( iKiller ) || ! is_user_connected( iVictim ) )
return;

new ESCAPEAmount = get_pcvar_num( g_KillESCAPE );

if( read_data( 3 ) )
ESCAPEAmount += get_pcvar_num( g_HeadShotESCAPE );

static sWeapon[ 26 ];

read_data( 4, sWeapon, sizeof( sWeapon ) - 1 );

if( equal( sWeapon, "hegrenade" ) )
ESCAPEAmount += get_pcvar_num( g_GrenadeESCAPE );

else if( equal( sWeapon, "knife" ) )
ESCAPEAmount += get_pcvar_num( g_KnifeESCAPE );

g_iPlayerESCAPE[ iKiller ] += ESCAPEAmount;

CheckLevel(iKiller);

}


//////////////////////////////////////////
/* RANK ESCAPE LIST */
//////////////////////////////////////////

public cmdESCAPEList(id, iLevel, iCid)
{
if(!cmd_access(id, iLevel, iCid, 1))
{
return PLUGIN_HANDLED
}
if(is_user_bot(id))
{
return PLUGIN_HANDLED
}

new szTitle[128]
formatex(szTitle, charsmax(szTitle), "\yRank System: \rESCAPE List")

new iPlayers[MAX_PLAYERS], iPnum, iMenu = menu_create(szTitle, "ESCAPEList_Handler")
get_players(iPlayers, iPnum); SortCustom1D(iPlayers, iPnum, "sort_players_by_escape")

for(new szItem[1024], szName[MAX_NAME_LENGTH], iPlayer, i; i < iPnum; i++)
{
iPlayer = iPlayers[i]
get_user_name(iPlayer, szName, charsmax(szName));
formatex(szItem, charsmax(szItem), "\d[%i ESCAPE] \w%s \r[\yLevel %i: %s\r]",
g_iPlayerESCAPE[ iPlayer ],
szName,
g_iPlayerLevel[ iPlayer ],
g_mPlayerData[ g_iPlayerLevel[ iPlayer ] ][ m_szRankName ]);
menu_additem(iMenu, szItem)
}

menu_display(id, iMenu)
return PLUGIN_HANDLED
}

public ESCAPEList_Handler(id, iMenu, iItem)
{
menu_destroy(iMenu)
return PLUGIN_HANDLED
}
public sort_players_by_escape(id1, id2)
{
return g_iPlayerESCAPE[id2] - g_iPlayerESCAPE[id1]
}

//////////////////////////////////
/* MANAGE PLAYERS RANKS */
//////////////////////////////////
public cmdManagePlayers( id, iLevel, iCid) {
if(!cmd_access(id, iLevel, iCid, 1))
return PLUGIN_HANDLED

new szTitle[128]
formatex(szTitle, charsmax(szTitle), "\yManage Player Ranks\r:")

new menu = menu_create(szTitle, "Players_Handler")

new iPlayers[ 32 ], iNum, i, Players;
new szUserID[ 32 ], szName[ 64 ];
get_players( iPlayers, iNum );
for( i = 0; i < iNum; i++ ) {
Players = iPlayers[ i ];

formatex( szName, cm( szName ), "%s ( \r%s \y- \rLv. %d\w )", get_nick( Players ), g_mPlayerData[ g_iPlayerLevel[ Players ] ][ m_szRankName ], g_iPlayerLevel[ Players ]);
formatex( szUserID, cm( szUserID ), "%d", get_user_userid( Players ) );
menu_additem( menu, szName, szUserID );
}

menu_display( id, menu );
return PLUGIN_HANDLED;
}

public Players_Handler( id, menu, item ) {
if( item == MENU_EXIT ) {
menu_destroy( menu );
return PLUGIN_HANDLED;
}

new item_access, callback;
new info[ 64 ], name[ 32 ];

menu_item_getinfo( menu, item, item_access, info, cm( info ), name, cm( name ), callback );

new userid = str_to_num( info );

new player = find_player( "k", userid );

ChoosePlayerRank( id, player );

return PLUGIN_HANDLED;
}

public ChoosePlayerRank( index, Choosen ) {
new szTitle[ 101 ], szChoosen[ 5 ];
formatex( szTitle, cm( szTitle ), "Change \r%s \y(\rlv. %d\y) Rank To:", get_nick( Choosen ), g_iPlayerLevel[ Choosen ] );
new menu = menu_create( szTitle, "PlayerRank_Handler" );

num_to_str( Choosen, szChoosen, cm( szChoosen ) );

for( new i = 0; i < sizeof( g_mPlayerData ); i++ )
menu_additem( menu, g_mPlayerData[ i ][ m_szRankName ], szChoosen );

menu_display( index, menu );
return PLUGIN_HANDLED;
}

public PlayerRank_Handler( id, menu, item ) {
if( item == MENU_EXIT ) {
menu_destroy( menu );
return PLUGIN_HANDLED;
}

new item_access, callback;
new info[ 64 ], name[ 32 ];

menu_item_getinfo( menu, item, item_access, info, cm( info ), name, cm( name ), callback );

new player = str_to_num( info );

g_iPlayerESCAPE[ player ] = g_mPlayerData[ item ][ m_iRankESCAPE ];
g_iPlayerLevel[ player ] = item;

RankChat(player, "!g[ADMIN]!g %s!n: has changed your rank to!g %s!n (!gLv. %d!n)",
get_nick( id ),
g_mPlayerData[ g_iPlayerLevel[ id] ][ m_szRankName ],
g_iPlayerLevel[id]);

menu_destroy( menu );
return PLUGIN_HANDLED;
}


//////////////////////////////////
/* CKECK LEVEL */
//////////////////////////////////

public CheckLevel( index )
{
if( g_iPlayerLevel[ index ] < MAXLEVEL ) {
if( g_iPlayerESCAPE[ index ] >= g_mPlayerData[ g_iPlayerLevel[ index ] + 1 ][ m_iRankESCAPE ] ) {
g_iPlayerLevel[ index ]++;

client_cmd(index, "spk %s", g_szLevelUp)
RankChat(0, "!g[RankSystem]!n Player!g %s!n have been promoted to!g %s!n (!gLv. %d!n)", get_nick( index ), g_mPlayerData[ g_iPlayerLevel[ index ] ][ m_szRankName ], g_iPlayerLevel[ index ] );
}
}
}

//////////////////////////////////
/* SAVE/LOAD STOCKS */
//////////////////////////////////
SaveData(id)
{
new szAuth[33];
new szKey[64];

if (get_pcvar_num(g_SaveESCAPE) == 0)
{
get_user_ip(id, szAuth , charsmax(szAuth), 1)
formatex(szKey , 63 , "%s-IP" , szAuth)
}
else if (get_pcvar_num(g_SaveESCAPE) == 1)
{
get_user_authid(id , szAuth , charsmax(szAuth))
formatex(szKey , 63 , "%s-ID" , szAuth)
}
else if (get_pcvar_num(g_SaveESCAPE) == 2)
{
get_user_name(id, szAuth , charsmax(szAuth))
formatex(szKey , 63 , "%s-NAME" , szAuth)
}

if (!get_pcvar_num(g_SaveType))
{
new szData[256]

formatex(szData , 255 , "%i#%i#" , g_iPlayerLevel[id], g_iPlayerESCAPE[id])

nvault_pset(g_Vault , szKey , szData)
}
}

LoadData(id)
{
new szAuth[33];
new szKey[40];

if (get_pcvar_num(g_SaveESCAPE) == 0)
{
get_user_ip(id, szAuth , charsmax(szAuth), 1)
formatex(szKey , 63 , "%s-IP" , szAuth)
}
else if (get_pcvar_num(g_SaveESCAPE) == 1)
{
get_user_authid(id , szAuth , charsmax(szAuth))
formatex(szKey , 63 , "%s-ID" , szAuth)
}
else if (get_pcvar_num(g_SaveESCAPE) == 2)
{
get_user_name(id, szAuth , charsmax(szAuth))
formatex(szKey , 63 , "%s-NAME" , szAuth)
}

if (!get_pcvar_num(g_SaveType))
{
new szData[256];

formatex(szData , 255, "%i#%i#", g_iPlayerLevel[id], g_iPlayerESCAPE[id])

nvault_get(g_Vault, szKey, szData, 255)

replace_all(szData , 255, "#", " ")
new escape[32], level[32]
parse(szData, level, 31, xp, 31)
g_iPlayerLevel[id] = str_to_num(level)
g_iPlayerESCAPE[id] = str_to_num(escape)
}
}

///////////////////////////////////
/* STOCKS */
///////////////////////////////////
stock RankChat( id, String[ ], any:... ) {
static szMsg[ 192 ];
vformat( szMsg, charsmax( szMsg ), String, 3 );

replace_all( szMsg, charsmax( szMsg ), "!n", "^1" );
replace_all( szMsg, charsmax( szMsg ), "!t", "^3" );
replace_all( szMsg, charsmax( szMsg ), "!g", "^4" );

static msgSayText = 0;
if( !msgSayText ) msgSayText = get_user_msgid( "SayText" );

new Players[ 32 ], iNum = 1, i;

if( id ) Players[ 0 ] = id;
else get_players( Players, iNum, "ch" );

for( --iNum; iNum >= 0; iNum-- ) {
i = Players[ iNum ];

message_begin( MSG_ONE_UNRELIABLE, msgSayText, _, i );
write_byte( i );
write_string( szMsg );
message_end( );
}
}

stock get_nick( index ){
new szName[ 32 ]; get_user_name( index, szName, cm( szName ) );
return szName;
}

///////////////////////////////////
/* NATIVES */
///////////////////////////////////
public plugin_natives()
{
register_native("get_user_escape", "_get_user_escape")
register_native("set_user_escape", "_set_user_escape")
register_native("get_user_max_escape", "_get_user_max_escape")
register_native("get_user_level", "_get_user_level")
register_native("set_user_level", "_set_user_level")
register_native("get_user_rank", "_get_user_rank")
}

// Native: get_user_escape
public _get_user_escape(iPlugin,iParams)
{
return g_iPlayerESCAPE[ get_param( 1 ) ]
}

// Native: set_user_escape
public _set_user_escape(iPlugin,iParams)
{
g_iPlayerESCAPE[ get_param( 1 ) ] = get_param( 2 );

CheckLevel( get_param( 1 ) );
}


// Native: get_user_level
public _get_user_level(iPlugin,iParams)
{
return g_iPlayerLevel[ get_param( 1 ) ]
}

// Native: set_user_level
public _set_user_level(iPlugin,iParams)
{
g_iPlayerLevel[ get_param( 1 ) ] = get_param( 2 );

CheckLevel( get_param( 1 ) );
}

// Native: get_user_max_escape
public _get_user_max_escape(iPlugin,iParams)
{
new iMaxLevel
if(g_iPlayerLevel[get_param( 1 )] > (MAXLEVEL-1))
iMaxLevel = g_mPlayerData[ MAXLEVEL ][ m_iRankESCAPE ]
else
iMaxLevel = g_mPlayerData[ g_iPlayerLevel[ get_param( 1 ) ] + 1 ][ m_iRankESCAPE ]

return iMaxLevel
}

public _get_user_rank(iPlugin,iParams)
{
set_string(2, g_mPlayerData[ g_iPlayerLevel[ get_param(1) ] ][ m_szRankName ], get_param(3))
}

///////////////////////////////////
/* PLUGIN END */
///////////////////////////////////

public plugin_end( )
{
//Close the vault when the plugin ends (map change\server shutdown\restart)
nvault_close(g_Vault)
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* RANK - LEVEL - ESCAPE SYSTEM BY SUPREMACHE */
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ fbidis\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ ltrpar\\ lang3073\\ f0\\ fs16 \n\\ par }
*/
Mohamed null is offline
Mohamed null
BANNED
Join Date: Sep 2020
Location: Algeria
Old 10-18-2020 , 11:37   Re: Rank System [ Ranks | Levels | EXP ]
Reply With Quote #16

PLS ADD When i got Lvl1 = +1speed
MAXSPEED Lvl100= 310SPEED

Add cvars EXP not XP pls
And add Escape
Escape = Kill zombie get 1Escape or last humans win = 2escape
120Hits Damage = 200Coins + 5Escapes
Escape: 05/30 = Level 1
Level: 0

Coins: 200
with coins u can buy VIP FOR 10 Days 10000Coins = VIP ACCESS no fall damage + skin neo + knife new + 10 days EXPIRE TIME after 10 days ..
----------
That's it its so hard
Mohamed null is offline
Mohamed null
BANNED
Join Date: Sep 2020
Location: Algeria
Old 10-18-2020 , 11:38   Re: Rank System [ Ranks | Levels | EXP ]
Reply With Quote #17

i no want the Tags
Like newbie i want replace on it [Lvl1] [OWNER] null:
Mohamed null is offline
Mohamed null
BANNED
Join Date: Sep 2020
Location: Algeria
Old 10-18-2020 , 11:40   Re: Rank System [ Ranks | Levels | EXP ]
Reply With Quote #18

I want it like this pls
add
Escape: !g0/30
Level: !g0

Coins: !g0
Vips Online: !g0
Attached Images
File Type: jpg bandicam 2020-10-17 19-37-56-003.jpg (45.1 KB, 9 views)
Mohamed null 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 13:57.


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