Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Przeróbka pluga BF2 Rank Mod


  • Zamknięty Temat jest zamknięty
3 odpowiedzi w tym temacie

#1 bartu233

    Zaawansowany

  • Użytkownik

Reputacja: -3
Mniej niż zer0.

  • Postów:87
  • Lokalizacja:Słupsk
Offline

Napisano 26.10.2008 20:18

Siema, moglby mi ktos przerobic pluga tego co jest w nazwie, zeby exp itp zapamietywal graczowi na nick ? Bo z tego co zauwazylem to po zmianie mapki exp znika, czyli zapewne zapamietuje na steam_id.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	Battlefield 2 Rank Mod by pRED* | Translated to Polish by Misiek & Korzen | www.Bomb-Site.pl
//
//	An attempt to recreate the battlefield ranking system onto cs1.6
//	Currently features the basics of the ranking system, with no power up gain recieved from leveling.
//	
//	Ranks are based on the number of kills from the csstats system
//	
//	Badges can also be earned to get power up bonuses - See rewards list. Or look at /bf2menu in game
//	
//
//	Wish list: 	Add some more badges maybe? Ive put some ideas in comments...
//			Rank pictures..
//
//	Known Bugs	General optimisation stuff - Ive done most in the wiki tut but there may be more
//	
//	Rewards:	Knife - 20/40/60% of damage done with knife returned to player.
//			Support - Recoil with M249 reduced 1/3,1/2,Full
//			Pistol - Chance of stopping opponent when u get shot (not sure if its working..)
//			Assault - 10/20/30 Bonus HP when spawning
//			Sniper - 1/3,1/2,Full Chance of Free awp/scout
//			Explosives - Free Grenade/Free Defuse Kit/Free Full nade set
//
//	Credits:	Xuntric and PM for their combined work on the <img src='http://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' /> based plugin tutorial (load, save and menu stuff..)
//			Avalanche for the removed cone of fire in i_aim_good plugin (used for lowered recoil on the para)
//			Phantom Warrior and palehorse for inadvertently giving me the idea for this (Military Rank Mod thread..)
//			ev0d00b cos I stole lots of code out of his/our Capture the Hax Plugin
//			Ubernet (games.uber.net.nz) for giving me a test server and help test the mod
//			stupok69 for helping fix the /whois command
//			Geesu for all his defined cs weapon speeds used in wc3ft (resetting users speed after imobilising them),
//			and some great examples of screen flashes and shakes.
//			Cheap_Suit for the extra recoil code
//			Hawk522 for his tutorial on SQLx (and helping me debug problems with it)
//			styremelaker for massive amount of csdm testing.
//			vittu for going through the code and finding heaps of mistakes and efficiency changes
//			teamme06 for his colorchat code
//			vittu again for supporting my plugin more than I do..
//			BlueRaja for player kills and score update code from his damage multiplier plugin (big copy, paste of the kill function)
//			palehorse for the web html documents
//			vittu for testing and helping fix bugs in the code.
//			emp' for the new amxx menu tutorial
//
//	Cvars:		bf2_active (1|0) - Turns the plugin on or off - Default 1
//			bf2_badges (1|0) - Turns the badge system on or off - Default 1
//			bf2_awp (1|0) - Is user given an awp or scout by having the sniper badge - Default 0 (scout)
//			bf2_xpmultiplier (1|0) - Changes the kill multiplier needed to reach each level - Default 0.1 (15 kills for rank 1, 20k kills for top rank)
//			bf2_sql (1|0) - Turns Switches between SQL and vault saving - Default 1 (SQL)
//			bf2_icon_time (float) - Time (in seconds) to show the rank icon above peoples heads 0=disabled. default 1.5
//			bf2_flag_kills (int) - CS flags - How many bf2 points are awarded for capturing a flag
//			bf2_flag_round_kills - CS flags - How many bf2 points are awarded for winning a round
//			bf2_flag_match_kills  - CS flags - How many bf2 points are awarded for winning the match
//			bf2_flag_min_players - CS flags - Min number of plays before above points get awarded
//			bf2_help_url (string) - remote folder where the bf2 web docs are stored (optional) do not include the trailing /
//			bf2_badgepowers (1|0) - enable/disable the powers for the badgess
//			bf2_hud_options "abcde"
//				a Display Health/Armour/Weapon for teammates
//				b Display Rank for teammates
//				c Display Rank for enemies
//				d Hide display for invisible enemies
//				e Move the display to above peoples heads
//
//
//	Cmds:		say /bf2menu - Shows the Main Menu
//			say /who - Shows a list of player and their rank
//			say /whois <name> - Show the rank and badges of a specific player
//			say /whostats <name> - Show the stats page for a player
//			say /hud - Redisplays the HUD
//			say /ranks - Shows the kill <img src='http://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' /> table
//			say /bf2stats - your personal stats pages
//			say /pomoc - Displays a Help MOTD
//			say /badges1 - Displays a Help MOTD on some of the badges
//			say /badges2 - Displays a Help MOTD on the rest of the badges
//			say /badges3 - Badges 3
//			bf2_addbagde <player> <badge> <level> - Gives a badge to player. Requires Ban admin access. Badge <0-5>. Level <0-3>
//			bf2_addkills <player> <kills> - Adds to a players kills.. Also requires ban access
//
//	Changes:	1.1 - 	Fixed Bug with Veteran Assault badge
//				Added SQL support (bf2_sql 1)
//				Changed support badge to bonus speed (added code for extra damage, recoil - will finish when amxx 1.77 is released)
//				Sounds, Screen Shake, User glows..
//			1.2 - 	Massive change to make global kill counting actually work..
//				Added screen to view weapon stats "say /bf2stats" or use the menu
//				Added concmd "bf2_vaultload" to forcibly load your own data from the vault (im using it to convert my stats from vault to sql)
//				Tell people to type bf2_vaultload into console and their badges will be restored. Other than that probably a useless command
//			1.21 -	Added a badge check 5 seconds before map changes.
//			1.22 -  bf2_addbadge admin command added
//			1.23 -  Added CSDM functionality. Give hp/weapons on all spawns. 
//				Recoded badge checking to be individual on player death
//				Fixed HP bug and added message "beginning badge check"
//			1.30 -	Starting work on 4 New ranks
//				Shows Teammates rank when you look at them.
//				Give 50,100,200 armour for having 6,12 or 18 badges..
//				Bf2 now saves totalkills itself. Prevents csstats resets..
//				bf2_addkills (admin abuse tool? - or to reset after csstats reset), gives x kills to a player
//				Reduced the amount of saving to vault - causing server lag.
//				Changed to nVault saving. Now uses only 1 vault data instead of 14.
//				Fixed armour being lower than you had before
//				Split file into large set of includes. Way easier to find functions you want.
//				Added +3 kills for defuse/explode. Cs flags mod support
//			1.31 -	Lowered chance of imobilising happening.
//				Changed damage event and bomb events to the csx forward versions and created a csx forward include
//				Capped knife badge damage to 130
//				Removed bf2_vaultload (pointless now.)
//				Fixed some spelling newbie mistakes..
//				Fixed immunity problems
//				Moved inl and config files into their own folder..
//				Probably a few other things too..
//			1.4 -	Fixed wrong sprites displaying
//				fixed double hp gain on round reset (CSDM)
//				added /whostats command
//				bf2_help_url (and web motds) and bf2_badgepowers cvars
//				fixed sprites
//				CSDM badges not being awarded.
//				Top ranked in server display message
//				New menus
//				reset your stats command
//				Medals other new stats
//				Logging admin commands
//				Two new badges. Fixed Explosives badge for csdm
//				Heaps of new stats options + saving them (server and player)
//				Changed power for support
//				SQL now a defined option
//				Moved needed fakemeta_util functions into a separate file (included)
//				New HUD system thanks to vittu (added cvar to control it)
//				bf2_reset_days cvar - number of days without playing till <img src='http://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' /> gets reset
//				
//
//
//	Requires: Fakemeta, Csstats, fakemeta_util
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <amxmodx>
#include <amxmisc>
#include <amxconst>
#include <csstats>
#include <cstrike>
#include <fakemeta>
#include "bf2/fakemeta_util_mini.inl"
#include <csx>
#include <fun>

