#include <amxmodx>
#include <fvault>
#include <cstrike>
#include <wm_play>
#define maxranks 100
#define maxlevels 100
#define xPrefix "XP System"
#define RANKS_Boogeyman 0
#define RANKS_Cha-Cha-Man 1
#define RANKS_Crazy-Zebra 2
#define RANKS_Friendly-Ghost 3
#define RANKS_Stiches 4
#define RANKS_Lucky-Rabbit 5
#define RANKS_Blind-Eyed 6
#define RANKS_Killjoy 7
#define RANKS_Your-Father 8
#define RANKS_You-are-a-cunt 9
#define RANKS_Nightmare-Monster 10
#define RANKS_Final-Death 11
#define RANKS_Camelot-Sorcerer 12
#define RANKS_Bugghy-The-Frog 13
#define RANKS_Whack-Whack 14
#define RANKS_Burning-Oz 15
#define RANKS_Strangler 16
#define RANKS_Doorbell-Killer 17
#define RANKS_Help-Me-I-am-New 18
#define RANKS_Faithful-Assistant 19
#define RANKS_Pennywise 20
#define RANKS_Gurgles-The-Clown 21
#define RANKS_Stupid-Friend 22
#define RANKS_Shake-Your-Body 23
#define RANKS_Chucky-Bunny 24
#define RANKS_Clown-Boy 25
#define RANKS_Quiet-Grandpa 26
#define RANKS_Sabertooth 27
#define RANKS_Grisly-Madness 28
#define RANKS_Satans-Stronghold 29
#define RANKS_Bishop 30
#define RANKS_Meatball 31
#define RANKS_Horror-Demon 32
#define RANKS_Devil-Void 33
#define RANKS_Royal-Mentor 34
#define RANKS_High-Priest 35
#define RANKS_Alpha-King 36
#define RANKS_Dried-Mouse 37
#define RANKS_Da-Boss 38
#define RANKS_FaceAsTable 39
#define RANKS_Mickey-The-Cobra 40
#define RANKS_Funcky-Man 41
#define RANKS_Gaz-Man 42
#define RANKS_Goddess-of-smiles 43
#define RANKS_Y'aLL-Can-Kiss-My-Ass 44
#define RANKS_The-Prophet 45
#define RANKS_Shoot-Twice-And-Go-Home 46
#define RANKS_Really-i'm-Hungry.... 47
#define RANKS_Mr-Scrappy 48
#define RANKS_That's-All-You-Got? 49
#define RANKS_Splay-Toed 50
#define RANKS_Mister-Great-Aspargus 51
#define RANKS_Bad-Axe-Murderer 52
#define RANKS_Physically-Challenged 53
#define RANKS_Was-That-a-HeadShot? 54
#define RANKS_Slack-Jawed 55
#define RANKS_Ball-Chaser 56
#define RANKS_Drool-Faced 57
#define RANKS_Snaggle-Toothed 58
#define RANKS_Night-Barking 59
#define RANKS_Sleep-Runner 60
#define RANKS_Sly-Tinkler 61
#define RANKS_Here-is-Your-Biggest-Nightmare 62
#define RANKS_Pile-Driver 63
#define RANKS_Sorry,-I-Scared-You? 64
#define RANKS_Bone-Burier 65
#define RANKS_Rag-Puller 66
#define RANKS_Vaguely-Obsessive 67
#define RANKS_Tragically-Handsome 68
#define RANKS_Vodoo-Thrower 69
#define RANKS_Flo-Eared 70
#define RANKS_Grim-Face 71
#define RANKS_Grave-Digger 72
#define RANKS_Pass-the-Joint 73
#define RANKS_Crotch-Sniffer 74
#define RANKS_Hi,-I'm-Grinch 75
#define RANKS_Hey,-You-Lost-Your-Head 76
#define RANKS_Kid,-You-Want-a-Candy? 77
#define RANKS_Hold-My-Knife-Please 78
#define RANKS_Bitch,-I'm-Famous 79
#define RANKS_1-Bullet,-2-Headshots 80
#define RANKS_NightWalker 81
#define RANKS_Ha-..-Your-Girlfriend-is-My-... 82
#define RANKS_Carpet-Cleaner 83
#define RANKS_Skull-Crusher 84
#define RANKS_Want-Some-CS-Lessons? 85
#define RANKS_Blood-Everywhere 86
#define RANKS_Allahu-Akhbar 87
#define RANKS_Buffering-Pornhub 88
#define RANKS_Hell-Raiser 89
#define RANKS_Dead-Stalker 90
#define RANKS_Spooky-Neighbour 91
#define RANKS_Spell-Binder 92
#define RANKS_Easy-Hold-My-AK 93
#define RANKS_Best-Player-Around 94
#define RANKS_Out-of-the-Mist 95
#define RANKS_One-Creepy-Kid 96
#define RANKS_I-Am-A-Grim-Sleeper 97
#define RANKS_Headless-Horseman 98
#define RANKS_Midnight-Predator 99
new const VERSION[] = "1.1"
new SzMaxPlayers, SzSayText;
new playerPrefix,rankLevelBonus,rankSaveType;
new const db_save[] = "cs_rank_system"
new level[33], xp[33], rank[33], g_status_sync
new SzGTeam[3][] = {
"Spectator",
"Terrorist",
"Counter-Terrorist"
}
new const xp_num[maxlevels+1] =
{
50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500,
1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3150, 3300, 3450, 3600,
3750, 3900, 4150, 4300, 4450, 4600, 4750, 4900, 5050, 5200, 5350, 5500, 5650, 5800, 6000, 6200, 6400, 6600, 6800, 7000, 7200, 7400, 7600, 7800, 8000, 8300, 8600, 8900, 9200, 9500,
9800, 10100, 10500, 10900, 11300, 11700, 12100, 12500, 12900, 13300, 13700, 14100, 14600, 15100, 15600, 16100, 16600, 17100, 17600,
18100, 18600, 19100, 19600, 20100, 21300, 22000, 23000, 24000, 25250, 26500, 28000, 30000,
}
new const ranks_names[maxranks][]=
{
"Boogeyman",
"Cha Cha Man",
"Crazy Zebra",
"Friendly Ghost",
"Stiches",
"Lucky Rabbit",
"Blind Eyed",
"Killjoy",
"Your Father",
"You are a cunt",
"Nightmare Monster",
"Final Death",
"Camelot Sorcerer",
"Bugghy The Frog",
"Whack Whack",
"Burning Oz",
"Strangler",
"Doorbell Killer",
"Help Me ! I am New",
"Faithful Assistant",
"Pennywise",
"Gurgles The Clown",
"Stupid-Friend",
"Shake Your Body",
"Chucky Bunny",
"Clown Boy",
"Quiet Grandpa",
"Sabertooth",
"Grisly Madness",
"Satans Stronghold",
"Bishop",
"Meatball",
"Horror Demon",
"Devil Void",
"Royal Mentor",
"High Priest",
"Alpha King",
"Dried Mouse",
"Da Boss",
"Face As Table",
"Mickey The Cobra",
"Funcky Man",
"Gaz Man",
"Goddess of smiles",
"Y'aLL Can Kiss My Ass ",
"The Prophet",
"Shoot Twice And Go Home",
"Really...i'm Hungry.... ",
"Mr. Scrappy",
"That's All You Got?",
"Splay Toed",
"The Great Aspargus",
"Bad Axe Murderer",
"Physically Challenged",
"Was That a HeadShot?",
"Slack Jawed",
"Ball Chaser",
"Drool Faced",
"Snaggle Toothed",
"Night Barking",
"Sleep Runner",
"Sly Tinkler",
"Your Biggest Nightmare",
"PileDriver",
"Sorry, I Scared You?",
"Bone Burier",
"Rag Puller",
"Vaguely Obsessive",
"Tragically Handsome",
"Vodoo Thrower",
"Flo Eared",
"Grim Face",
"The Grave Digger",
"Pass the Joint",
"Crotch Sniffer",
"Hi, I'm Grinch",
"Hey, You Lost Your Head",
"Kid, You Want a Candy?",
"Hold My Knife Please",
"Bitch, I'm Famous",
"1 Bullet, 2 Headshots",
"NightWalker",
"Ha...Your Girlfriend is My ...",
"Carpet Cleaner",
"Skull Crusher",
"Want Some CS Lessons?",
"Blood Everywhere",
"Allahu Akhbar",
"Buffering Pornhub",
"Hell Raiser",
"Dead Stalker",
"Spooky Neighbour",
"Spell Binder",
"Easy, Hold My AK",
"Best Player Around",
"Out of the Mist",
"One Creepy Kid",
"I am a Grim Sleeper",
"Headless Horseman",
"Midnight Predator"
}
public plugin_init()
{
register_plugin("XP + LEVEL + RANK SYSTEM", VERSION, AUTHOR)
// system of xp+lvl+rank
playerPrefix = register_cvar("Player Prefix", "1") //1-Prefix by RANK, 2-Prefix by LEVEL
rankLevelBonus = register_cvar("Level Up Bonus", "10000") // Amount of money when passing level.
rankSaveType = register_cvar("XP Save Type", "2") // 1 - IP || 2 - Nick || 3 - SteamID
register_cvar("XPLvlRankSystem", VERSION, FCVAR_SERVER | FCVAR_SPONLY ) //Search for variable on Gametracker.com
register_event("StatusValue", "showStatus", "be", "1=2", "2!0")
register_event("StatusValue", "hideStatus", "be", "1=1", "2=0")
register_clcmd("say", "hook_say");
register_clcmd("say_team", "hook_say_team");
register_dictionary("cs_rank_system.txt");
SzSayText = get_user_msgid ("SayText");
SzMaxPlayers = get_maxplayers();
register_message(SzSayText, "MsgDuplicate");
g_status_sync = CreateHudSyncObj()
}
/*----------------------------------------------------------------------------------------------------------------
-HUD OF THE GAME
----------------------------------------------------------------------------------------------------------------*/
public hud_status(id)
{
if(!is_user_alive(id) || !is_user_connected(id) )
return;
if(level[id] >= maxlevels)
{
static r, g, b; r = random_num(0, 255), g = random_num(0, 255), b = random_num(0, 255);
set_hudmessage(r, g, b, -1.0, 0.9, 0, 1.0, 1.1, 0.0, 0.0, -1)
show_hudmessage(id,"» Level: %d/%d^n» Rank: %s^n» XP: %d/%d", level[id], maxlevels, ranks_names[rank[id]], xp[id], xp[id])
}
else
{
set_hudmessage(0, 128, 0, 0.8, 0.2, _, _, 1.0, _, _, 1)
show_hudmessage(id,"» Level: [ %d --> %d ]^n» Rank: ~~ %s ~~^n» XP: [ %d --> %d ]", level[id], maxlevels, ranks_names[rank[id]], xp[id], xp_num[level[id]])
}
}
/*----------------------------------------------------------------------------------------------------------------
-CHAT PREFIX
----------------------------------------------------------------------------------------------------------------*/
public MsgDuplicate(id){ return PLUGIN_HANDLED; }
public hook_say(id)
{
new SzMessages[192], SzName[32];
new SzAlive = is_user_alive(id);
read_args(SzMessages, 191);
remove_quotes(SzMessages);
get_user_name(id, SzName, 31);
if(!is_valid_msg(SzMessages))
return PLUGIN_CONTINUE;
switch(get_pcvar_num(playerPrefix))
{
case 1 :(SzAlive ? format(SzMessages, 191, "^4[%s]^1~ ^3%s : ^1%s", ranks_names[rank[id]], SzName, SzMessages) : format(SzMessages, 191, "^1*DEAD* ^1[^4%s^1] ^3%s : ^1%s", ranks_names[rank[id]], SzName, SzMessages));
case 2 :(SzAlive ? format(SzMessages, 191, "^2[^2Level^2] %d] ^1%s : ^1%s", level[id], SzName, SzMessages) : format(SzMessages, 191, "^1*DEAD* ^1[^4Level %d^1] ^3%s : ^1%s", level[id], SzName, SzMessages));
}
for(new i = 1; i <= SzMaxPlayers; i++)
{
if(!is_user_connected(i))
continue;
message_begin(MSG_ONE, get_user_msgid("SayText"), {0, 0, 0}, i);
write_byte(id);
write_string(SzMessages);
message_end();
}
return PLUGIN_CONTINUE;
}
public hook_say_team(id)
{
new SzMessages[192], SzName[32];
new SzAlive = is_user_alive(id);
new SzGetTeam = get_user_team(id);
read_args(SzMessages, 191);
remove_quotes(SzMessages);
get_user_name(id, SzName, 31);
if(!is_valid_msg(SzMessages))
return PLUGIN_CONTINUE;
switch(get_pcvar_num(playerPrefix))
{
case 1 : (SzAlive ? format(SzMessages, 191, "^1(%s) ^4[%s] ^3%s : ^1%s", SzGTeam[SzGetTeam], ranks_names[rank[id]], SzName, SzMessages) : format(SzMessages, 191, "^1*DEAD* ^1(^4%s^1) ^1[4%s^1] ^3%s : ^1%s", SzGTeam[SzGetTeam], ranks_names[rank[id]], SzName, SzMessages));
case 2 : (SzAlive ? format(SzMessages, 191, "^1(%s) ^1[Level %d] ^4%s : ^1%s", SzGTeam[SzGetTeam], level[id], SzName, SzMessages) : format(SzMessages, 191, "^1*DEAD* ^1(%s) ^1[^4Level %d^1] ^3%s : ^1%s", SzGTeam[SzGetTeam], level[id], SzName, SzMessages));
}
for(new i = 1; i <= SzMaxPlayers; i++)
{
if(!is_user_connected(i))
continue;
if(get_user_team(i) != SzGetTeam)
continue;
message_begin(MSG_ONE, get_user_msgid("SayText"), {0, 0, 0}, i);
write_byte(id);
write_string(SzMessages);
message_end();
}
return PLUGIN_CONTINUE;
}
bool:is_valid_msg(const SzMessages[])
{
if( SzMessages[0] == '@'
|| !strlen(SzMessages)){ return false; }
return true;
}
/*----------------------------------------------------------------------------------------------------------------
-EVENT TO ADD XP
----------------------------------------------------------------------------------------------------------------*/
public client_death(killer, victim, weapon, hitplace)
{
new victim_name[32]
get_user_name(victim, victim_name, charsmax(victim_name))
new killer_team = get_user_team(killer)
new victim_team = get_user_team(victim)
//NORMAL KILL
if((killer != victim) && !(killer_team == victim_team) && !(hitplace == HIT_HEAD) && !(weapon == CSW_HEGRENADE) && !(weapon == CSW_KNIFE))
{
xp[killer]++
}
//HEADSHOT
if(hitplace == HIT_HEAD && !(weapon == CSW_KNIFE) && !(killer_team == victim_team))
{
xp[killer]+=3
}
//KNIFE KILL
if(weapon == CSW_KNIFE && !(hitplace == HIT_HEAD) && !(killer_team == victim_team))
{
xp[killer]+=5
}
//KNIFE + HEADSHOT
if(weapon == CSW_KNIFE && (hitplace == HIT_HEAD) && !(killer_team == victim_team))
{
xp[killer]+=7
}
//GRENADE KILL
if(weapon == CSW_HEGRENADE && (killer != victim) && !(killer_team == victim_team))
{
xp[killer]+=5
}
//SUICIDE
if(killer == victim)
{
xp[killer]-=2
}
//TEAM KILL
if(killer != victim && (killer_team == victim_team))
{
xp[killer]-=10
}
check_level(killer, 1)
save_data(killer)
}
/*----------------------------------------------------------------------------------------------------------------
-CHECK LEVEL OF ADD ++
----------------------------------------------------------------------------------------------------------------*/
public check_level(id, sound)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED;
new name[32]; get_user_name(id, name, 31)
if(level[id] < maxlevels)
{
while(xp[id] >= xp_num[level[id]])
{
level[id]++
if(sound)
{
if(level[id] == maxlevels)
{
return PLUGIN_HANDLED
}
cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(rankLevelBonus))
set_ranks(id)
}
}
}
// Bug Preventions... (Back to top)
if(level[id] == maxlevels && xp[id] > xp_num[level[id]-1])
{
xp[id] = xp_num[level[id]-1]
save_data(id)
}
if(level[id] >= maxlevels)
{
level[id] = maxlevels
xp[id] = xp_num[level[id]-1]
save_data(id)
}
return PLUGIN_HANDLED
}
/*----------------------------------------------------------------------------------------------------------------
-SET THE RANK POSITION
----------------------------------------------------------------------------------------------------------------*/
public set_ranks(id)
{
if(level[id] <= 1) rank[id] = RANKS_Boogeyman
if(level[id] >= 1) rank[id] = RANKS_Cha-Cha-Man
if(level[id] >= 2) rank[id] = RANKS_Crazy-Zebra
if(level[id] >= 3) rank[id] = RANKS_Friendly-Ghost
if(level[id] >= 4) rank[id] = RANKS_Stiches
if(level[id] >= 5) rank[id] = RANKS_Lucky-Rabbit
if(level[id] >= 6) rank[id] = RANKS_Blind-Eyed
if(level[id] >= 7) rank[id] = RANKS_Killjoy
if(level[id] >= 8) rank[id] = RANKS_Your-Father
if(level[id] >= 9) rank[id] = RANKS_You-are-a-cunt
if(level[id] >= 10) rank[id] = RANKS_Nightmare-Monster
if(level[id] >= 11) rank[id] = RANKS_Final-Death
if(level[id] >= 12) rank[id] = RANKS_Camelot-Sorcerer
if(level[id] >= 13) rank[id] = RANKS_Bugghy-The-Frog
if(level[id] >= 14) rank[id] = RANKS_Whack-Whack
if(level[id] >= 15) rank[id] = RANKS_Burning-Oz
if(level[id] >= 16) rank[id] = RANKS_Strangler
if(level[id] >= 17) rank[id] = RANKS_Doorbell-Killer
if(level[id] >= 18) rank[id] = RANKS_Help-Me-I-am-New
if(level[id] >= 19) rank[id] = RANKS_Faithful-Assistant
if(level[id] >= 20) rank[id] = RANKS_Pennywise
if(level[id] >= 21) rank[id] = RANKS_Gurgles-The-Clown
if(level[id] >= 22) rank[id] = RANKS_Stupid-Friend
if(level[id] >= 23) rank[id] = RANKS_Shake-Your-Body
if(level[id] >= 24) rank[id] = RANKS_Chucky-Bunny
if(level[id] >= 25) rank[id] = RANKS_Clown-Boy
if(level[id] >= 26) rank[id] = RANKS_Quiet-Grandpa
if(level[id] >= 27) rank[id] = RANKS_Sabertooth
if(level[id] >= 28) rank[id] = RANKS_Grisly-Madness
if(level[id] >= 29) rank[id] = RANKS_Satans-Stronghold
if(level[id] >= 30) rank[id] = RANKS_Bishop
if(level[id] >= 31) rank[id] = RANKS_Meatball
if(level[id] >= 32) rank[id] = RANKS_Horror-Demon
if(level[id] >= 33) rank[id] = RANKS_Devil-Void
if(level[id] >= 34) rank[id] = RANKS_Royal-Mentor
if(level[id] >= 35) rank[id] = RANKS_High-Priest
if(level[id] >= 36) rank[id] = RANKS_Alpha-King
if(level[id] >= 37) rank[id] = RANKS_Dried-Mouse
if(level[id] >= 38) rank[id] = RANKS_Da-Boss
if(level[id] >= 39) rank[id] = RANKS_FaceAsTable
if(level[id] >= 40) rank[id] = RANKS_Mickey-The-Cobra
if(level[id] >= 41) rank[id] = RANKS_Funcky-Man
if(level[id] >= 42) rank[id] = RANKS_Gaz-Man
if(level[id] >= 43) rank[id] = RANKS_Goddess-of-smiles
if(level[id] >= 44) rank[id] = RANKS_Y'aLL-Can-Kiss-My-Ass
if(level[id] >= 45) rank[id] = RANKS_The-Prophet
if(level[id] >= 46) rank[id] = RANKS_Shoot-Twice-And-Go-Home
if(level[id] >= 47) rank[id] = RANKS_Really-i'm-Hungry....
if(level[id] >= 48) rank[id] = RANKS_Mr-Scrappy
if(level[id] >= 49) rank[id] = RANKS_That's-All-You-Got?
if(level[id] >= 50) rank[id] = RANKS_Splay-Toed
if(level[id] >= 51) rank[id] = RANKS_Mister-Great-Aspargus
if(level[id] >= 52) rank[id] = RANKS_Bad-Axe-Murderer
if(level[id] >= 53) rank[id] = RANKS_Physically-Challenged
if(level[id] >= 54) rank[id] = RANKS_Was-That-a-HeadShot?
if(level[id] >= 55) rank[id] = RANKS_Slack-Jawed
if(level[id] >= 56) rank[id] = RANKS_Ball-Chaser
if(level[id] >= 57) rank[id] = RANKS_Drool-Faced
if(level[id] >= 58) rank[id] = RANKS_Snaggle-Toothed
if(level[id] >= 59) rank[id] = RANKS_Night-Barking
if(level[id] >= 60) rank[id] = RANKS_Sleep-Runner
if(level[id] >= 61) rank[id] = RANKS_Sly-Tinkler
if(level[id] >= 62) rank[id] = RANKS_Here-is-Your-Biggest-Nightmare
if(level[id] >= 63) rank[id] = RANKS_Pile-Driver
if(level[id] >= 64) rank[id] = RANKS_Sorry,-I-Scared-You?
if(level[id] >= 65) rank[id] = RANKS_Bone-Burier
if(level[id] >= 66) rank[id] = RANKS_Rag-Puller
if(level[id] >= 67) rank[id] = RANKS_Vaguely-Obsessive
if(level[id] >= 68) rank[id] = RANKS_Tragically-Handsome
if(level[id] >= 69) rank[id] = RANKS_Vodoo-Thrower
if(level[id] >= 70) rank[id] = RANKS_Flo-Eared
if(level[id] >= 71) rank[id] = RANKS_Grim-Face
if(level[id] >= 72) rank[id] = RANKS_Grave-Digger
if(level[id] >= 73) rank[id] = RANKS_Pass-the-Joint
if(level[id] >= 74) rank[id] = RANKS_Crotch-Sniffer
if(level[id] >= 75) rank[id] = RANKS_Hi,-I'm-Grinch
if(level[id] >= 76) rank[id] = RANKS_Hey,-You-Lost-Your-Head
if(level[id] >= 77) rank[id] = RANKS_Kid,-You-Want-a-Candy?
if(level[id] >= 78) rank[id] = RANKS_Hold-My-Knife-Please
if(level[id] >= 79) rank[id] = RANKS_Bitch,-I'm-Famous
if(level[id] >= 80) rank[id] = RANKS_1-Bullet,-2-Headshots
if(level[id] >= 81) rank[id] = RANKS_NightWalker
if(level[id] >= 82) rank[id] = RANKS_Ha-..-Your-Girlfriend-is-My-...
if(level[id] >= 83) rank[id] = RANKS_Carpet-Cleaner
if(level[id] >= 84) rank[id] = RANKS_Skull-Crusher
if(level[id] >= 85) rank[id] = RANKS_Want-Some-CS-Lessons?
if(level[id] >= 86) rank[id] = RANKS_Blood-Everywhere
if(level[id] >= 87) rank[id] = RANKS_Allahu-Akhbar
if(level[id] >= 88) rank[id] = RANKS_Buffering-Pornhub
if(level[id] >= 89) rank[id] = RANKS_Hell-Raiser
if(level[id] >= 90) rank[id] = RANKS_Dead-Stalker
if(level[id] >= 91) rank[id] = RANKS_Spooky-Neighbour
if(level[id] >= 92) rank[id] = RANKS_Spell-Binder
if(level[id] >= 93) rank[id] = RANKS_Easy-Hold-My-AK
if(level[id] >= 94) rank[id] = RANKS_Best-Player-Around
if(level[id] >= 95) rank[id] = RANKS_Out-of-the-Mist
if(level[id] >= 96) rank[id] = RANKS_One-Creepy-Kid
if(level[id] >= 97) rank[id] = RANKS_I-Am-A-Grim-Sleeper
if(level[id] >= 98) rank[id] = RANKS_Headless-Horseman
if(level[id] >= 99) rank[id] = RANKS_Midnight-Predator
}
/*----------------------------------------------------------------------------------------------------------------
-SAVE LEVEL, XP AND RANK
----------------------------------------------------------------------------------------------------------------*/
public save_data(id)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED;
new auth[40], data[50]
switch(get_pcvar_num(rankSaveType))
{
case 1: get_user_ip(id, auth, charsmax(auth), 1)
case 2: get_user_name(id, auth, charsmax(auth))
case 3: get_user_authid(id, auth, charsmax(auth))
}
formatex(data, charsmax(data), "%d %d", level[id], xp[id])
fvault_pset_data(db_save, auth, data)
return PLUGIN_HANDLED;
}
/*----------------------------------------------------------------------------------------------------------------
-LOAD DATA
----------------------------------------------------------------------------------------------------------------*/
public client_authorized(id)
{
new auth[40], data[50], x1[10], x2[10]
switch(get_pcvar_num(rankSaveType))
{
case 1: get_user_ip(id, auth, charsmax(auth), 1)
case 2: get_user_name(id, auth, charsmax(auth))
case 3: get_user_authid(id, auth, charsmax(auth))
}
fvault_get_data(db_save, auth, data, charsmax(data))
parse(data, x1, charsmax(x1), x2, charsmax(x2))
level[id] = str_to_num(x1)
xp[id] = str_to_num(x2)
set_task(2.0, "set_ranks", id)
check_level(id, 0)
set_task(1.1, "hud_status", id, _, _, "b")
}
/*----------------------------------------------------------------------------------------------------------------
-SHOW XP BY LOOKING AT THE PERSON
----------------------------------------------------------------------------------------------------------------*/
public showStatus(id)
{
if(!is_user_bot(id) && is_user_connected(id))
{
new name[32], pid = read_data(2)
get_user_name(pid, name, 31)
new xxx = get_user_team(id)
new xxx2 = get_user_team(pid)
static r, g, b;
r = random_num(0, 255), g = random_num(0, 255), b = random_num(0, 255);
if (xxx == xxx2) // friend
{
set_hudmessage(r, g, b, 0.30, 0.40, 0, 1.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(id, g_status_sync, "Name: %s^nRank: %s^nLevel: %d^nXP: %d/%d", name, ranks_names[rank[pid]], level[pid], xp[pid], xp_num[level[pid]])
}
}
}
public hideStatus(id)
{
ClearSyncHud(id, g_status_sync)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1046\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang16393\\ f0\\ fs16 \n\\ par }
*/