Raised This Month: $ Target: $400
 0% 

My plugin have error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cu1uTz123
Junior Member
Join Date: Mar 2013
Old 12-21-2015 , 07:20   My plugin have error
Reply With Quote #1

L 12/21/2015 - 14:19:46: [AMXX] Displaying debug trace (plugin "shop.amxx")
L 12/21/2015 - 14:19:46: [AMXX] Run time error 4: index out of bounds
L 12/21/2015 - 14:19:46: [AMXX] [0] shop.sma::forward_traceline (line 185)

Code:
#include < amxmodx >
#include <   fun   >
#include < cstrike >
#include < engine  >
#include <colorchat>

#include <  fakemeta   >
#include < hamsandwich >


#define PLUGIN "CSDM Shop"
#define VERSION "1.0"
#define AUTHOR "tre3fla"

new g_HasRecoil[ 33 ]

new szTero[ 3 ] = { 
	255,
	0,
	0
}

new szCT[ 3 ] = {
	0,
	0,
	255
}

public plugin_init( ) {
	register_plugin( PLUGIN, VERSION, AUTHOR )
	
	register_clcmd( "say /shop", "OpenShop" )
	
	register_forward( FM_TraceLine, "forward_traceline", 1 )
	RegisterHam( Ham_Spawn, "player", "fwdPlayerSpawn", 1 )
}

public client_connect( id ) {
	if( task_exists( id ) ) {
		remove_task( id ) 
	}
}

public OpenShop( id ) {
	if( !is_user_alive( id ) ) {
		return PLUGIN_HANDLED
	}
	new szShopMenu = menu_create( "CSDM Shop", "shop_handler" )
	
	menu_additem( szShopMenu, "50 HP\r (4000$)", "", 0 ) 
	menu_additem( szShopMenu, "50 Armor\r (4000$)", "", 0 )
	menu_additem( szShopMenu, "No Recoil\r (12000$)", "", 0 )
	menu_additem( szShopMenu, "Invisibility\r (16000$)", "", 0 )
	menu_additem( szShopMenu, "GodMode\y [40 sec]\r (14000$)", "", 0 )
	menu_additem( szShopMenu, "Chameleon\r (10000$)", "", 0 )
	
	menu_setprop( szShopMenu, MPROP_EXIT, MEXIT_ALL )
	menu_display( id, szShopMenu, 0 )
	
	return PLUGIN_CONTINUE
}

public shop_handler( id, szShopMenu, item ) {
	if( item == MENU_EXIT ) {
		menu_destroy( szShopMenu )
		return PLUGIN_HANDLED
	}
	
	new szMoney = cs_get_user_money( id )
	
	switch( item ) {
		case 0 : {
			if( szMoney >= 4000 ) {
				set_user_health( id, get_user_health( id ) + 50 )
				cs_set_user_money( id, szMoney - 4000 )
				
				ColorChat( id, GREEN, "[Shop]^x01 Ai cumparat^x03 +50 Health" )
			}
			else {
				ColorChat( id, GREEN, "[Shop]^x01 Nu ai suficienti bani pentru a cumpara acest item" )
				return PLUGIN_HANDLED
			}	
		}
		
		case 1 : {
			if( szMoney >= 4000 ) {
				cs_set_user_armor( id, get_user_armor( id ) + 50, CS_ARMOR_VESTHELM )
				cs_set_user_money( id, szMoney - 4000 )
				
				ColorChat( id, GREEN, "[Shop]^x01 Ai cumparat^x03 +50 Armor" )
			}
			else {
				ColorChat( id, GREEN, "[Shop]^x01 Nu ai suficienti bani pentru a cumpara acest item" )
				return PLUGIN_HANDLED
			}	
		}
		
		case 2 : {
			if( szMoney >= 12000 ) {
				g_HasRecoil[ id ] = true
				cs_set_user_money( id, szMoney - 12000 )
				
				ColorChat( id, GREEN, "[Shop]^x01 Ai cumparat^x03 No Recoil" )
			}
			else {
				ColorChat( id, GREEN, "[Shop]^x01 Nu ai suficienti bani pentru a cumpara acest item" )
				return PLUGIN_HANDLED
			}	
		}
		
		case 3 : {
			
			if( szMoney >= 16000 ) {
				set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 40 )
				cs_set_user_money( id, szMoney - 16000 )
				
				ColorChat( id, GREEN, "[Shop]^x01 Ai cumparat^x03 Invizibilitate" )
			}
			else {
				ColorChat( id, GREEN, "[Shop]^x01 Nu ai suficienti bani pentru a cumpara acest item" )
				return PLUGIN_HANDLED
			}
		}
		
		case 4 : {
			if( szMoney >= 14000 ) {
				set_user_godmode( id, 1 )
				cs_set_user_money( id, szMoney - 14000 )
				
				switch( cs_get_user_team( id ) ) {
					case CS_TEAM_T : {
						set_user_rendering( id, kRenderFxGlowShell, szTero[ 0 ], szTero[ 1 ], szTero[ 2 ], kRenderNormal, 25 )
					}
					
					case CS_TEAM_CT : {
						set_user_rendering( id, kRenderFxGlowShell, szCT[ 0 ], szCT[ 1 ], szCT[ 2 ], kRenderNormal, 25 )
					}
				}
				
				set_task( 40.0, "RemoveGod", id )
				
				ColorChat( id, GREEN, "[Shop]^x01 Ai cumparat^x03 GodMode^x01 timp de^x04 40 secunde" )
			}
			else {
				ColorChat( id, GREEN, "[Shop]^x01 Nu ai suficienti bani pentru a cumpara acest item" )
				return PLUGIN_HANDLED
			}
		}
		
		case 5 : {
			if( szMoney >= 10000 ) {
				switch( cs_get_user_team( id ) ) {
					case CS_TEAM_CT : {
						cs_set_user_model( id, "arctic" )
					}
					
					case CS_TEAM_T : {
						cs_set_user_model( id, "sas" )
					}
				}
				
				cs_set_user_money( id, szMoney - 10000 )
				
				ColorChat( id, GREEN, "[Shop]^x01 Ai cumparat^x03 Chameleon" )
			}
			else {
				ColorChat( id, GREEN, "[Shop]^x01 Nu ai suficienti bani pentru a cumpara acest item" )
				return PLUGIN_HANDLED
			}
		}
	}
	
	return PLUGIN_HANDLED
}

// No Recoil by knekter

public client_PreThink( id ) {
	if( get_user_button( id ) & IN_ATTACK && g_HasRecoil[ id ] ) {
		entity_set_vector( id, EV_VEC_punchangle, Float:{ 0.0, 0.0, 0.0 } )
	}
}

public forward_traceline( Float:v1[ 3 ], Float:v2[ 3 ], noMonsters, id ) {
	if( !g_HasRecoil[ id ] || !is_user_connected( id ) || !is_user_alive( id ) ) {
		return FMRES_IGNORED
	}

	new hit[ 3 ], Float:fHit[ 3 ]
	get_user_origin( id, hit, 4 )
	IVecFVec( hit, fHit)

	set_tr( TR_vecEndPos, fHit )

	return FMRES_IGNORED
}

public fwdPlayerSpawn( id ) {
	if( is_user_alive( id ) ) {
		cs_reset_user_model( id )
		set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0 )
		set_user_godmode( id, 0 )
		
		if( task_exists( id ) ) {
			remove_task( id )
		}
	}
}

public RemoveGod( id ) {
	if( is_user_alive( id ) ) {
		set_user_godmode( id, 0 )
		
		ColorChat( id, GREEN, "[Shop]^x01 Numai ai godmode!" )
	}
}
Cu1uTz123 is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-21-2015 , 12:46   Re: My plugin have error
Reply With Quote #2

Please, attach the file. See also:
  1. Scripting Help (Suggested) Posting Guidelines
  2. +++ Read before posting [UPDATED 6/4/13] +++

They are stickies at this sub-forum and explain this section.

Last edited by addons_zz; 12-21-2015 at 12:50.
addons_zz is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode