Raised This Month: $12 Target: $400
 3% 

Error HAMSANDWICH


Post New Thread Reply   
 
Thread Tools Display Modes
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
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 08-25-2016 , 03:29   Re: Error HAMSANDWICH
Reply With Quote #2

PHP Code:
ExecuteHam(Ham_TakeDamageb0d10.
The error is telling you that it has 5 arguments while it should have 6. Just check that line again and edit it to your needs.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
VINAGHOST
Member
Join Date: Aug 2016
Location: Việt Nam
Old 08-25-2016 , 06:40   Re: Error HAMSANDWICH
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
PHP Code:
ExecuteHam(Ham_TakeDamageb0d10.
The error is telling you that it has 5 arguments while it should have 6. Just check that line again and edit it to your needs.
I did a search on the forum and have found this
PHP Code:
ExecuteHam(Ham_TakeDamagethisidinflictoridattackerFloat:damagedamagebits); 
but what is damagebits ?
VINAGHOST is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 08-25-2016 , 07:33   Re: Error HAMSANDWICH
Reply With Quote #4

Damage bits is type of damage. I don't know how to explain it better.

Look at this
Code:
#define DMG_GENERIC                     0           // Generic damage was done
#define DMG_CRUSH                       (1<<0)      // Crushed by falling or moving object
#define DMG_BULLET                      (1<<1)      // Shot
#define DMG_SLASH                       (1<<2)      // Cut, clawed, stabbed
#define DMG_BURN                        (1<<3)      // Heat burned
#define DMG_FREEZE                      (1<<4)      // Frozen
#define DMG_FALL                        (1<<5)      // Fell too far
#define DMG_BLAST                       (1<<6)      // Explosive blast damage
#define DMG_CLUB                        (1<<7)      // Crowbar, punch, headbutt
#define DMG_SHOCK                       (1<<8)      // Electric shock
#define DMG_SONIC                       (1<<9)      // Sound pulse shockwave
#define DMG_ENERGYBEAM                  (1<<10)     // Laser or other high energy beam
#define DMG_NEVERGIB                    (1<<12)     // With this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB                   (1<<13)     // With this bit OR'd in, any damage type can be made to gib victims upon death.
#define DMG_DROWN                       (1<<14)     // Drowning
#define DMG_PARALYZE                    (1<<15)     // Slows affected creature down
#define DMG_NERVEGAS                    (1<<16)     // Nerve toxins, very bad
#define DMG_POISON                      (1<<17)     // Blood poisioning
#define DMG_RADIATION                   (1<<18)     // Radiation exposure
#define DMG_DROWNRECOVER                (1<<19)     // Drowning recovery
#define DMG_ACID                        (1<<20)     // Toxic chemicals or acid burns
#define DMG_SLOWBURN                    (1<<21)     // In an oven
#define DMG_SLOWFREEZE                  (1<<22)     // In a subzero freezer
#define DMG_MORTAR                      (1<<23)     // Hit by air raid (done to distinguish grenade from mortar)
#define DMG_GRENADE                     (1<<24)     // Counter-Strike only - Hit by HE grenade
#define DMG_TIMEBASED                   (~(0x3fff)) // Mask for time-based damage
So, your line should looks like:
PHP Code:
ExecuteHam(Ham_TakeDamageb0d10.0DMG_GENERIC

Last edited by KiLLeR.; 08-25-2016 at 07:40.
KiLLeR. is offline
VINAGHOST
Member
Join Date: Aug 2016
Location: Việt Nam
Old 08-25-2016 , 09:52   Re: Error HAMSANDWICH
Reply With Quote #5

@KiLLeR. thanks
VINAGHOST is offline
Reply


Thread Tools
Display Modes

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 03:57.


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