Forum

> > CS2D > Scripts > image() function #2 and #3 special param
Forums overviewCS2D overview Scripts overviewLog in to reply

English image() function #2 and #3 special param

21 replies
Page
To the start Previous 1 2 Next To the start

old image() function #2 and #3 special param

Yazir
User Off Offline

Quote
Hello again! I have got a problem with the special meaning of x/y when drawing at player:
1
image("gfx\movecs2d\customweps\g36c.PNG<m>",x>0,y<=0,id+200)
Error:
Quote
LUA ERROR: sys/lua/movecs2d/customweps.lua:14: attempt to compare number with nil


Maybe i am using those special params wrong?

old Re: image() function #2 and #3 special param

Joni And Friends
User Off Offline

Quote
You are wrong with x>0 and y<=0, x>0 its mean the position x more than 0(1,2,3,4....,n) and y<=0 is mean the position y is 0 or under 0
1
image("gfx\movecs2d\customweps\g36c.PNG",1,0,id+200) -- x = 1 and y = 0

old Re: image() function #2 and #3 special param

Yazir
User Off Offline

Quote
Oh, i get it now! Thanks .
I have another problem, i return 1 in hit hook and that doesn't block the damage given.
1
2
3
4
5
function wepcheck(id,src,wpn,dmg,apdmg,rawdmg)
	if curwep == 1 then
		return 1
	end
end

old Re: image() function #2 and #3 special param

Mora
User Off Offline

Quote
Idk, i writte so fast:
1
2
3
4
5
6
7
8
9
10
weaps = {1}

(your hook blablabab)
function wepcheck(id,source,weapon,dmg)
	for _, weapid in ipairs(weaps) do
		if player(source,"weapon")==weaps then
return 1
		end
	end
end

if all is works you can just add your weapons into table, just use other ids of weapos:
1
weaps = {1,2,3,25,1321312}

old Re: image() function #2 and #3 special param

Yazir
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
function wepcheck(id,src,wpn,dmg,apdmg,rawdmg)
	if src >=1 and src <= 32 then
		if curwep == 1 then
			local damg = 0 --(rawdmg + 100)
			parse("sethealth "..id.." "..player(id,"health") + damg)
			print("::Zadano "..tostring(damg).." obrazen graczowi o id "..tostring(id).." od gracza o id "..tostring(src).."::")
		return 1
		end
	end
end

Prints the message in the console, no errors, players still deal dmg to each other.

curwep is another variable and it's value is 1.

old Re: image() function #2 and #3 special param

Rainoth
Moderator Off Offline

Quote
I don't get what you're trying to make. If it's the case that you want USP not to deal damage then.

1
2
3
4
5
6
addhook("hit","_h")
function _h(id,s,w,h,a,r)
	if w == 1 then
		return 1
	end
end

If you want it to still hit but heal for same amount, instead of return 1 use
1
parse("sethealth "..id.." "..player(id,"health")+h)

old Re: image() function #2 and #3 special param

Joni And Friends
User Off Offline

Quote
Try with this code
1
2
3
4
5
6
7
8
function wepcheck(id,src,wpn,dmg,apdmg,rawdmg)
     if src>0 and id>0 then
          if wpn == 1 then
          --- other code here
          return 1
          end
     end
end

old Re: image() function #2 and #3 special param

Yazir
User Off Offline

Quote
It seems like it's broken or something. I used the
1
2
3
4
5
6
7
8
function wepcheck(id,src,wpn,dmg,apdmg,rawdmg)
     if src>0 and id>0 then
          if wpn == 1 then
          --- other code here
          return 1
          end
     end
end
And it doesn't work. I can still kill people with ups, like the return doesn't do anyting.

Also, the
1
parse("sethealth "..id.." "..player(id,"health")+h)
Doesn't work. It only deals damage if it's "- h" but doesn't heal while "+ h" (yeah wtf).
edited 1×, last 07.02.15 03:25:52 pm

old Re: image() function #2 and #3 special param

Yazir
User Off Offline

Quote
Hell, even the function without ifs doesn't work

1
2
3
4
5
6
function wepcheck(id,src,wpn,dmg,apdmg,rawdmg)
	--local damg = dmg
	--parse("sethealth "..id.." "..player(id,"health") + damg)
	print("::Zadano "..tostring(dmg).." obrazen graczowi o id "..tostring(id).." od gracza o id "..tostring(src).."::")
	return 1
end

old Re: image() function #2 and #3 special param

Mora
User Off Offline

Quote
You don't understand bcs you don't want to.
Read up my post and don't again say shit.
You don't even know what you want exactly!
What is that other functions?
@user Rainoth: ,@user Joni And Friends: did all that you needed.
Haven't you using multi hooks? Maybe you use other scripts that conflict with yours? If you using other safezone scripts it may also conflict!
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview