Member
Join Date: Sep 2011
Location: Belgium
|
01-07-2012
, 18:46
Re: [REQ] XP Mod + Ranks for Deathrun Server
|
#6
|
-You can change rank names in Sma
-You can change Rank levels in Sma
-You can change Level points in sma
-You can change kill points by cvar & sma
-You can change headshot points by cvar & sma
This should normaly Work:
PHP Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <nvault> #define IsPlayer(%1) (1 <= %1 <= g_players) #define TOTALLEVELS 12 new const Levels[TOTALLEVELS] = { 25, 50, 100, 200, 300, 500, 750, 1000, 1250, 1500, 1750, 2000, } new const LevelNames[TOTALLEVELS][] = { "Noob", "Beginner", "Learning", "Knifer", "Rambo", "Butcher", "Matrix", "Probhop", "Freak", "Racer", "Kill Bill", "Respected Player" } new gXP[33], gLevel[33]; new points_kill, points_hs; new g_vault, g_players; public plugin_init() { register_plugin("Deathrun Rank", "1.0", "Rmix"); register_event("DeathMsg", "eDeath", "a"); points_kill = register_cvar("dr_rank_kill", "1"); points_hs = register_cvar("dr_rank_hs","1"); g_vault = nvault_open("DeathrunRank"); g_players = get_maxplayers(); register_logevent ( "CmdRoundStart", 2, "1=Round_Start" ) } public plugin_end() { nvault_close(g_vault); } public eDeath(id) { new killer = read_data(1); new victim = read_data(2); new gpoints_kill = get_pcvar_num(points_kill); new gpoints_hs = get_pcvar_num(points_hs); if( IsPlayer(killer) && is_user_connected(killer) ) { if( victim != killer ) { if( cs_get_user_team(victim) != cs_get_user_team(killer) ) { if( is_user_alive(killer) ) { if(!read_data(3)) { gXP[killer] += gpoints_kill client_print(id,print_chat,"*[DR] You Gained %d Points!", gpoints_kill); } else if(read_data(3)) { gXP[killer] += (gpoints_kill + gpoints_hs); client_print(id,print_chat,"*[DR] You Gained %d Points!", (gpoints_hs + gpoints_kill ) ); } CheckLevel(killer); SaveData(killer); } } } } return PLUGIN_HANDLED; } public CmdRoundStart ( ) { new players [ 32 ], numb, id get_players ( players, numb, "a" ) for ( new i; i < numb; i++ ) { CmdShowHud (id) } } public CheckLevel(id) { if( gXP[id] >= Levels[gLevel[id]] ) { gLevel[id]++; new szName[33]; get_user_name(id, szName, charsmax(szName)); client_print(id,print_chat,"*[DR] Congratulations You are [Level: %i/%i] with Title %s!", gLevel[id], TOTALLEVELS, LevelNames[gLevel[id]-1]); } } public CmdShowHud (id) { set_hudmessage ( 50, 50, 50, -1.0, 0.01 ) show_hudmessage ( id, "*[DR]Level: %i/%i | RankName: %i | Points: $%i", gLevel[id], TOTALLEVELS , LevelNames[gLevel[id]-1], gXP[id] ) set_task ( 0.2, "CmdShowHud", id ) } public client_connect(id) { LoadData(id); } public client_disconnect(id) { SaveData(id); gXP[id] = 0; gLevel[id] = 0; } public SaveData(id) { new AuthID[35]; get_user_authid(id,AuthID,34); new vaultkey[64],vaultdata[256]; format(vaultkey,63,"%s", AuthID); format(vaultdata,255,"%i#%i#",gXP[id],gLevel[id]); nvault_set(g_vault,vaultkey,vaultdata); return PLUGIN_CONTINUE; } LoadData(id) { new AuthID[35]; get_user_authid(id,AuthID,34); new vaultkey[64],vaultdata[256]; format(vaultkey,63,"%s",AuthID); format(vaultdata,255,"%i#%i#",gXP[id],gLevel[id]); nvault_get(g_vault,vaultkey,vaultdata,255); replace_all(vaultdata, 255, "#", " "); new playerxp[32], playerlevel[32]; parse(vaultdata, playerxp, 31, playerlevel, 31); gXP[id] = str_to_num(playerxp); gLevel[id] = str_to_num(playerlevel); return PLUGIN_CONTINUE; }
__________________
- Ol' Dirty Bastard - Brooklyn Zoo -
This style, I'm mastered in
Niggas catchin' headaches, what, what? You need Aspirin?
This type of pain, you couldn't even kill with Midol
Fuck around, get sprayed with Lysol
in your face like a can of mace, baby Is it burnin'? Well, fuck it, now you're learnin'
Last edited by Zer0Cool; 01-08-2012 at 04:03.
|
|