Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2208 209 210338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Jermuk
User Off Offline

Quote
Hello all,

I have a supid problem. My script works with "New game" fine, but when I try it on a dedicated server it fails. First I thought that it is a script problem but then i tried this:
1
2
3
4
5
6
7
addhook ("usebutton", "onusebutton")
function onusebutton(id,x,y)
	msg("ICH MAG DONER");
	.
	.
	.
end

With dedicated it don't display "Ich mag Doner", wich means, that the server don't call the "usebutton" hook. When I start a game with 'New game' it works fine, but just when I press a button. When other press a button, it don't work. Anyone else with the same problem and know the solution?

Thank you!

Jermuk aka Dönarmaster

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Homer has written
Alright, I've seen a lot of scripts with colons in their functions, is that just a way of naming it, or does it have some meaning to it?


Use it like this:
1
2
3
4
5
a = {x = 3}
function a:lol()
	print(self.x)
end
a:lol()
Output has written
3


1
2
3
4
5
6
--WRONG--
a = {x=3}
function a.lol()
	print(self.x)
end
a.lol()
Output has written
attempt to index global 'self'


This also works for metatables, so you don't have to copy your function more than once for different objects.
1
2
3
4
5
6
7
8
9
mt = {}
mt.__index = mt

function mt:lol()
	print(self.x)
end

a = setmetatable({x=99},mt)
a:lol()
Output has written
99

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Thanks Flacko, I'm still iffy on some stuff but I suppose that just takes practice. Also, could someone supply me with a link to a tutorial on metatable usage, and yes I do know that there have been links previously given on this, but I've been searching for a while and haven't come across one. Thanks

old Who can help me with this

Soja1997
User Off Offline

Quote
function InArea(XY,X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7)
return( XY.X > X1 and XY.X < X2 and XY.Y > Y1 and XY.Y < Y2 > X3 and XY.X < X4 and XY.Y > Y3 and XY.Y < Y4 > X5 and XY.X < X6 and XY.Y > Y5 and XY.Y < Y6 )
end
Here is error ;/

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
Intrusion has written
Its possible for make image in lua for only player, who trigged it can see it?


The one way is only mode 2 for hud image.

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
Soja1997 has written
function InArea(XY,X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7)
return( XY.X > X1 and XY.X < X2 and XY.Y > Y1 and XY.Y < Y2 > X3 and XY.X < X4 and XY.Y > Y3 and XY.Y < Y4 > X5 and XY.X < X6 and XY.Y > Y5 and XY.Y < Y6 )
end
Here is error ;/


Why do you need so many X,Y?
What a hell you're planing to do with this football function?

...and you did syntax mistake.
More >

old Re: Lua Scripts/Questions/Help

Refresh
User Off Offline

Quote
Hi guys I have a Tibia server and I know the bug if you buy a leather helmet for 100 money, and you sell it, you get 300 money. How can I fix it?

old Re: Lua Scripts/Questions/Help

Refresh
User Off Offline

Quote
Okay. I saw an other thing on servers with the rpg_mapb4.5 map. They have a modded script with new items, monsters etc. Where can I download that? thx

old Re: Lua Scripts/Questions/Help

DrPyromatic
User Off Offline

Quote
Levic has written
Okay. I saw an other thing on servers with the rpg_mapb4.5 map. They have a modded script with new items, monsters etc. Where can I download that? thx

You cant actually, but you can may ask the hoster from the servers if they send you the changed lua files.

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
I must have script
if USGN 16001 says
CTKarny LoadBall Pos X,Y
TTKarny LoadBall Pos X,Y
and Fuction
Overclock ball Right 45o On button p
Overclock ball Left 45o On button l
edited 1×, last 17.06.10 07:42:49 pm

old Re: Lua Scripts/Questions/Help

Dragon fang
User Off Offline

Quote
I am making a TF2 lua, I finished most of it.
But I can't make the medic's laser heal I tried to write a script:

addhook("hit","laser_heal")
function laser_heal(id,source,weapon,hpdmg,apdmg)
if(weapon == 45) then
parse ("sethealth "..id.." "..player(id,"health")+30)
end

It dosen't work, Can someone point the error for me?

And is it possible for no knife? I wanted the spy only having a knife since I made the secondary hit instant kill.
To the start Previous 1 2208 209 210338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview