View Single Post
Author Message
eNNkds
Member
Join Date: Sep 2012
Location: Romania
Old 12-16-2018 , 11:40   [UWC3X] Bug and XP doesen't load mysql
Reply With Quote #1

Hello i'm using uwc3x mod. i found a bug with hud mesage and xp wont connect to mysql.

Server Console
Code:
12/16/2018 - 18:29:46: [uwc3x.amxx] [UWC3X] SQ :: Loading XP for user Nic0|Zor :: [Start]
12/16/2018 - 18:29:46: [uwc3x.amxx] [UWC3X] SQ :: Loading XP :: Connected [FAILED]
12/16/2018 - 18:29:46: [uwc3x.amxx] [UWC3X] Error connecting to SQ database : Access denied for user 'root'@'localhost' (using password: NO)
12/16/2018 - 18:29:46: [uwc3x.amxx] [UWC3X] Entering Skills_Check
12/16/2018 - 18:29:47: [uwc3x.amxx] [UWC3X] Entering Skills_Check
12/16/2018 - 18:29:47: [uwc3x.amxx] [UWC3X] Setting Mine Count
12/16/2018 - 18:29:47: [uwc3x.amxx] [UWC3X] Mine Count = 0
SQL Config Server
Code:
// SQL configuration file
amx_sql_host    "127.0.0.1"
amx_sql_user    "root"
amx_sql_pass    "blablabla"
amx_sql_db      "amx"
amx_sql_table   "admins"
amx_sql_type    "mysql"
amx_sql_timeout "60"
SQL Config UWC3x Mode
Code:
            //********************Ultimate Warcraft3 Expansion Configuration File********************\\



//--Debuging Settings

UWX_DEBUG 				0				//set to 0 to disable debug mode, or set to a number to enable that level of debug

UWX_USE_DEBUG_CASH 			0			//Set to 0 to disable, otherwise amount is given to each player each respawn or round

UWX_show_player				0			//Set to 0 to disable -- Depricated

UWX_spec_info				1			//Set to 0 to disable -- Depricated



//----------------------------------------------------------------------------------------------------------------------\\



//--Main settings for XP saving - Fast XP or Long term, etc

sv_uwc3x	        		"1"         //set to 0 to disable the plugin

mp_savexp            		"1"         //Set 1 to save Long Term XP

UWX_saveby            		"2"         //Set 1 to save by STEAMID, 2 to save by Player Name

mp_save_method        		"1"         //Set 1 to use AMXX SQLX (MySQL) storage, 2 for SQLITE (not yet supported)

mp_xpmultiplier        		"1.5"       //Multiplier for xp table (xp needed per level)

mp_weaponxpmodifier        	"1"			//Awards xp for various weapons

UWX_enable_savedskillsets   "1"    		//Use saved skill sets to avoid having to resetskills all the time



//----------------------------------------------------------------------------------------------------------------------\\



//--SQL Database Server Settings

UWX_sql_host    			"127.0.0.1"			//Server host name.If its on the same computer it should be "127.0.0.1" or "localhost"

UWX_sql_user    			"root"			//Database User Name

UWX_sql_pass    			"blablabla"		//Database User Password

UWX_sql_db    				"uwc3x"		//Database Name



//----------------------------------------------------------------------------------------------------------------------\\



//--Starting Method Settings

UWX_enable_starting_system  "0"			//If the starting XP/Level system is enabled

UWX_starting_level         	"30"        //Level to start players at

UWX_starting_method        	"2"         //Which one to give players 1=XP 2=Level  

UWX_starting_xp            	"90000"     //Starting XP to give new players



//----------------------------------------------------------------------------------------------------------------------\\



//--Bot Related Settings

UWX_enable_bot_skills    	"1"         //Enable to randomly pick resists, attribs, and skills for bots

UWX_bot_level        		"0"        //Level to set bots to



//----------------------------------------------------------------------------------------------------------------------\\



//--Giving XP and Level Settings (Admins Only)

UWX_disable_givexp        	"0"         //Set 1 to turn the amx_givexp command off

UWX_disable_setlevel    	"0"         //Set 1 to turn the amx_setlevel command off

UWX_disable_adminmenu    	"0"         //Set 1 to turn off the XP portion of the admin menu

UWX_disable_reset        	"0"         //Set 0 to disable ability for admins to reset players skills

UWX_admin_flag        		"1048576"   //Access Flag for Giving XP, Default is ADMIN_MENU

UWX_admin_flag_skills    	"524288"      //Access Flag for Admin only skills

										//The Custom flag values are listed below

										//ADMIN_LEVEL_A = 4096

										//ADMIN_LEVEL_B = 8192

										//ADMIN_LEVEL_C = 16384

										//ADMIN_LEVEL_D = 32768

										//ADMIN_LEVEL_E = 65536

										//ADMIN_LEVEL_F = 131072

										//ADMIN_LEVEL_G = 262144

										//ADMIN_LEVEL_H = 524288

										//ADMIN_MENU  = 1048576



//----------------------------------------------------------------------------------------------------------------------\\



//--Set to 1 to enable admin only skills

UWX_admin_mode    "1"

//Are these skills only for admins? 1 yes 0 no

//if these are removed they default to 0 (off)

UWX_vengance_adminonly		"0"

UWX_fanofknives_adminonly	"0"

UWX_blink_adminonly			"0"

UWX_trueshot_adminonly      "0"

UWX_voodoo_adminonly        "0"

UWX_repair_adminonly        "0"

UWX_napalm_adminonly        "0"

UWX_suicide_adminonly       "0"

UWX_icenade_adminonly       "0"

UWX_earthquake_adminonly    "0"

UWX_clusternade_adminonly   "0"

UWX_smite_adminonly        	"0"

UWX_rope_adminonly          "1"

UWX_grab_adminonly          "1"

UWX_hook_adminonly          "1"



//----------------------------------------------------------------------------------------------------------------------\\



//--Mole Settings

UWX_Enable_Mole        		"1"    		//Do you want to enable the Mole?

UWX_Enable_AdminMole    	"1"    		//Do you want admins to be able to buy mole even though its disabled?



//----------------------------------------------------------------------------------------------------------------------\\



//--Tome of Experience Settingsd

UWX_max_tomes    			"7"			//The maximum amount of tomes that can be purchased by one player per round

UWX_xpbonus        			"100"		//XP for the tome of experience



//----------------------------------------------------------------------------------------------------------------------\\



//--XP bonuses for Skill,Ultimates and map Objectives

//1.Aditional Settings

UWX_dmgxpbonus            	"1"         //Set 1 to Give XP bonus for doing most dmg to enemy

UWX_min_b4_XP           	"2"         //min. num of players needed to award XP 

UWX_xp_radius            	"1000"      //Objective radius for XP to teammates

UWX_underdog_kills          "1"         //Set 1 to Give XP bonus for underdog kills

UWX_hostage_touch_bonus     "1"         //Set 1 to Give XP bonus for touching the hostage

UWX_hostage_kill_xp        	"1"         //Set 1 to remove XP for killing a hostage

UWX_attempt_defuse_bonus    "1"         //Set 1 to Give XP bonus for attempting to defuse the bomb

UWX_bomb_event_bonus        "1"         //Set 1 to Give XP bonus for bomb events

UWX_VIP_spawn_bonus         "1"         //Set 1 to Give XP bonus for spawning as the VIP



//2.Skills and Ultimates

UWX_mend_XP            		"450"		//XP bonus amount for mending teammate wounds

UWX_repair_XP        		"400"		//XP bonus amount for repairing teammate armor

UWX_dispell_XP        		"400"		//XP bonus amount for mending teammate wounds

UWX_healingwave_XP        	"200"		//XP for healing wave

UWX_team_shield_xp        	"550"		//XP for using Team Shield (base value)

UWX_phoenix_XP        		"550"		//XP bonus amount for reviving a teammate with Phoenix



//3.Map Objectives

UWX_round_win_XP            "225"       //XP for the winning team

UWX_headshot_bonus          "100"       //XP for getting a headshot

UWX_defusexp                "220"       //XP for defusing the bomb

UWX_hostagexp            	"220"       //XP for helping to rescue the hostages

UWX_killrescuemanxp        	"220"       //XP for killing the hostage rescuer 

UWX_kill_bomb_carrier_bonus "220"     	//XP for killing the bomb carrier

UWX_defuser_kill_bonus      "200"       //XP for killing the defuser

UWX_VIP_kill_bonus          "220"       //XP for killing the VIP

UWX_VIP_escape_bonus        "250"       //XP for when the VIP escapes

UWX_bombplanterxp           "120"       //XP for planting the bomb



//----------------------------------------------------------------------------------------------------------------------\\



//--Other Settings

UWX_lowres_default        	"1"			//Set 1 to make lowres display setting default

UWX_medicalerts        		"2"			//Set 1 to have Medic Alerts be sent from injured teammates,2 use icons to.

UWX_write_html        		"1"			//If you want it to write uwc3_NAME.html files for easy exporting



//----------------------------------------------------------------------------------------------------------------------\\



//--Enhancements and Resistances/Attribs

UWX_use_enh            		"1"         //Set 1 to allow attributes/resistances to be enhanced

UWX_enh_minlevel        	"16"        //Min. level to start buying enhancements

UWX_max_resistvalue    		"20"        //Max. allowable value each resistance can be trained 

UWX_max_attribpts        	"40"        //Max. number of obtainable attribute pts (max is 40)

UWX_max_resistpts        	"75"        //Max. number of obtainable resistance pts (max is 500)

UWX_attrib_xpmodifier    	"0.5"       //This is a good setting for Long Term XP

UWX_resist_xpmodifier    	"0.5"       //This is a good setting for Long Term XP



//----------------------------------------------------------------------------------------------------------------------\\



//--Shopmenu1 Items Settings

//1.Items Settings

UWX_BOOTSPEED        		"300.0"     //Set a float value for the Boots of Speed (275 default)

UWX_FROSTSPEED        		"250.0"     //Set a float value for the Frost skill speed

UWX_MASKPERCENT        		"0.7"       //Set a float value for the Mask item

UWX_CLAWSOFATTACK        	"6"         //Set an integer value for the Claws of Attack item (6 default)

UWX_CLOAKINVISIBILITY    	"200"       //Set an integer value for the Cloak item (180 default)

UWX_HEALTHBONUS        		"15"        //Set an integer value for the Health rings



//2.Items Prices

UWX_price_ANKH        		"2000"		//The price of Ankh

UWX_price_BOOTS        		"2000"		//The price of Boots

UWX_price_CLAWS        		"2000"		//The price of Claws

UWX_price_CLOAK        		"2000"		//The price of Cloak

UWX_price_MASK        		"2000"		//The price of Mask

UWX_price_IMMUNITY        	"2000"		//The price of necklace

UWX_price_FROST        		"2000"		//The price of Frost

UWX_price_HEALTH        	"2000"		//The price of Health

UWX_price_TOME        		"4000"		//The price of Tome



//----------------------------------------------------------------------------------------------------------------------\\



//--Shopmenu2 Items Settings

//1.Items Settings

UWX_glove_timer        		"15"       //Time for receiving a new grenade with Flaming Gloves

UWX_no_gloves_on_ka    		"1"        //Prevents Flaming gloves of Warmth on ka maps

UWX_glove_orc_damage    	"1"        //1 allows critgren dmg for flaming glove nades

UWX_no_orcnades_on_he    	"1"        //Prevents orc nades on he maps and jail_riot



//2.Items Prices

UWX_price_RESPAWN        	"10000"		//The price of Respawn

UWX_price_PROTECTANT    	"5500"		//The price of Mole Protect

UWX_price_HELM        		"5000"		//The price of Helm

UWX_price_CAT        		"4000"		//The price of Amulet

UWX_price_FEATHER        	"4000"		//The price of Feather

UWX_price_INFERNO        	"4000"		//The price of Inferno

UWX_price_REGEN        		"4000"		//The price of Rings

UWX_price_CHAMELEON    		"10000"		//The price of Chameleon

UWX_price_MOLE        		"16000"		//The price of Mole



//----------------------------------------------------------------------------------------------------------------------\\



//--Shopmenu3 Items Settings

UWX_price_HEAL        		"5000"		//The price of Heal

UWX_price_INVIS        		"9000"		//The price of Invisibility

UWX_price_INVUL        		"9000"		//The price of Invulnerbility

UWX_price_GATE        		"7000"		//The price of Gate

UWX_price_DISEASE        	"6000"		//The price of Cure Disease

UWX_price_POISON        	"6000"		//The price of Cure Poison

UWX_price_FIRE        		"6000"		//The price of Cure Fire

UWX_price_ROTITEM        	"6000"		//The price of Cure Rot

UWX_price_DEHEX        		"6000"		//The price of De-Hex



//----------------------------------------------------------------------------------------------------------------------\\



//--Ultimate and Skills Settings

UWX_luck_skill            	 "1"         //Set 1 to allow Beginner's Luck skill for players lvl 0-4

UWX_ultimatedelay            "6.0"       //time delay for ultimates each round

UWX_force_vengeance        	 "1"         //Set 1 to allow Vengeance to work within ultimate delay

UWX_healing_range            "800"       //Range for Healing Wave to jump

UWX_unlimited_ammo_time      "5"         //The time the user has unlimited ammo for(Unlimited Ammo Ultimate)

UWX_badaim_time            	 "5"         //The amount of time that the user is "disoriented" for

UWX_entanglingroots_cooldown "15.0"    	 //Entangling roots (default is 35.0)

UWX_chainlightning_cooldown  "15.0"    	 //Chainlightning (default is 35.0)

UWX_locusts_cooldown         "15.0"    	 //Locusts (default is 35.0)

UWX_flash_cooldown           "15.0"      //Flash of Light (default is 25.0)

UWX_bigbadvoodoo_cooldown    "15.0"      //Big Bad Voodoo (default is 35.0)

UWX_flamestrike_cooldown     "15.0"      //Flame Strike (default is 35.0)

UWX_team_shield_cooldown     "15.0"      //Cooldown for Team Shield - value should be written as a decimal



//Suicide Bomber Ultimate Settings

UWX_warn_suicide             "1"         //Warns when Suicide Bomber is armed

UWX_blast_radius             "240"       //Blast Radius for Suicide Bomber

UWX_explosion_range        	 "280"       //Range of the Suicide Bomber's explosion

UWX_explosion_max_damage     "100"       //Max damage for explosion



//Teleport Ultimate Settings (do not confuse with Blink Skill)

UWX_teleport_cooldown        "15.0"    	//Teleport (default is 35.0)

UWX_blinkstartdisabled       "1"        //1 makes blink disabled for first 15 secs of rounds

UWX_blink_cooldown           "3.0"      //Time to wait for a retry of blink

UWX_blink_diziness           "2"        //Flashbang effect is 1, for blue diziness set to 2

UWX_blink_protection         "1"       	//Slays people who abuse blink on some maps

UWX_blink_delay            	 "15.0"    	//Delay for blink to be used 

UWX_blink_radius            "400"       //Enemies w/ immunity w/in radius cause blink to fail



//Gate Ultimate Settings

UWX_gate_cooldown            "5.0"      //Gate cool down - represented as a float (decimal)

UWX_gate_cooldown_int        "5"        //Gate cool down - represented as a INT (whole number) - should be the same 



//Jump Kick Skill Settings

UWX_jumpkick_radius        	"70.0"    	//Radius for jumpkick - value should be written as a decimal

UWX_jumpkick_cooldown        "15.0"    	//Cooldown for jumpkick - value should be written as a decimal



//Depower Ultimate Settings

UWX_depower_cooldown         "15.0"    	//Cooldown for Depower - value should be written as a decimal

UWX_depower_disallow_drop    "1"       	//When a user is depowered they can not drop the weapon until the enemyu's cooldown is done



//Cripple Ultimate Settings

UWX_cripple_chance1        	 "0.04"    	//Default is 5% chance - Chance of completely imobilizing player for 3 seconds

UWX_cripple_chance2        	 "0.08"    	//Default is 5% chance - Chance of significantly reducing players speed for 6 seconds

UWX_cripple_blocks_ultimates "0"       	//If Cripple will block users from ultimates while crippled, like gate, teleport, etc.



//Fatal Strike Skill

UWX_fatal_slay_chance        "0.02"    	//% chance of doing an instant kill with mastery of Fatal Strike



//Bless

UWX_BLESS_XP 				 "1000"		//Amount of XP to get when using Bless



//Helm Splitter Ultimate

UWX_splitter_chance        	 "0.15"    	//Chance of a body shot shattering a HS Helm



//Hooks, rope and Grab

UWX_hook_no_vip    			"1"       	//1 = VIP can not use hook, 0 = VIP CAN use hook

UWX_rope_no_vip    			"1"         //1 = VIP can not use rope, 0 = VIP CAN use 

UWX_grab_no_vip    			"1"         //1 = VIP can not use grab, 0 = VIP CAN use grab

UWX_grab_speed    			"5" 		//Speend of the Grab

UWX_rope_speed    			"5"			//Speed of the Rope

UWX_hook_speed    			"5"			//Speed of the Hook

UWX_grab_cooldown    		"15"		//Change of Grabing and enemy (allso influented by the enemy speed)   

UWX_grab_chance    			"0.50"     	//Change of Grabing and enemy (allso influented by the enemy speed)



//----------------------------------------------------------------------------------------------------------------------\\



echo [UWC3X] UWC3X.cfg has been executed



//-----------------------------------------------------------------------------------------------------------------------\\
Debug Mode uwc3x.amxx
Code:
L 12/16/2018 - 18:25:01: [AMXX] Displaying debug trace (plugin "uwc3x.amxx", version "1.0.82")
L 12/16/2018 - 18:25:01: [AMXX] Run time error 25: parameter error 
L 12/16/2018 - 18:25:01: [AMXX]    [0] stock.inl::hudchat_show (line 104)
L 12/16/2018 - 18:25:01: [AMXX]    [1] shopmenu.inl::Buy_Item (line 173)
Shopmenu.inl
Code:
/*
	SHOPMENU
*/

//set prices
public Set_Shopmenu1_Prices ( )
{
	// [07-31-04] Check for shop item cost overrides from config file
	if ( CVAR_SM1_PRICE_ANKH )
	{
		itemcost[ANKH-1] = CVAR_SM1_PRICE_ANKH;
	}

	if ( CVAR_SM1_PRICE_BOOTS )
	{
		itemcost[BOOTS-1] = CVAR_SM1_PRICE_BOOTS;
	}

	if ( CVAR_SM1_PRICE_CLAWS )
	{
		itemcost[CLAWS-1] = CVAR_SM1_PRICE_CLAWS;
	}

	if ( CVAR_SM1_PRICE_CLOAK )
	{
		itemcost[CLOAK-1] = CVAR_SM1_PRICE_CLOAK;
	}

	if ( CVAR_SM1_PRICE_MASK )
	{
		itemcost[MASK-1] = CVAR_SM1_PRICE_MASK;
	}

	if ( CVAR_SM1_PRICE_NECKLACE )
	{
		itemcost[IMMUNITY-1] = CVAR_SM1_PRICE_NECKLACE;
	}

	if ( CVAR_SM1_PRICE_FROST )
	{
		itemcost[FROST-1] = CVAR_SM1_PRICE_FROST;
	}

	if ( CVAR_SM1_PRICE_HEALTH )
	{
		itemcost[HEALTH-1] = CVAR_SM1_PRICE_HEALTH;
	}

	if ( CVAR_SM1_PRICE_TOMEXP )
	{
		itemcost[TOME-1] = CVAR_SM1_PRICE_TOMEXP;
	}
}

public Set_Shopmenu1_Values ( )
{
	// [07-31-04] Check for other setting overrides from config file
	if ( CVAR_SM1_ITEM_BOOT_SPEED )
	{
		BOOTSPEED = CVAR_SM1_ITEM_BOOT_SPEED;
	}

	if ( CVAR_SM1_ITEM_FROST_SPEED )
	{
		FROSTSPEED = CVAR_SM1_ITEM_FROST_SPEED;
	}

	if ( CVAR_SM1_ITEM_MASK_PERCENT )
	{
		MASKPERCENT = CVAR_SM1_ITEM_MASK_PERCENT;
	}

	if ( CVAR_SM1_ITEM_CLAWS_DAMAGE )
	{
		CLAWSOFATTACK = CVAR_SM1_ITEM_CLAWS_DAMAGE;
	}

	if ( CVAR_SM1_ITEM_CLOAK_INVIS )
	{
		CLOAKINVISIBILITY = CVAR_SM1_ITEM_CLOAK_INVIS;
	}

	if ( CVAR_SM1_ITEM_HEATH_BONUS )
	{
		HEALTHBONUS = CVAR_SM1_ITEM_HEATH_BONUS;
	}
}

//itemsinfo
public Show_Items_Info1( id )
{
	if ( !uwc3x )
		return PLUGIN_CONTINUE;
	
	new temp[1024] , pos = 0;
	pos += format( temp[pos] , 1024-pos , "<body bgcolor = #000000><font color = #FFB000>" );
	pos += format( temp[pos] , 1024-pos , "%L:<p><ul>", id, "SHOPMENU1_HEADER" );
	pos += format( temp[pos] , 1024-pos , "<li>%L</li>" , id, "SHOPMENU1_ANKH" );
	pos += format( temp[pos] , 1024-pos , "<li>%L</li>" , id, "SHOPMENU1_BOOTS" );
	pos += format( temp[pos] , 1024-pos , "<li>%L</li>" , id, "SHOPMENU1_CLAWS" , CLAWSOFATTACK );
	pos += format( temp[pos] , 1024-pos , "<li>%L</li>" , id, "SHOPMENU1_CLOAK" );
	pos += format( temp[pos] , 1024-pos , "<li>%L</li>" , id, "SHOPMENU1_MASK" );
	pos += format( temp[pos] , 1024-pos , "<li>%L</li>" , id, "SHOPMENU1_NECKLACE" );
	pos += format( temp[pos] , 1024-pos , "<li>%L</li>" , id, "SHOPMENU1_ORB" );
	pos += format( temp[pos] , 1024-pos , "<li>%L</li>" , id, "SHOPMENU1_PERIPHAT" );
	pos += format( temp[pos] , 1024-pos , "<li>%L</li></ul>" , id, "SHOPMENU1_TOME" );

	show_motd( id , temp , "Shopmenu Item Information" );
	return PLUGIN_CONTINUE;
}

//shopmenu
public ShopMenu( id )
{

	if ( !uwc3x )
		return PLUGIN_CONTINUE;

	new pos = 0;
	new keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9);
	new menu_body[512];
	
	pos += format( menu_body[pos], 511 - pos, "\yBuy Item\R$ Cost^n^n" );
	
	for ( new i = 0; i < 9; i++ )
	{
		pos += format( menu_body[pos], 511 - pos, "\w%d. %s\y\R%d^n", i + 1 , itemname[i], itemcost[i] );
	}
	
	pos += format( menu_body[pos], 511 - pos, "^n\w0. Exit" );
	show_menu( id, keys, menu_body, -1 );
	return PLUGIN_HANDLED;
}

//buy_item
public Buy_Item( id , key )
{
	
	if ( !uwc3x )
		return PLUGIN_CONTINUE;

	if ( !Shopmenu_canBuy ( id, 1, key ) )
		return PLUGIN_HANDLED;
	
	new usermoney = cs_get_user_money( id );

	if ( key == TOME - 1 )
	{
		cs_set_user_money( id, usermoney - itemcost[key], 1 );
		new p_tomes = playertombs[id];
		p_tomes++;

		if ( CVAR_DEBUG_MODE )
		{
			new tempVar[64];
			get_user_name ( id, tempVar, 63 );
			log_amx( "[UWC3X] DEBUG :: Buy_Item: Buy Tome -> Player: %s Current Amount: %d New Amount: %d", tempVar, playertombs[id], p_tomes);
		}

		playertombs[id] = p_tomes;

		// Give XP bonus for buying Tome of Experience
		xpgiven = xpgiven_lev[p_level[id]];
		new iXP = ( XPBONUS + xpgiven );
		playerxp[id] += iXP;
	
		if( Util_Should_Msg_Client(id) )
		{
			if ( file_exists( "sound/uwc3x/tomes.wav" ) == 1 )
				emit_sound( id, CHAN_ITEM, "uwc3x/tomes.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );

			//client_print ( id, print_chat, "%L", id, "SHOPMENU1_TOME2", MOD, iXP );
			hudchat_show(id, "%L", id, "SHOPMENU1_TOME2", iXP);
			hudchat_update(id);
		}
	
		displaylevel( id, 3 );
		return PLUGIN_HANDLED;
	}
	else
	{
	
		cs_set_user_money( id, usermoney - itemcost[key], 1 );
	
		// Remove health bonus after buying new item
		if ( playeritem[id] == HEALTH )
			set_user_health_log( id, get_user_health( id ) - HEALTHBONUS );
	
		playeritem[id]= key + 1;
	
		if ( playeritem[id] == HEALTH )
		{
			// Give health bonus for buying periapt of health
			set_user_health_log( id, get_user_health( id ) + HEALTHBONUS );
	
			if ( CVAR_DEBUG_MODE )
			{
				new name[32];
				get_user_name(id, name, 31);
				log_amx( "[UWC3X] DEBUG :: In buy_item() :: [%s] Bought Health Has=(%d) Max=(%d)",name, get_user_health(id), maxhealth[id] );
			}
		}
	}

	if( Util_Should_Msg_Client(id) )
	{
		if ( file_exists( "sound/uwc3x/shopmenu/sm_pickupitem.wav" ) == 1 )
			emit_sound (id, CHAN_STATIC, "uwc3x/shopmenu/sm_pickupitem.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
	}

	displaylevel( id, 3 );	
	return PLUGIN_HANDLED;
}
Stock.inl
Code:

stock __HUDCHAT_R = 255;
stock __HUDCHAT_G = 255;
stock __HUDCHAT_B = 255;

stock __HUDCHAT_CHANNEL = 2;

stock Float:__HUDCHAT_REMOVETIME = 5.0;

stock Array:__HUDCHAT_MESSAGES[33];
stock __HUDCHAT_MSGCOUNT[33];

stock __HUDCHAT_MAXPLAYERS;

stock hudchat_init()
{
	__HUDCHAT_MAXPLAYERS = get_maxplayers();
	
	for(new i = 1; i <= __HUDCHAT_MAXPLAYERS; i++)
	{
		__HUDCHAT_MESSAGES[i] = ArrayCreate(__HUDCHAT_MAXMSGLEN);
		__HUDCHAT_MSGCOUNT[i] = 0;
	}
}

stock hudchat_end()
{
	for(new i = 1; i <= __HUDCHAT_MAXPLAYERS; i++)
	{
		ArrayDestroy(__HUDCHAT_MESSAGES[i]);
		__HUDCHAT_MSGCOUNT[i] = 0;
		
		remove_task(i + __HUDCHAT_TASKID_REMOVE);
		remove_task(i + __HUDCHAT_TASKID_UPDATE);
	}
}

stock hudchat_update(id)
{
	if(id)
	{
		new taskid = id + __HUDCHAT_TASKID_UPDATE;
		
		__TaskShowHudChat(taskid);
		
		remove_task(taskid);
		set_task(__HUDCHAT_UPDATEINTERVAL, "__TaskShowHudChat", taskid, .flags = "b");
	}
	else
	{
		for(id = 1; id <= __HUDCHAT_MAXPLAYERS; id++)
		{
			hudchat_update(id);
		}
	}
}

stock hudchat_get_maxlines()
{
	return __HUDCHAT_MAXLINES;
}

stock hudchat_set_color(r, g, b)
{
	__HUDCHAT_R = (r & 255);
	__HUDCHAT_G = (g & 255);
	__HUDCHAT_B = (b & 255);
}

stock hudchat_get_color(&r, &g, &b)
{
	r = __HUDCHAT_R;
	g = __HUDCHAT_G;
	b = __HUDCHAT_B;
}

stock hudchat_set_removetime(Float:_time)
{
	if(_time > 0.0 )
	{
		__HUDCHAT_REMOVETIME = _time;
	}
}

stock Float:hudchat_get_removetime()
{
	return __HUDCHAT_REMOVETIME;
}

stock hudchat_set_channel(channel)
{
	__HUDCHAT_CHANNEL = channel;
}

stock hudchat_get_channel()
{
	return __HUDCHAT_CHANNEL;
}

stock hudchat_show(id, const msg[], any:...)
{
	new message[__HUDCHAT_MAXMSGLEN];
	vformat(message, charsmax(message), msg, 3);
	
	if(id)
	{
		while(__HUDCHAT_MSGCOUNT[id] >= __HUDCHAT_MAXLINES)
		{
			ArrayDeleteItem(__HUDCHAT_MESSAGES[id], 0);
			__HUDCHAT_MSGCOUNT[id]--;
		}
		
		ArrayPushString(__HUDCHAT_MESSAGES[id], message);
		__HUDCHAT_MSGCOUNT[id]++;
		
		new taskid = id + __HUDCHAT_TASKID_REMOVE;
		
		remove_task(taskid);
		set_task(__HUDCHAT_REMOVETIME, "__TaskRemoveHudChat", taskid);
	}
	else
	{
		for(id = 1; id <= __HUDCHAT_MAXPLAYERS; id++)
		{
			hudchat_show(id, "%s", message);
		}
	}
}

stock hudchat_clear(id)
{
	if(id)
	{
		ArrayClear(__HUDCHAT_MESSAGES[id]);
		__HUDCHAT_MSGCOUNT[id] = 0;
		
		remove_task(id + __HUDCHAT_TASKID_REMOVE);
		remove_task(id + __HUDCHAT_TASKID_UPDATE);
	}
	else
	{
		for(id = 1; id <= __HUDCHAT_MAXPLAYERS; id++)
		{
			hudchat_clear(id);
		}
	}
}

stock user_spawn( index )
{
	return spawn(index);
}
stock cmd_target2 ( id,const arg[] ) 
{
	new player = find_player ( "bl", arg );

	if ( player )
	{
		if ( player != find_player ( "blj", arg ) )
		{
			console_print ( id,"There are more clients matching to your argument" );
			return 0;
		}
	}
	else if ( ( player = find_player ( "c",arg ) )==0 && arg[0]=='#' && arg[1] )
	{
		player = find_player ( "k",str_to_num ( arg[1] ) );
	}

	if ( !player )
	{
		console_print ( id, "Client with that name or userid not found" );
		return 0;
	}

	return player;
}

stock ExplodeString ( p_szOutput[][], p_nMax, p_nSize, p_szInput[], p_szDelimiter )
{
	new nIdx = 0, l = strlen ( p_szInput );
	new nLen = ( 1 + copyc ( p_szOutput[nIdx], p_nSize, p_szInput, p_szDelimiter ) );

	while ( ( nLen < l ) && ( ++nIdx < p_nMax ) )
	{
		nLen += ( 1 + copyc ( p_szOutput[nIdx], p_nSize, p_szInput[nLen], p_szDelimiter ) );
	}

	return;
}

stock sq ( num ) 
{
	return ( num * num );
}

stock diff ( num,num2 )
{
	if ( num>num2 )
	{
		return ( num-num2 );
	}
	else
	{
		return ( num2-num );
	}

	return 0;
}

stock str_break ( const String[], Left[], Right[], lMax, rMax )
{
	new bool:quote_flag = false;
	new bool:done_flag = false;
	new left_pos = 0;
	new right_pos = 0;
	new i;
	new hold[] = "'^"x";

	copy ( Left, lMax, "" );
	copy ( Right, rMax, "" );

	for ( i=0; i<=strlen ( String )-1; i++ ) 
	{
		if ( equali ( String[i], "^"", 1 ) ) 
		{
			quote_flag = true;
		}
		else if ( ( equali ( String[i], "^"", 1 ) ) && ( quote_flag ) ) 
		{
			quote_flag = false;
		}

		if ( ( equali ( String[i], " ", 1 ) ) && ( !quote_flag ) && ( !done_flag ) ) 
		{
			done_flag = true;
			i++;
		}

		if ( !done_flag && !equali ( String[i], "^"", 1 ) ) 
		{
			if ( left_pos < lMax ) 
			{
				setc ( Left[left_pos], 1, String[i] )
				if ( equali ( Left[left_pos], "'", 1 ) ) 
				{
					setc ( Left[left_pos], 1, hold[1] );
				}
				left_pos++;
			}
		}
		else
		{
			if ( right_pos < rMax && !equali ( String[i], "^"", 1 ) ) 
			{
				setc ( Right[right_pos], 1, String[i] );

				if ( equali ( Right[right_pos], "'", 1 ) ) 
				{
					setc ( Right[right_pos], 1, hold[1] );
				}

				right_pos++;
			}
		}
	}

	Left[left_pos] = 0;
	Right[right_pos] = 0;

	return true;
}


stock replaceall ( text[], const LEN, const WHAT[], const WITH[] ) 
{
	while ( contain ( text, WHAT ) != -1 )
	{
		server_print ( "replacing a ' ..." );
		replace ( text, LEN, WHAT, WITH );
	}
}

stock getMaxClipAmmo(wpnid)
{
	new clipammo = 0;
	switch (wpnid)
	{
		case CSW_P228 : clipammo = 13;
		case CSW_SCOUT : clipammo = 10;
		case CSW_HEGRENADE : clipammo = 0;
		case CSW_XM1014 : clipammo = 7;
		case CSW_C4 : clipammo = 0;
		case CSW_MAC10 : clipammo = 30;
		case CSW_AUG : clipammo = 30;
		case CSW_SMOKEGRENADE : clipammo = 0;
		case CSW_ELITE : clipammo = 15;
		case CSW_FIVESEVEN : clipammo = 20;
		case CSW_UMP45 : clipammo = 25;
		case CSW_SG550 : clipammo = 30;
		case CSW_GALI : clipammo = 35;
		case CSW_FAMAS : clipammo = 25;
		case CSW_USP : clipammo = 12;
		case CSW_GLOCK18 : clipammo = 20;
		case CSW_AWP : clipammo = 10;
		case CSW_MP5NAVY : clipammo = 30;
		case CSW_M249 : clipammo = 100;
		case CSW_M3 : clipammo = 8;
		case CSW_M4A1 : clipammo = 30;
		case CSW_TMP : clipammo = 30;
		case CSW_G3SG1 : clipammo = 20;
		case CSW_FLASHBANG : clipammo = 0;
		case CSW_DEAGLE : clipammo = 7;
		case CSW_SG552 : clipammo = 30;
		case CSW_AK47 : clipammo = 30;
		case CSW_KNIFE : clipammo = 0;
		case CSW_P90 : clipammo = 50;
	}
	return clipammo;
}

public add_grenade_owner( owner ) 
{
	for ( new i = 0; i < 32; i++ ) 
	{
		if ( grenade[i] == 0 ) 
		{
			grenade[i] = owner;
			return;
		}
	}
}

stock get_grenade_owner() 
{
	new which = grenade[0]
	for ( new i = 1; i < 32; i++ ) 
	{
		grenade[i - 1] = grenade[i];
	}

	grenade[31] = 0;

	return which;
}

//
//Stocks ripped from xtrafun.inc for AMXx
//
//Gets the velocity of an entity */
stock get_entity_velocity(index, velocity[3]) 
{
	new Float:vector[3];
	entity_get_vector(index, EV_VEC_velocity, vector);
	FVecIVec(vector, velocity);
}

//Sets the velocity of an entity
stock set_entity_velocity(index, velocity[3]) 
{
	new Float:vector[3];
	IVecFVec(velocity, vector);
	entity_set_vector(index, EV_VEC_velocity, vector);
}

stock set_rendering2(index, fx=kRenderFxNone, r=255, g=255, b=255, render=kRenderNormal, amount=16)
{
#if defined engine
	return set_rendering(index,fx,r,g,b,render,amount)
#else
	set_pev(index, pev_renderfx, fx);
	new Float:RenderColor[3];
	RenderColor[0] = float(r);
	RenderColor[1] = float(g);
	RenderColor[2] = float(b);
	set_pev(index, pev_rendercolor, RenderColor);
	set_pev(index, pev_rendermode, render);
	set_pev(index, pev_renderamt, float(amount));
	return 1;
#endif
}

stock Spawn_Ent(const classname[]) 
{
	new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, classname))
	set_pev(ent, pev_origin, {0.0, 0.0, 0.0})    
	dllfunc(DLLFunc_Spawn, ent)
	return ent
}

stock Float:Vec2DLength( Float:Vec[2] )  
{ 
	return floatsqroot(Vec[x1]*Vec[x1] + Vec[y1]*Vec[y1] )
}

stock bool:UTIL_In_FOV(id,target)
{
	if (Find_Angle(id,target,9999.9) > 0.0)
		return true
	
	return false
}
stock Float:Find_Angle(Core,Target,Float:dist)
{
	new Float:vec2LOS[2]
	new Float:flDot	
	new Float:CoreOrigin[3]
	new Float:TargetOrigin[3]
	new Float:CoreAngles[3]
	
	pev(Core,pev_origin,CoreOrigin)
	pev(Target,pev_origin,TargetOrigin)
	
	if (get_distance_f(CoreOrigin,TargetOrigin) > dist)
		return 0.0
	
	pev(Core,pev_angles, CoreAngles)
	
	for ( new i = 0; i < 2; i++ )
		vec2LOS[i] = TargetOrigin[i] - CoreOrigin[i]
	
	new Float:veclength = Vec2DLength(vec2LOS)
	
	//Normalize V2LOS
	if (veclength <= 0.0)
	{
		vec2LOS[x1] = 0.0
		vec2LOS[y1] = 0.0
	}
	else
	{
		new Float:flLen = 1.0 / veclength;
		vec2LOS[x1] = vec2LOS[x1]*flLen
		vec2LOS[y1] = vec2LOS[y1]*flLen
	}
	
	//Do a makevector to make v_forward right
	engfunc(EngFunc_MakeVectors,CoreAngles)
	
	new Float:v_forward[3]
	new Float:v_forward2D[2]
	get_global_vector(GL_v_forward, v_forward)
	
	v_forward2D[x1] = v_forward[x1]
	v_forward2D[y1] = v_forward[y1]
	
	flDot = vec2LOS[x1]*v_forward2D[x1]+vec2LOS[y1]*v_forward2D[y1]
	
	if ( flDot > 0.5 )
	{
		return flDot
	}
	
	return 0.0	
}

Last edited by eNNkds; 12-16-2018 at 12:11. Reason: Forgett to add the include files.
eNNkds is offline
Send a message via Skype™ to eNNkds