View Single Post
Author Message
VINAGHOST
Member
Join Date: Aug 2016
Location: Việt Nam
Old 08-25-2016 , 01:14   Error HAMSANDWICH
Reply With Quote #1

I come from Viet Nam so I sorry for bad English.
I want to do 2 sets of armor. 1 can counter the damage and 2 is to take away enemy's blood when he touched the player.
but I get an error while the enemy touch player

Code:
L 08/24/2016 - 19:04:21: [HAMSANDWICH] Bad arg count.  Expected 6, got 5.
L 08/24/2016 - 19:04:21: [AMXX] Displaying debug trace (plugin "ghostitem.amxx", version "1.0")
L 08/24/2016 - 19:04:21: [AMXX] Run time error 10: native error (native "ExecuteHam")
L 08/24/2016 - 19:04:21: [AMXX]    [0] ghostitem.sma::vg_touch (line 103)
and when players buy the second, it has no effect.

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>
#include <fun>

#include <ghostmode>
#include <ghostpoint>
#include <ghostshop>

#define PLUGIN "GHOST SHOP: ITEM"
#define VERSION "1.0"
#define AUTHOR "VINAGHOST"

new item1, item2
new bool:item1c[33], bool:item2c[33]

new const name1[] = "GIAP GAI" // first armor
const cost1 = 1000
const team1 = 2 //2 = CT

new const name2[] = "GIAP PHAN DMG" // the second armor
const cost2 = 1000
const team2 = 2 //2 = CT

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_touch("player","player","vg_touch")
	
	RegisterHam(Ham_TakeDamage, "player", "vg_attack")
	

	item1 = register_item(name1, cost1, team1)
	item2 = register_item(name2, cost2, team2)
}
public vg_bought(id, itemid)
{
	if(itemid == item1)
	{
		item1c[id] = true
	}
	else if(itemid == item2)
	{
		item2c[id] = true
	}
}
public vg_attack(victim, inflictor, attacker, Float:damage)
{
	if(item2c[victim])
	{
		if(victim != attacker && is_user_alive(attacker))
		{
			if(vg_is_ghost(attacker) )
			{
				if ( damage > 50)
				{
					static Float:hp, Float:ehp
					ehp = damage/4
					hp = get_user_health(attacker) - ehp
					if( hp <= 0)
						vg_set_gp(victim, vg_get_gp(victim) + 3)
					ExecuteHamB(Ham_TakeDamage, attacker, 0, victim, ehp)
				}
			}
		}
	}
}	
				
				
public vg_touch(d, b)
{
	if (!is_valid_player ( b ))
		return PLUGIN_CONTINUE
	if (!vg_is_hunter( d ) )
		return PLUGIN_CONTINUE
		
	if(item1c[d])
	{
		static Float:hp
		hp = get_user_health(b) - 10.0
		if( hp <= 0)
			vg_set_gp(d, vg_get_gp(d) + 3)
			
		ExecuteHam(Ham_TakeDamage, b, 0, d, 10.0)
	}
	
	return PLUGIN_HANDLED
}

public is_valid_player(id)
{
	if(is_valid_ent(id))
	{
		new szClassname[32]
		entity_get_string(id,EV_SZ_classname,szClassname,31)
		return (equali(szClassname,"player"))
	}
	return 0
}
Can anyone help ?

Last edited by VINAGHOST; 08-25-2016 at 01:15.
VINAGHOST is offline