Page 1 of 2

Cerere modificare plugin

Posted: 13 Apr 2019, 20:37
by Sammyy
As dori daca se poate sa faceti sa nu mai apara prefixul de la nume, ca am deja un plugin de prefix si se cam bat, si n as vrea sa l scot pe celalalt, scuze daca am postat unde nu trebuie, n am gasit sectiunea de modificare pluginuri, mersi.
| Afiseaza codul
#include <amxmodx>
#include <fvault>
#include <cstrike>
#include <wm_play>

#define maxranks 15
#define maxlevels 50

#define xPrefix "XP System"

#define RANKS_Noobest 0
#define RANKS_Noob 1
#define RANKS_Newbiee 2
#define RANKS_Easy 3
#define RANKS_Normal 4
#define RANKS_Hard 5
#define RANKS_Expert 6
#define RANKS_SuperExpert 7
#define RANKS_Specialist 8
#define RANKS_Leader 9
#define RANKS_Mayor 10
#define RANKS_Pro 11
#define RANKS_SuperPro 12
#define RANKS_Heroic 13
#define RANKS_God 14

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] = 
{ 
	15, 70, 150, 250, 350, 450, 550, 650, 750, 850, 950, 1050, 1150, 1250, 1350, 1450, 1550, 1650,
	1750, 1850, 1950, 2050, 2150, 2250, 2350, 2450, 2550,2650, 2750, 2850, 2950, 3050, 3150, 3250, 3350, 3450, 3550, 3650, 
	3750, 3850, 3950, 4050, 4150, 4250, 4350, 4450, 4550, 4650, 4750, 5000 
}

new const ranks_names[maxranks][]=
{
	"Noobest",
	"Noob",
	"Newbiee",
	"Easy",
	"Normal",
	"Hard",
	"Expert",
	"SuperExpert",
	"Specialist",
	"Leader",
	"Mayor",
	"Pro",
	"SuperPro",
	"Heroic",
	"God"
}

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, 0.80, -1.0, 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(255, 255, 255, 0.80, -1.0, 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_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] ^3%s : ^1%s", ranks_names[rank[id]], SzName, SzMessages) : format(SzMessages, 191, "^1*DEAD* ^4[%s] ^3%s : ^1%s", ranks_names[rank[id]], SzName, SzMessages));
		case 2 :(SzAlive ? format(SzMessages, 191, "^4[Level %d] ^3%s : ^1%s", level[id], SzName, SzMessages) : format(SzMessages, 191, "^1*DEAD* ^4[Level %d] ^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(%s) ^4[%s] ^3%s : ^1%s", SzGTeam[SzGetTeam], ranks_names[rank[id]], SzName, SzMessages));
		case 2 : (SzAlive ? format(SzMessages, 191, "^1(%s) ^4[Level %d] ^3%s : ^1%s", SzGTeam[SzGetTeam], level[id], SzName, SzMessages) : format(SzMessages, 191, "^1*DEAD* ^1(%s) ^4[Level %d] ^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]++
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_NORMAL_KILL", victim_name)
	}
	
	//HEADSHOT
	if(hitplace == HIT_HEAD && !(weapon == CSW_KNIFE) && !(killer_team == victim_team))
	{
		xp[killer]+=3
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_HEADSHOT_KILL", victim_name)
	}
	
	//KNIFE KILL
	if(weapon == CSW_KNIFE && !(hitplace == HIT_HEAD) && !(killer_team == victim_team))
	{
		xp[killer]+=5
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_KNIFE_KILL", victim_name)
	}
	
	//KNIFE + HEADSHOT
	if(weapon == CSW_KNIFE && (hitplace == HIT_HEAD) && !(killer_team == victim_team))
	{
		xp[killer]+=7
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_KNIFE_HEAD_KILL", victim_name)
	}
	
	//GRENADE KILL
	if(weapon == CSW_HEGRENADE && (killer != victim) && !(killer_team == victim_team))
	{
		xp[killer]+=5
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_GRENADE_KILL", victim_name)
	}
	
	//SUICIDE
	if(killer == victim)
	{
		xp[killer]-=2
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_SUICIDE")
	}
	
	//TEAM KILL
	if(killer != victim && (killer_team == victim_team))
	{
		xp[killer]-=10
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_TEAM_KILL")
	}
	
	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)
				{
					client_print_color(id, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_MAXLVL_ID", level[id])
					client_print_color(0, "!g[%s] %L",xPrefix, LANG_PLAYER, "MSG_MAXLVL_ALL", name, level[id])
					
					client_cmd(0, "spk ambience/wolfhowl02.wav")
					
					return PLUGIN_HANDLED
				}
				
				client_print_color(id,"!g[%s] %L",xPrefix,LANG_PLAYER, "MSG_RAISE_LEVEL_ID", get_pcvar_num(rankLevelBonus))
				client_print_color(0, "!g[%s] %L",xPrefix,LANG_PLAYER, "MSG_RAISE_LEVEL_ALL", name, get_pcvar_num(rankLevelBonus))
				cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(rankLevelBonus))
				
				client_cmd(0, "spk ambience/lv_fruit1.wav")
				
				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] <= 2) rank[id] = RANKS_Noobest
	if(level[id] >= 2) rank[id] = RANKS_Noob
	if(level[id] >= 5) rank[id] = RANKS_Newbiee
	if(level[id] >= 8) rank[id] = RANKS_Easy
	if(level[id] >= 11) rank[id] = RANKS_Normal
	if(level[id] >= 14) rank[id] = RANKS_Hard
	if(level[id] >= 17) rank[id] = RANKS_Expert
	if(level[id] >= 20) rank[id] = RANKS_SuperExpert
	if(level[id] >= 23) rank[id] = RANKS_Specialist
	if(level[id] >= 26) rank[id] = RANKS_Leader
	if(level[id] >= 29) rank[id] = RANKS_Mayor
	if(level[id] >= 32) rank[id] = RANKS_Pro
	if(level[id] >= 33) rank[id] = RANKS_SuperPro
	if(level[id] >= 36) rank[id] = RANKS_Heroic
	if(level[id] >= 43) rank[id] = RANKS_God
}

/*----------------------------------------------------------------------------------------------------------------
-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, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -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 }
*/

Re: Cerere modificare plugin

Posted: 13 Apr 2019, 23:07
by levin
| Afiseaza codul
#include <amxmodx>
#include <cstrike>
#include <wm_play>
#include <fvault>

#define maxranks 15
#define maxlevels 50

#define xPrefix "XP System"

#define RANKS_Noobest 0
#define RANKS_Noob 1
#define RANKS_Newbiee 2
#define RANKS_Easy 3
#define RANKS_Normal 4
#define RANKS_Hard 5
#define RANKS_Expert 6
#define RANKS_SuperExpert 7
#define RANKS_Specialist 8
#define RANKS_Leader 9
#define RANKS_Mayor 10
#define RANKS_Pro 11
#define RANKS_SuperPro 12
#define RANKS_Heroic 13
#define RANKS_God 14

new const VERSION[] =  "1.1"

new SzMaxPlayers;
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] = 
{ 
	15, 70, 150, 250, 350, 450, 550, 650, 750, 850, 950, 1050, 1150, 1250, 1350, 1450, 1550, 1650,
	1750, 1850, 1950, 2050, 2150, 2250, 2350, 2450, 2550,2650, 2750, 2850, 2950, 3050, 3150, 3250, 3350, 3450, 3550, 3650, 
	3750, 3850, 3950, 4050, 4150, 4250, 4350, 4450, 4550, 4650, 4750, 5000 
}

new const ranks_names[maxranks][]=
{
	"Noobest",
	"Noob",
	"Newbiee",
	"Easy",
	"Normal",
	"Hard",
	"Expert",
	"SuperExpert",
	"Specialist",
	"Leader",
	"Mayor",
	"Pro",
	"SuperPro",
	"Heroic",
	"God"
}

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_dictionary("cs_rank_system.txt");

	SzMaxPlayers = get_maxplayers();
	
	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, 0.80, -1.0, 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(255, 255, 255, 0.80, -1.0, 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_num[level[id]])
	}
}

/*----------------------------------------------------------------------------------------------------------------
-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]++
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_NORMAL_KILL", victim_name)
	}
	
	//HEADSHOT
	if(hitplace == HIT_HEAD && !(weapon == CSW_KNIFE) && !(killer_team == victim_team))
	{
		xp[killer]+=3
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_HEADSHOT_KILL", victim_name)
	}
	
	//KNIFE KILL
	if(weapon == CSW_KNIFE && !(hitplace == HIT_HEAD) && !(killer_team == victim_team))
	{
		xp[killer]+=5
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_KNIFE_KILL", victim_name)
	}
	
	//KNIFE + HEADSHOT
	if(weapon == CSW_KNIFE && (hitplace == HIT_HEAD) && !(killer_team == victim_team))
	{
		xp[killer]+=7
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_KNIFE_HEAD_KILL", victim_name)
	}
	
	//GRENADE KILL
	if(weapon == CSW_HEGRENADE && (killer != victim) && !(killer_team == victim_team))
	{
		xp[killer]+=5
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_GRENADE_KILL", victim_name)
	}
	
	//SUICIDE
	if(killer == victim)
	{
		xp[killer]-=2
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_SUICIDE")
	}
	
	//TEAM KILL
	if(killer != victim && (killer_team == victim_team))
	{
		xp[killer]-=10
		client_print_color(killer, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_TEAM_KILL")
	}
	
	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)
				{
					client_print_color(id, "!g[%s] %L", xPrefix, LANG_PLAYER, "MSG_MAXLVL_ID", level[id])
					client_print_color(0, "!g[%s] %L",xPrefix, LANG_PLAYER, "MSG_MAXLVL_ALL", name, level[id])
					
					client_cmd(0, "spk ambience/wolfhowl02.wav")
					
					return PLUGIN_HANDLED
				}
				
				client_print_color(id,"!g[%s] %L",xPrefix,LANG_PLAYER, "MSG_RAISE_LEVEL_ID", get_pcvar_num(rankLevelBonus))
				client_print_color(0, "!g[%s] %L",xPrefix,LANG_PLAYER, "MSG_RAISE_LEVEL_ALL", name, get_pcvar_num(rankLevelBonus))
				cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(rankLevelBonus))
				
				client_cmd(0, "spk ambience/lv_fruit1.wav")
				
				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] <= 2) rank[id] = RANKS_Noobest
	if(level[id] >= 2) rank[id] = RANKS_Noob
	if(level[id] >= 5) rank[id] = RANKS_Newbiee
	if(level[id] >= 8) rank[id] = RANKS_Easy
	if(level[id] >= 11) rank[id] = RANKS_Normal
	if(level[id] >= 14) rank[id] = RANKS_Hard
	if(level[id] >= 17) rank[id] = RANKS_Expert
	if(level[id] >= 20) rank[id] = RANKS_SuperExpert
	if(level[id] >= 23) rank[id] = RANKS_Specialist
	if(level[id] >= 26) rank[id] = RANKS_Leader
	if(level[id] >= 29) rank[id] = RANKS_Mayor
	if(level[id] >= 32) rank[id] = RANKS_Pro
	if(level[id] >= 33) rank[id] = RANKS_SuperPro
	if(level[id] >= 36) rank[id] = RANKS_Heroic
	if(level[id] >= 43) rank[id] = RANKS_God
}

/*----------------------------------------------------------------------------------------------------------------
-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, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -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 }
*/

Re: Cerere modificare plugin

Posted: 14 Apr 2019, 00:48
by Sammyy
Imi da eroare asta la compilare, am incercat si local dar tot degeaba:
AMX Mod X Compiler 1.8.3-manual
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

cs_rank_system.sma(4) : fatal error 100: cannot read from file: "wm_play"

Compilation aborted.
1 Error.
Done.

Daca ai putea sa mi l compilezi tu sau sa rezolvi asta ar fi super, mersi.

Re: Cerere modificare plugin

Posted: 14 Apr 2019, 01:26
by levin
păi așa mi l-ai dat tu =)))

Re: Cerere modificare plugin

Posted: 14 Apr 2019, 01:48
by Sammyy
Asa l am gasit si eu pe net, ce sa fac:))), nu stiam de eroarea aia la compilare, am incercat sa compilez si sursa "originala" si tot asa a dat, deci asa e ea, daca ai gasi o rezolvare ar fi tare :D

Re: Cerere modificare plugin

Posted: 14 Apr 2019, 02:35
by @IONUTZ
Sammyy wrote:
14 Apr 2019, 01:48
Asa l am gasit si eu pe net, ce sa fac:))), nu stiam de eroarea aia la compilare, am incercat sa compilez si sursa "originala" si tot asa a dat, deci asa e ea, daca ai gasi o rezolvare ar fi tare :D
Fara acest "#include <wm_play>" nu poti compila pluginu numai daca adaugi functiile din include in plugin direct, uite aici alt plugin
https://forums.alliedmods.net/showthread.php?t=308540

Re: Cerere modificare plugin

Posted: 15 Apr 2019, 00:56
by Sammyy
@IONUTZ wrote:
14 Apr 2019, 02:35
Sammyy wrote:
14 Apr 2019, 01:48
Asa l am gasit si eu pe net, ce sa fac:))), nu stiam de eroarea aia la compilare, am incercat sa compilez si sursa "originala" si tot asa a dat, deci asa e ea, daca ai gasi o rezolvare ar fi tare :D
Fara acest "#include <wm_play>" nu poti compila pluginu numai daca adaugi functiile din include in plugin direct, uite aici alt plugin
https://forums.alliedmods.net/showthread.php?t=308540
Mersi din plugin il testez acum sa vad cum merge :D
EDIT: Imi da eroarea asta: 04/15/2019 - 01:05:54: [AMXX] Plugin "crx_ranksystem.amxx" failed to load: Plugin uses an unknown function (name "replace_string") - check your modules.ini. :-?

Re: Cerere modificare plugin

Posted: 15 Apr 2019, 01:22
by levin
ai nevoie de amxx1.8.3..sau încearcă prin replace_all

Re: Cerere modificare plugin

Posted: 15 Apr 2019, 14:44
by Sammyy
L E V I N wrote:
15 Apr 2019, 01:22
ai nevoie de amxx1.8.3..sau încearcă prin replace_all
Mersi, dar cum fac replace_all?

Re: Cerere modificare plugin

Posted: 15 Apr 2019, 16:39
by levin
mai bine treci pe 1 8 3 dacă nu te pricepi la înlocuirea unui nativ.....(înlocuiești replace_string cu replace_all)

Re: Cerere modificare plugin

Posted: 16 Apr 2019, 03:15
by Sammyy
L E V I N wrote:
15 Apr 2019, 16:39
mai bine treci pe 1 8 3 dacă nu te pricepi la înlocuirea unui nativ.....(înlocuiești replace_string cu replace_all)
Am trecut pe 1.8.3, dar imi da eroarea asta cand intru pe sv, daca stau la spec merge, dar cand aleg echipa mi se inchide sv
| Afiseaza codul
L 04/16/2019 - 02:11:04: Start of error session.
L 04/16/2019 - 02:11:04: Info (map "(null)") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 02:11:04: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\common.games.txt":
L 04/16/2019 - 02:11:04: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 02:11:05: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\modules.games.txt":
L 04/16/2019 - 02:11:05: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 02:11:05: Start of error session.
L 04/16/2019 - 02:11:05: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 02:11:05: [AMXX] Run time error 10 (plugin "crx_ranksystem.amxx") (native "clamp") - debug not enabled!
L 04/16/2019 - 02:11:05: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 04/16/2019 - 02:14:47: Start of error session.
L 04/16/2019 - 02:14:47: Info (map "(null)") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 02:14:47: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\common.games.txt":
L 04/16/2019 - 02:14:47: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 02:14:47: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\modules.games.txt":
L 04/16/2019 - 02:14:47: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 02:14:48: Start of error session.
L 04/16/2019 - 02:14:48: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 02:14:48: [AMXX] Run time error 10 (plugin "crx_ranksystem.amxx") (native "clamp") - debug not enabled!
L 04/16/2019 - 02:14:48: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 04/16/2019 - 02:20:15: Start of error session.
L 04/16/2019 - 02:20:15: Info (map "(null)") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 02:20:15: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\common.games.txt":
L 04/16/2019 - 02:20:15: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 02:20:15: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\modules.games.txt":
L 04/16/2019 - 02:20:15: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 02:20:16: Start of error session.
L 04/16/2019 - 02:20:16: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 02:20:16: [AMXX] Displaying debug trace (plugin "crx_ranksystem.amxx", version "unknown")
L 04/16/2019 - 02:20:16: [AMXX] Run time error 10: native error (native "clamp")
L 04/16/2019 - 02:20:16: [AMXX]    [0] 02930t04.sma.p::ReadFile (line 600)
L 04/16/2019 - 02:20:16: [AMXX]    [1] 02930t04.sma.p::plugin_precache (line 270)
L 04/16/2019 - 03:02:02: Start of error session.
L 04/16/2019 - 03:02:02: Info (map "(null)") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 03:02:02: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\common.games.txt":
L 04/16/2019 - 03:02:02: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 03:02:02: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\modules.games.txt":
L 04/16/2019 - 03:02:02: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 03:02:02: Start of error session.
L 04/16/2019 - 03:02:02: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 03:02:02: [AMXX] Displaying debug trace (plugin "crx_ranksystem.amxx", version "unknown")
L 04/16/2019 - 03:02:02: [AMXX] Run time error 10: native error (native "clamp")
L 04/16/2019 - 03:02:02: [AMXX]    [0] 02930t04.sma.p::ReadFile (line 600)
L 04/16/2019 - 03:02:02: [AMXX]    [1] 02930t04.sma.p::plugin_precache (line 270)
L 04/16/2019 - 03:06:21: Start of error session.
L 04/16/2019 - 03:06:21: Info (map "(null)") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 03:06:21: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\common.games.txt":
L 04/16/2019 - 03:06:21: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 03:06:21: Error parsing gameconfig file "cstrike\addons\amxmodx\data\gamedata\modules.games.txt":
L 04/16/2019 - 03:06:21: Error 1 on line 0, col 0: Stream failed to open
L 04/16/2019 - 03:06:21: Start of error session.
L 04/16/2019 - 03:06:21: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20190416.log")
L 04/16/2019 - 03:06:21: [AMXX] Displaying debug trace (plugin "crx_ranksystem.amxx", version "unknown")
L 04/16/2019 - 03:06:21: [AMXX] Run time error 10: native error (native "clamp")
L 04/16/2019 - 03:06:21: [AMXX]    [0] 02930t04.sma.p::ReadFile (line 600)
L 04/16/2019 - 03:06:21: [AMXX]    [1] 02930t04.sma.p::plugin_precache (line 270)

Re: Cerere modificare plugin

Posted: 16 Apr 2019, 20:06
by levin
ai rehlds?păcat..îți trebuie fișierele din gamedata