Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2208 209 210338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Jermuk
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Homer hat geschrieben
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 hat geschrieben
3


1
2
3
4
5
6
--WRONG--
a = {x=3}
function a.lol()
	print(self.x)
end
a.lol()
Output hat geschrieben
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 hat geschrieben
99

alt Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Zitieren
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

alt Who can help me with this

Soja1997
User Off Offline

Zitieren
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 ;/

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
Intrusion hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
Soja1997 hat geschrieben
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.
Mehr >

alt Re: Lua Scripts/Questions/Help

Refresh
User Off Offline

Zitieren
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?

alt Re: Lua Scripts/Questions/Help

Refresh
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

DrPyromatic
User Off Offline

Zitieren
Levic hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Zitieren
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
1× editiert, zuletzt 17.06.10 19:42:49

alt Re: Lua Scripts/Questions/Help

Dragon fang
User Off Offline

Zitieren
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.
Zum Anfang Vorherige 1 2208 209 210338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht