Raised This Month: $ Target: $400
 0% 

VIP plugin code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InitiiaL
Member
Join Date: Dec 2009
Old 11-13-2010 , 07:32   VIP plugin code
Reply With Quote #1

Im having an error
Code:
FATAL ERROR (shutting down): MSG_ONE or MSG_ONE_UNRELIABLE with no target entity
Think coz my VIP plugin.

The code i was using is
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define Keysrod (1<<0) | (1<<1) | (1<<9)
#define DAMAGE_RECIEVED

static const COLOR[] = "^x03"
static const CONTACT[] = "bonqelt"

new bool:g_vipmenu
new bool:g_grenades

new mpd
new mkb
new mhb

new AWP_Active
new Menu_Active

new bool:HasC4[33]
new bool:HasFLASHBANG[33]
new bool:HasHEGRENADE[33]
new bool:HasSMOKEGRENADE[33]

new round = 1
new MsgSayText
new maxplayers


#if defined DAMAGE_RECIEVED

#endif

public plugin_init()
{
	register_plugin("VIP", "2.06", "nWk.Lt")
	register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER)

	mpd = register_cvar("amx_vip_mpd", "0")
	mkb = register_cvar("amx_vip_mkb", "450")
	mhb = register_cvar("amx_vip_mhb", "400")

	AWP_Active	= register_cvar("amx_vip_awp_active", "1")
	Menu_Active	= register_cvar("amx_vip_menu_active", "0")


	register_event("DeathMsg", "death_msg", "a")

	register_event("CurWeapon", "Cur_Weapon", "be", "1=1")

	register_logevent("logevent_Round_Start", 2, "1=Round_Start")
	register_menucmd(register_menuid("rod"), Keysrod, "Pressedrod")

	register_clcmd("awp", "HandleCmd")
	register_clcmd("sg550", "HandleCmd")
	register_clcmd("g3sg1", "HandleCmd")

	register_clcmd("say /noriuvip", "ShowMotd")
	register_clcmd("say", "handle_say")

	new mapname[32]
	get_mapname(mapname, 31)

	if (equali(mapname, "cs_", 3) || equali(mapname, "de_", 3) || equali(mapname, "knas_", 3) || equali(mapname, "mini_", 3) || equali(mapname, "surf_", 3))
	{
		g_vipmenu = true
		g_grenades = true
	}

	if (equali(mapname, "35hp_", 3) || equali(mapname, "aim_", 3) || equali(mapname, "awp_", 3))
	{
		g_vipmenu = false
		g_grenades = false
	}

	else if (equali(mapname, "aim_", 3) || equali(mapname, "fy_", 3))
	{
		g_vipmenu = true
		g_grenades = false
	}

	MsgSayText = get_user_msgid("SayText")
	maxplayers = get_maxplayers()


	#if defined DAMAGE_RECIEVED
	#endif
}

public on_damage(id)
{
	new attacker = get_user_attacker(id)

	#if defined DAMAGE_RECIEVED
	if (is_user_connected(id) && is_user_connected(attacker))

	if (get_user_flags(attacker) & ADMIN_LEVEL_H)
	{

	#else
	if (is_user_connected(attacker) && if(get_user_flags(attacker) & ADMIN_LEVEL_H))
	{
	#endif
	}
}

public Damage(id)
{
	new weapon, hitpoint, attacker = get_user_attacker(id, weapon, hitpoint)

	if(attacker <= maxplayers && is_user_alive(attacker) && attacker != id)

	if(get_user_flags(attacker) & ADMIN_LEVEL_H)
	{
		new money = read_data(2) * get_pcvar_num(mpd)

		if (hitpoint == 1)
			money += get_pcvar_num(mhb)

		cs_set_user_money(attacker, cs_get_user_money(attacker) + money)
	}
}

public death_msg()
{
	if (read_data(1) <= maxplayers && read_data(1) && read_data(1) != read_data(2))
		cs_set_user_money(read_data(1), cs_get_user_money(read_data(1)) + get_pcvar_num(mkb) - 300)
}

public logevent_Round_Start()
{
	round++

	new players[32], player, pnum
	get_players(players, pnum, "a")

	for(new i = 0; i < pnum; i++)
	{
		player = players[i]

		if(get_user_flags(player) & ADMIN_LEVEL_H)
		{
			give_item(player, "item_kevlar")
			give_item(player, "item_assaultsuit")

			if (g_grenades)
			{
				give_item(player, "weapon_flashbang")
				give_item(player, "weapon_flashbang")
				give_item(player, "weapon_smokegrenade")
			}

			if(!get_pcvar_num(Menu_Active))
				return PLUGIN_CONTINUE

			if (g_vipmenu)
			{
				if (round > 3)
					Showrod(player)
			}
		}
	}

	return PLUGIN_HANDLED
}

public Showrod(id)
{
	if (g_vipmenu)
	{
		show_menu(id, Keysrod, "rVIP Guns:Rdnwk.lt^n^nr1. wM4A1 & Deagle ^nr2. wAK47 & Deagle ^n^nr0. wExit ^n", -1, "rod")
	}

	return PLUGIN_CONTINUE
}

public Pressedrod(id, key)
{
	switch(key)
	{
		case 0:
		{
			if (user_has_weapon(id, CSW_C4) && get_user_team(id) == 1)
				HasC4[id] = true

			else
				HasC4[id] = false

			if (user_has_weapon(id, CSW_FLASHBANG))
				HasFLASHBANG[id] = true

			else
				HasFLASHBANG[id] = false

			if (user_has_weapon(id, CSW_HEGRENADE))
				HasHEGRENADE[id] = true

			else
				HasHEGRENADE[id] = false

			if (user_has_weapon(id, CSW_SMOKEGRENADE))
				HasSMOKEGRENADE[id] = true

			else
				HasSMOKEGRENADE[id] = false

			strip_user_weapons(id)

			give_item(id, "weapon_m4a1")
			give_item(id, "ammo_556nato")
			give_item(id, "ammo_556nato")
			give_item(id, "ammo_556nato")
			give_item(id, "weapon_deagle")
			give_item(id, "ammo_50ae")
			give_item(id, "ammo_50ae")
			give_item(id, "ammo_50ae")
			give_item(id, "ammo_50ae")
			give_item(id, "ammo_50ae")
			give_item(id, "weapon_knife")

			if (HasC4[id])
			{
				give_item(id, "weapon_c4")
				cs_set_user_plant(id)
			}

			if (HasFLASHBANG[id])
			{
				give_item(id, "weapon_flashbang")
				give_item(id, "weapon_flashbang")
			}

			if (HasHEGRENADE[id])
			{
				give_item(id, "weapon_hegrenade")
			}

			if (HasSMOKEGRENADE[id])
			{
				give_item(id, "weapon_smokegrenade")
			}
		}

		case 1:
		{
			if (user_has_weapon(id, CSW_C4) && get_user_team(id) == 1)
				HasC4[id] = true

			else
				HasC4[id] = false

			if (user_has_weapon(id, CSW_FLASHBANG))
				HasFLASHBANG[id] = true

			else
				HasFLASHBANG[id] = false

			if (user_has_weapon(id, CSW_HEGRENADE))
				HasHEGRENADE[id] = true

			else
				HasHEGRENADE[id] = false

			if (user_has_weapon(id, CSW_SMOKEGRENADE))
				HasSMOKEGRENADE[id] = true

			else
				HasSMOKEGRENADE[id] = false

			strip_user_weapons(id)

			give_item(id, "weapon_ak47")
			give_item(id, "ammo_762nato")
			give_item(id, "ammo_762nato")
			give_item(id, "ammo_762nato")
			give_item(id, "weapon_deagle")
			give_item(id, "ammo_50ae")
			give_item(id, "ammo_50ae")
			give_item(id, "ammo_50ae")
			give_item(id, "ammo_50ae")
			give_item(id, "ammo_50ae")
			give_item(id, "weapon_knife")

			if (HasC4[id])
			{
				give_item(id, "weapon_c4")
				cs_set_user_plant(id)
			}

			if (HasFLASHBANG[id])
			{
				give_item(id, "weapon_flashbang")
				give_item(id, "weapon_flashbang")
			}

			if (HasHEGRENADE[id])
			{
				give_item(id, "weapon_hegrenade")
			}

			if (HasSMOKEGRENADE[id])
			{
				give_item(id, "weapon_smokegrenade")
			}
		}

		case 9:
		{
			
		}
	}

	return PLUGIN_CONTINUE
}

public HandleCmd(id)
{
	if (!get_pcvar_num(AWP_Active))
		return PLUGIN_CONTINUE

	if(get_user_flags(id) & ADMIN_LEVEL_H)
		return PLUGIN_CONTINUE

	client_print(id, print_center, "* Sniperiniai ginklai tik VIP zaidejams *")
	return PLUGIN_HANDLED
}

public Cur_Weapon(id)
{
	if (!get_pcvar_num(AWP_Active))
		return PLUGIN_CONTINUE

	new WeaponID = read_data(2)

	new mapname[32]
	get_mapname(mapname, 31)

	if (equali(mapname, "awp_", 3))
		return PLUGIN_CONTINUE

	else
	{
		if (WeaponID == CSW_AWP || WeaponID == CSW_SG550 || WeaponID == CSW_G3SG1)
		{
			if (!(get_user_flags(id) & ADMIN_LEVEL_H))
			{
				client_print(id, print_center, "* Sniperiniai ginklai tik VIP zaidejams *")
				client_cmd(id, "drop")
			}
		}
	}

	return PLUGIN_HANDLED
}

public ShowMotd(id)
{
	show_motd(id, "vip.txt")
}

public handle_say(id)
{
	new said[192]
	read_args(said, 192)

	if (contain(said, "/vip") != -1)
		set_task(0.1, "print_adminlist", id)

	return PLUGIN_CONTINUE
}

public print_adminlist(user)
{
	new adminnames[33][32]
	new message[256]
	new contactinfo[256], contact[112]
	new id, count, x, len

	for(id = 1; id <= maxplayers; id++)
		if(is_user_connected(id))
			if(get_user_flags(id) & ADMIN_LEVEL_H)
				get_user_name(id, adminnames[count++], 31)

	len = format(message, 255, "%sPrisijunge VIP'ai: ", COLOR)

	if(count > 0)
	{
		for(x = 0; x < count; x++)
		{
			len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count - 1) ? ", " : "")

			if(len > 96)
			{
				print_message(user, message)
				len = format(message, 255, "%s ", COLOR)
			}
		}

		print_message(user, message)
	}

	else
	{
		len += format(message[len], 255-len, "Nera.")
		print_message(user, message)
	}

	get_cvar_string("amx_contactinfo", contact, 63)

	if(contact[0])
	{
		format(contactinfo, 111, "", COLOR, contact)
		print_message(user, contactinfo)
	}
}

public client_authorized(id)
{
	set_task(35.0, "PrintText", id)
}

public PrintText(id)
{
	new message[256]
	format(message, 255, "|nwk.LT| Noredamas pamatyti prisijungusius VIP rasyk /vips")
	print_message(id, message)

	return PLUGIN_CONTINUE
}

print_message(id, msg[])
{
	message_begin(MSG_ONE, MsgSayText, {0,0,0}, id)
	write_byte(id)
	write_string(msg)
	message_end()
}

public client_connect(id)
{
new name[32]
get_user_info(id, "name", name, 31)
if(get_user_flags(id) & ADMIN_LEVEL_H) {
}
}
Now iv deleted some lines i dont need and got this

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define Keysrod (1<<0) | (1<<1) | (1<<9)
#define DAMAGE_RECIEVED

static const COLOR[] = "^x03"

new bool:g_grenades

new mpd
new mkb
new mhb

new AWP_Active

new round = 1
new MsgSayText
new maxplayers


#if defined DAMAGE_RECIEVED

#endif

public plugin_init()
{
	register_plugin("VIP", "2.06", "nWk.Lt")

	mpd = register_cvar("amx_vip_mpd", "0")
	mkb = register_cvar("amx_vip_mkb", "450")
	mhb = register_cvar("amx_vip_mhb", "400")

	AWP_Active	= register_cvar("amx_vip_awp_active", "1")

	register_event("DeathMsg", "death_msg", "a")

	register_event("CurWeapon", "Cur_Weapon", "be", "1=1")

	register_logevent("logevent_Round_Start", 2, "1=Round_Start")
	register_menucmd(register_menuid("rod"), Keysrod, "Pressedrod")

	register_clcmd("awp", "HandleCmd")
	register_clcmd("sg550", "HandleCmd")
	register_clcmd("g3sg1", "HandleCmd")

	register_clcmd("say /noriuvip", "ShowMotd")
	register_clcmd("say", "handle_say")

	new mapname[32]
	get_mapname(mapname, 31)

	if (equali(mapname, "cs_", 3) || equali(mapname, "de_", 3) || equali(mapname, "knas_", 3) || equali(mapname, "mini_", 3) || equali(mapname, "surf_", 3))
	{
		g_grenades = true
	}

	if (equali(mapname, "35hp_", 3) || equali(mapname, "aim_", 3) || equali(mapname, "awp_", 3))
	{
		g_grenades = false
	}

	else if (equali(mapname, "aim_", 3) || equali(mapname, "fy_", 3))
	{
		g_grenades = false
	}

	MsgSayText = get_user_msgid("SayText")
	maxplayers = get_maxplayers()


	#if defined DAMAGE_RECIEVED
	#endif
}

public Damage(id)
{
	new weapon, hitpoint, attacker = get_user_attacker(id, weapon, hitpoint)

	if(attacker <= maxplayers && is_user_alive(attacker) && attacker != id)

	if(get_user_flags(attacker) & ADMIN_LEVEL_H)
	{
		new money = read_data(2) * get_pcvar_num(mpd)

		if (hitpoint == 1)
			money += get_pcvar_num(mhb)

		cs_set_user_money(attacker, cs_get_user_money(attacker) + money)
	}
}

public death_msg()
{
	if (read_data(1) <= maxplayers && read_data(1) && read_data(1) != read_data(2))
		cs_set_user_money(read_data(1), cs_get_user_money(read_data(1)) + get_pcvar_num(mkb) - 300)
}

public logevent_Round_Start()
{
	round++

	new players[32], player, pnum
	get_players(players, pnum, "a")

	for(new i = 0; i < pnum; i++)
	{
		player = players[i]

		if(get_user_flags(player) & ADMIN_LEVEL_H)
		{
			give_item(player, "item_kevlar")
			give_item(player, "item_assaultsuit")

			if (g_grenades)
			{
				give_item(player, "weapon_flashbang")
				give_item(player, "weapon_flashbang")
				give_item(player, "weapon_smokegrenade")
			}

		}
	}

	return PLUGIN_HANDLED
}

public HandleCmd(id)
{
	if (!get_pcvar_num(AWP_Active))
		return PLUGIN_CONTINUE

	if(get_user_flags(id) & ADMIN_LEVEL_H)
		return PLUGIN_CONTINUE

	client_print(id, print_center, "* Sniperiniai ginklai tik VIP zaidejams *")
	return PLUGIN_HANDLED
}

public Cur_Weapon(id)
{
	if (!get_pcvar_num(AWP_Active))
		return PLUGIN_CONTINUE

	new WeaponID = read_data(2)

	new mapname[32]
	get_mapname(mapname, 31)

	if (equali(mapname, "awp_", 3))
		return PLUGIN_CONTINUE

	else
	{
		if (WeaponID == CSW_AWP || WeaponID == CSW_SG550 || WeaponID == CSW_G3SG1)
		{
			if (!(get_user_flags(id) & ADMIN_LEVEL_H))
			{
				client_print(id, print_center, "* Sniperiniai ginklai tik VIP zaidejams *")
				client_cmd(id, "drop")
			}
		}
	}

	return PLUGIN_HANDLED
}

public ShowMotd(id)
{
	show_motd(id, "vip.txt")
}

public handle_say(id)
{
	new said[192]
	read_args(said, 192)

	if (contain(said, "/vip") != -1)
		set_task(0.1, "print_adminlist", id)

	return PLUGIN_CONTINUE
}

public print_adminlist(user)
{
	new adminnames[33][32]
	new message[256]
	new id, count, x, len

	for(id = 1; id <= maxplayers; id++)
		if(is_user_connected(id))
			if(get_user_flags(id) & ADMIN_LEVEL_H)
				get_user_name(id, adminnames[count++], 31)

	len = format(message, 255, "%sPrisijunge VIP'ai: ", COLOR)

	if(count > 0)
	{
		for(x = 0; x < count; x++)
		{
			len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count - 1) ? ", " : "")

			if(len > 96)
			{
				print_message(user, message)
				len = format(message, 255, "%s ", COLOR)
			}
		}

		print_message(user, message)
	}

	else
	{
		len += format(message[len], 255-len, "Nera.")
		print_message(user, message)
	}
}

print_message(id, msg[])
{
	message_begin(MSG_ONE, MsgSayText, {0,0,0}, id)
	write_byte(id)
	write_string(msg)
	message_end()
}

public client_connect(id)
{
new name[32]
get_user_info(id, "name", name, 31)
if(get_user_flags(id) & ADMIN_LEVEL_H) {
set_hudmessage(200, 0, 0, 0.05, 0.65, 2, 0.02, 30.0, 0.03, 0.3, 5)
show_hudmessage(0, "Specialus VIP %s prisijunge!",name)
}
}

Can some1 check the current code and tell me is everything alright or not? Maby there's some more not nessesery lines? & is it possible that ill be still having an error called
Code:
FATAL ERROR (shutting down): MSG_ONE or MSG_ONE_UNRELIABLE with no target entity
InitiiaL is offline
Altecaho
Senior Member
Join Date: Oct 2010
Old 11-13-2010 , 11:31   Re: VIP plugin code
Reply With Quote #2

It looks like edited VIP by Dunno
Altecaho is offline
InitiiaL
Member
Join Date: Dec 2009
Old 11-13-2010 , 12:00   Re: VIP plugin code
Reply With Quote #3

Quote:
Originally Posted by Altecaho View Post
It looks like edited VIP by Dunno
It is..
InitiiaL 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 09:54.


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