#define ADMIN_LEVEL ADMIN_BAN
#define ADMIN_RESET ADMIN_CFG

new const PLUGIN[] = "Battlefield2 Rank Mod"
new const AUTHOR[] = "pRED*"
new const VERSION[] = "1.4"

//Compile Settings

#define CSDM
//#define SQL

//Message sending variables
new gmsgStatusText;
new gmsgScreenFade;
new gmsgScreenShake;
new gmsgDeathMsg;
new gmsgScoreInfo;
new gmsgSayText;

new g_status_sync;


#define MAX_RANKS 17
#define MAX_BADGES 8

//Motd variables
new configsdir[200]
new configfile[200]

//Cvar vars
new g_bf2_active;
new g_badges_active;
new g_free_awp;
new g_<img src='http://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' />_multiplier;
new g_icon_hold;
new g_flag_kills;
new g_help_url;
new g_powers;
new g_flag_round_kills
new g_flag_match_kills
new g_flag_min_players
new g_hud_options
new g_prune_days

//Current players info
new g_PlayerRank[33];
new g_PlayerBadges[33][MAX_BADGES];
new knifekills[33];
new pistolkills[33];
new sniperkills[33];
new parakills[33];
new defuses[33];
new plants[33];
new explosions[33];
new accuracy[33];
new totalkills[33];
new authid[33][32];
new smgkills[33];
new shotgunkills[33];
new riflekills[33];
new grenadekills[33];

new bronze[33];
new silver[33];
new gold[33];



//Temp storage variables
new nextrank[33];
new numofbadges[33];
new bool:newplayer[33];
new g_lastwpn[33]
//new g_lastclip[33]
new bool:imobile[33];
new bool:freezetime;
new highestrank
new highestrankid
new statsloaded[33]


new g_friend[33];
new g_invis[33];

new menuselection[33];

//Server stats
new highestrankserver
new highestrankservername[30]

new mostkills
new mostkillsid
new mostkillsname[30]

new mostwins
new mostwinsname[30]


new menuselected[33][3];
//0 - Badge/Kills selected 0/1
//1 - Badgenum/Kills
//2 - Badgelevel

//Sound Vars
new g_Sound1[] = "buttons/bell1.wav"; //Rank gained sound
new g_Sound2[] = "fvox/bell.wav"; //Badges earned sound

//Sprite vars
new spritefile[21][36];
new sprite[21];

//Bf2 includes

//SQl vars
#if defined SQL
new Handle:g_SqlTuple
new Handle:g_SqlTuple2 
new g_Cache[512]
new bool:SQLenabled;
#else
//nVault.
new g_Vault;
#endif

#if defined SQL
	#include <sqlx>
	#include "bf2/sql.inl"
#else
	#include <nvault>
#endif


#include "bf2/effect.inl"
#include "bf2/const.inl"
#include "bf2/cmds.inl"
#include "bf2/events.inl"
#include "bf2/save.inl"
#include "bf2/forwards.inl"
#include "bf2/check.inl"
#include "bf2/badgepowers.inl"
#include "bf2/menu.inl"
#include "bf2/hud.inl"
#include "bf2/othermods.inl"
#include "bf2/csx.inl"

#if defined CSDM
	#include "bf2/bf2_csdm.inl"
#endif



public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR);

	//Register all the say commands

		//Public
	register_clcmd("say /ranks","show_rankhelp",0, "Shows The Rank Help");
	register_clcmd("say_team /ranks","show_rankhelp",0, "Shows The Rank Help");

	register_clcmd("say /odznaki1","show_badgehelp",0, "Shows The Badge Help");
	register_clcmd("say_team /odznaki1","show_badgehelp",0, "Shows The Badge Help");

	register_clcmd("say /odznaki2","show_badgehelp2",0, "Shows The Badge Help 2");
	register_clcmd("say_team /odznaki2","show_badgehelp2",0, "Shows The Badge Help 2");

	register_clcmd("say /odznaki3","show_badgehelp3",0, "Shows The Badge Help 3");
	register_clcmd("say_team /odznaki3","show_badgehelp3",0, "Shows The Badge Help 3");

	register_clcmd("say", "cmd_say", 0, "<target> ")
	register_clcmd("say_team", "cmd_say", 0, "<target> ")

	register_clcmd("say /gracze", "cmd_who", 0, "Display a list of player and their levels")
	register_clcmd("say_team /gracze", "cmd_who", 0, "Display a list of player and their levels")

	register_clcmd("say /hud", "ShowHUD", 0, "Shows the HUD")
	register_clcmd("say_team /hud", "ShowHUD", 0, "Shows the HUD")

	register_clcmd("say /pomoc", "cmd_help", 0, "Displays the Help")
	register_clcmd("say_team /pomoc", "cmd_help", 0, "Displays the Help")

	register_clcmd("say /bf2menu", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say_team /bf2menu", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say bf2menu", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say_team bf2menu", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say /bf2", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say_team /bf2", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say bf2", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say_team bf2", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say /menu", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say_team /menu", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say menu", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say_team menu", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say /pomoc", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say_team /pomoc", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say pomoc", "Bf2menu", 0, "Displays the Menu")
	register_clcmd("say_team pomoc", "Bf2menu", 0, "Displays the Menu")

	register_clcmd("say /bf2helpmenu", "helpmenu", 0, "Displays the Help Menu")
	register_clcmd("say_team /bf2helpmenu", "helpmenu", 0, "Displays the Help Menu")

	register_clcmd("say /bf2statsmenu", "helpmenu", 0, "Displays the Stats Menu")
	register_clcmd("say_team /bf2statsmenu", "helpmenu", 0, "Displays the Stats Menu")

	register_clcmd("say /bf2adminmenu", "adminmenu", 0, "Displays the Admin Menu")
	register_clcmd("say_team /bf2adminmenu", "adminmenu", 0, "Displays the Admin Menu")

	register_clcmd("say /bf2stats", "show_stats", 0, "Shows your current weapon stats")
	register_clcmd("say_team /bf2stats", "show_stats", 0, "Shows your current weapon stats")

	register_clcmd("say /serverstats", "show_server_stats", 0, "Shows your current weapon stats")
	register_clcmd("say_team /serverstats", "show_server_stats", 0, "Shows your current weapon stats")

	register_clcmd("say /bf2save", "save_badges", 0, "Shows your current weapon stats")
	register_clcmd("say_team /bf2save", "save_badges", 0, "Shows your current weapon stats")

	register_clcmd("bf2_resetstats", "reset_stats", 0, "Resets all of your stats")

		//Admin
	register_clcmd("bf2_addbadge", "add_badge", ADMIN_LEVEL, "<player> <badge#> <level#>")
	register_clcmd("bf2_addkills", "add_kills", ADMIN_LEVEL, "<player> <kills#>")
	register_clcmd("bf2_resetserverstats", "reset_all_stats", ADMIN_LEVEL, "Erases all players stats")


	//Cvars

	//FCVAR_SERVER cvar for game monitor.
	register_cvar("bf2_version",VERSION,FCVAR_SERVER)

	g_bf2_active = register_cvar("bf2_active", "1")
	g_badges_active = register_cvar("bf2_badges", "1")
	g_free_awp = register_cvar("bf2_awp", "0")
	g_<img src='http://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' />_multiplier = register_cvar("bf2_xpmultiplier", "0.1")
	g_icon_hold = register_cvar("bf2_icon_time","1.5")
	g_flag_kills = register_cvar("bf2_flag_kills","2")
	g_flag_round_kills = register_cvar("bf2_flag_round_kills", "0") 
	g_flag_match_kills = register_cvar("bf2_flag_match_kills", "0") 
	g_flag_min_players = register_cvar("bf2_flag_min_players", "1")
	g_help_url = register_cvar("bf2_help_url","")
	g_powers = register_cvar("bf2_badgepowers","1")
	g_hud_options = register_cvar("bf2_hud_options","abcd")
	g_prune_days = register_cvar("bf2_reset_days","21")
	
	//Message sending.
	
	gmsgStatusText = get_user_msgid("StatusText");
	gmsgScreenFade = get_user_msgid("ScreenFade");
	gmsgScreenShake = get_user_msgid("ScreenShake");
	gmsgScoreInfo = get_user_msgid("ScoreInfo");
	gmsgDeathMsg = get_user_msgid("DeathMsg");
	gmsgSayText = get_user_msgid("SayText");

	
	//Register events, logs and forwards to be captured
	
	register_event("ResetHUD", "event_hud_reset", "be")
	register_event("HLTV", "event_new_round", "a", "1=0", "2=0") //add freeztime start code
	register_event("CurWeapon", "event_curweapon", "be","1=1")

	register_logevent("end_freezetime", 2,"0=World triggered","1=Round_Start"); //freezetime end code
	register_logevent("Event_Round_End", 2, "1=Round_End");

	register_message(SVC_INTERMISSION,"event_intermission")
	
	register_event("StatusValue", "setTeam", "be", "1=1");
	register_event("StatusValue", "on_ShowStatus", "be", "1=2", "2!0");
	register_event("StatusValue", "on_HideStatus", "be", "1=1", "2=0");
	register_message(get_user_msgid("StatusValue"), "hook_StatusValue");
	g_status_sync = CreateHudSyncObj();
}

  • +
  • -
  • 0

#2 wrobel02

    Nowy

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:3
Offline

Napisano 26.10.2008 20:57

Witam, dolaczam sie do prosby tak samo mam na swoim serwerze, po zmianie mapy exp poprostu znika i od nowa jest wszystko.
Pytalem kolegow ale tez niewiedza oco chodzi :/
  • +
  • -
  • 0

#3 bartu233

    Zaawansowany

  • Autor tematu
  • Użytkownik

Reputacja: -3
Mniej niż zer0.

  • Postów:87
  • Lokalizacja:Słupsk
Offline

Napisano 26.10.2008 21:51

w tym sma zbytnio nie widze zeby cos bylo zwiazane w zapisywaniem exp, ale z kolei w pliku save.inl moze i to sie da przerobic

//Bf2 Rank Mod save File
//Contains all the saving/loading functions


#if defined bf2_save_included
  #endinput
#endif
#define bf2_save_included


#if !defined SQL
public vault_load(id)
{	
	new vaultkey[64], vaultdata[256]; 
	new TimeStamp;

	formatex(vaultkey,63,"BF2-%s",authid[id]);

	g_PlayerRank[id]=0
	g_PlayerBadges[id][0]=0
	g_PlayerBadges[id][1]=0
	g_PlayerBadges[id][2]=0
	g_PlayerBadges[id][3]=0
	g_PlayerBadges[id][4]=0
	g_PlayerBadges[id][5]=0
	g_PlayerBadges[id][6]=0
	g_PlayerBadges[id][7]=0
	knifekills[id]=0
	pistolkills[id]=0
	sniperkills[id]=0
	parakills[id]=0
	totalkills[id]=0
	defuses[id]=0
	plants[id]=0
	explosions[id]=0
	accuracy[id]=0
	
	smgkills[id]=0
	shotgunkills[id]=0
	riflekills[id]=0;
	grenadekills[id]=0;

	bronze[id]=0;
	silver[id]=0;
	gold[id]=0;


    	if(nvault_lookup(g_Vault, vaultkey, vaultdata, sizeof(vaultdata) - 1, TimeStamp ))
    	{
		
		new str_badge[6][5],str_knife[8],str_pistol[8],str_sniper[8],str_para[8],str_total[8],str_defuses[8],str_plants[8],str_explosions[8]
        	
		replace_all(vaultdata,253,"#"," ")

		parse(vaultdata,str_badge[0],4,str_badge[1],4,str_badge[2],4,str_badge[3],4,str_badge[4],4,str_badge[5],4,str_knife,7,str_pistol,7,str_sniper,7,str_para,7,str_total,7,str_defuses,7,str_plants,7,str_explosions,7)      
        	
		g_PlayerBadges[id][0] = str_to_num(str_badge[0])
        	g_PlayerBadges[id][1] = str_to_num(str_badge[1])
        	g_PlayerBadges[id][2] = str_to_num(str_badge[2])      
        	g_PlayerBadges[id][3] = str_to_num(str_badge[3])
        	g_PlayerBadges[id][4] = str_to_num(str_badge[4])
        	g_PlayerBadges[id][5] = str_to_num(str_badge[5])
		knifekills[id] = str_to_num(str_knife)
		pistolkills[id] = str_to_num(str_pistol)
		sniperkills[id] = str_to_num(str_sniper)
		parakills[id] = str_to_num(str_para)
		totalkills[id] = str_to_num(str_total)
		defuses[id] = str_to_num(str_defuses)
		plants[id] = str_to_num(str_plants)
		explosions[id] = str_to_num(str_explosions)

    	}

	formatex(vaultkey,63,"BF2-2-%s",authid[id]);

	if(nvault_lookup(g_Vault, vaultkey, vaultdata, sizeof(vaultdata) - 1, TimeStamp ))
    	{
		new str_badge2[2][5];
	
		new str_shotgun[8],str_smg[8],str_rifle[8],str_grenade[8],str_gold[8],str_silver[8],str_bronze[8]
        	
		replace_all(vaultdata,253,"#"," ")

		parse(vaultdata,str_badge2[0],4,str_badge2[1],4,str_shotgun,7,str_smg,7,str_rifle,7,str_grenade,7,str_gold,7,str_silver,7,str_bronze,7)

		g_PlayerBadges[id][6] = str_to_num(str_badge2[0])
        	g_PlayerBadges[id][7] = str_to_num(str_badge2[1])
		shotgunkills[id] = str_to_num(str_shotgun)
		smgkills[id] = str_to_num(str_smg)
		riflekills[id] = str_to_num(str_rifle)
		grenadekills[id] = str_to_num(str_grenade)
		gold[id] = str_to_num(str_gold)
		silver[id] = str_to_num(str_silver)
		bronze[id] = str_to_num(str_bronze)
    	}

	for (new i=0; i<MAX_BADGES; i++)
	{
		if (g_PlayerBadges[id][i]>3)
			g_PlayerBadges[id][i]=3

		if (g_PlayerBadges[id][i]<0)
			g_PlayerBadges[id][i]=0	

	}
}
#endif


public load_badges(id) 
{
	#if defined SQL
	if(SQLenabled)
	{
		sql_load(id)
	}
	#else
		vault_load(id)
	#endif

	new numofbadges;

	for (new counter=0; counter<MAX_BADGES; counter++)
	{
		numofbadges=numofbadges+g_PlayerBadges[id][counter]
	}
	
	client_print(id,print_chat,"[BF2] %d Odznaki zostaly zaladowane",numofbadges);
}

public server_load()
{
	#if defined SQL
	if(SQLenabled)
	{
		sql_server_load()
	}
	#else
		vault_server_load()
	#endif



}

public server_save()
{
	#if defined SQL
	if(SQLenabled)
	{
		sql_server_save()
	}
	#else
		vault_server_save()
	#endif
}
#if !defined SQL
public vault_server_save() 
{
    	new vaultkey[64],vaultdata[256]

    	formatex(vaultkey,63,"BF2-ServerData")
    	formatex(vaultdata,255,"%i#^"%s^"#%i#^"%s^"#%i#^"%s^"",highestrankserver,highestrankservername,mostkills,mostkillsname,mostwins,mostwinsname)

	nvault_set(g_Vault,vaultkey,vaultdata)

    	return PLUGIN_CONTINUE;	
}

public vault_server_load()
{	
	new vaultkey[64], vaultdata[256]; 
	new TimeStamp;

	formatex(vaultkey,63,"BF2-ServerData");

    	if(nvault_lookup(g_Vault, vaultkey, vaultdata, sizeof(vaultdata) - 1, TimeStamp ))
    	{	
		new str_rank[8],str_kills[8],str_wins[8]
        	
		replace_all(vaultdata,253,"#"," ")

		parse(vaultdata,str_rank,7,highestrankservername,29,str_kills,7,mostkillsname,29,str_wins,7,mostwinsname,29)      
		        	
		highestrankserver = str_to_num(str_rank)
		mostkills = str_to_num(str_kills)
		mostwins = str_to_num(str_wins)
    	}
}
#endif

public save_badges(id) 
{
	#if defined SQL
	if(SQLenabled)
	{
		sql_save(id)
		return PLUGIN_CONTINUE;
	}
	#else
 
    	if(equal(authid[id],"") || equal(authid[id],"STEAM_ID_PENDING")) 
        	return PLUGIN_HANDLED
    
    	new vaultkey[64],vaultdata[256]

    	formatex(vaultkey,63,"BF2-%s",authid[id])
    	formatex(vaultdata,255,"%i#%i#%i#%i#%i#%i#%i#%i#%i#%i#%i#%i#%i#%i",g_PlayerBadges[id][0],g_PlayerBadges[id][1],g_PlayerBadges[id][2],g_PlayerBadges[id][3],g_PlayerBadges[id][4],g_PlayerBadges[id][5],knifekills[id],pistolkills[id],sniperkills[id],parakills[id],totalkills[id],defuses[id],plants[id],explosions[id])

	nvault_set(g_Vault,vaultkey,vaultdata)

  	formatex(vaultkey,63,"BF2-2-%s",authid[id])
    	formatex(vaultdata,255,"%i#%i#%i#%i#%i#%i#%i#%i#%i",g_PlayerBadges[id][6],g_PlayerBadges[id][7],shotgunkills[id],smgkills[id],riflekills[id],grenadekills[id],gold[id],silver[id],bronze[id])
    
	nvault_set(g_Vault,vaultkey,vaultdata)

	#endif
   
    	return PLUGIN_CONTINUE;	
}

public reset_stats(id)
{
	g_PlayerRank[id]=0
	g_PlayerBadges[id][0]=0
	g_PlayerBadges[id][1]=0
	g_PlayerBadges[id][2]=0
	g_PlayerBadges[id][3]=0
	g_PlayerBadges[id][4]=0
	g_PlayerBadges[id][5]=0
	g_PlayerBadges[id][6]=0
	g_PlayerBadges[id][7]=0
	knifekills[id]=0
	pistolkills[id]=0
	sniperkills[id]=0
	parakills[id]=0
	totalkills[id]=0
	defuses[id]=0
	plants[id]=0
	explosions[id]=0
	accuracy[id]=0

	smgkills[id]=0
	shotgunkills[id]=0
	riflekills[id]=0;
	grenadekills[id]=0;

	bronze[id]=0;
	silver[id]=0;
	gold[id]=0;

	save_badges(id)
}

public reset_all_stats(id)
{
	if (!(get_user_flags(id) & ADMIN_RESET))
	{
		client_print(id,print_chat,"Nie masz dostepu do tej komendy!")
		console_print(id,"Nie masz dostepu do tej komendy!")

		return PLUGIN_CONTINUE
	}

	new players[32],num
	get_players(players,num,"h")
	
	for (new i=0; i<num; i++)
	{
		reset_stats(players[i])
	}

	#if defined SQL
	if (SQLenabled)
	{	
		format(g_Cache,511,"TRUNCATE TABLE bf2ranks")
		SQL_ThreadQuery(g_SqlTuple,"QueryHandle",g_Cache)
	}
	#else
	nvault_prune(g_Vault, 0, get_systime())
	#endif

	new adminauthid[35]
	get_user_authid (id,adminauthid,34)

	log_amx("[BF2-ADMIN]Wszystkie statystyki serwera zostaly skasowane przez Admina %s",adminauthid)

	return PLUGIN_CONTINUE
}
#if !defined SQL
public vault_init()
{
	g_Vault=nvault_open("bf2data")
	server_load();
}
#endif
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{ rtf1 ansi deff0{ fonttbl{ f0 fnil Tahoma;}}n viewkind4 uc1 pard lang1045 f0 fs16 n par }
*/

  • +
  • -
  • 0

#4 fanta_styczny

    Nowy

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:3
Offline

Napisano 22.03.2009 22:00

Witam.
a ja mam podobny problem lecz w odwrotnym kierunku ;D
Chciałem żeby się rank zapisywał na SID a nie na NICK ...
  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych