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 2307 308 309338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
Arcas hat geschrieben
1
2
3
4
5
addhook ("spawn","meleespawn")
	if (player(id,"exists")) then
		>return "x"
	end
end
and
1
2
3
4
5
6
addhook("say","portalequip")
	if (txt=="!portal") then
		parse ("equip ("id","88"))
		end
	end
end
And can you explain what you did? PLease?
If so, cookie for you.


First, you didn't add the function in those
and the return value
you didn't place it correctly.
It should be "return "x""
not ">return "x""
You need to change the x to the item you want them to spawn with.

the second one, you added an extra end without the function also. And the "parsing" is incorrect

1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("spawn","meleespawn")
function meleespawn(id)
	if player(id,"exists") then
		return "x"
	end
end


addhook("say","portalequip")
function portalequip(id,txt)
	if txt=="!portal" then
		parse("equip "..id.." 88")
	end
end

alt Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Zitieren
guys how to return the moving on tiles
i tried:
1
2
3
4
addhook("movetile","movetile")
function movetile(id,x,y)
return 1
end
there must be something wrong with the return

alt Re: Lua Scripts/Questions/Help

Banaan
User Off Offline

Zitieren
read the info.txt

There is no return possibility on the movetile hook. If you want to prevent people from moving, put walls around them, set a really low speedmod or use the setpos command.

info.txt hat geschrieben
1
2
3
4
movetile(id,x,y)					on moving on a different tile
-id: id of player who reached a new tile
-x: new tile x position (tiles)
-y: new tile y position (tiles)

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
@Loooser
There is no "return" for movetile
basically
if you add something for the function to do
It will ONLY happen when someone is moving.
So you wouldn't really need a return right?

alt Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Zitieren
Thanks dude. Many cookies to you.
Skipper hat geschrieben
btw. tiles: How to check if the current player is on tile 32 e.g.?

1
2
if player(id,"tilex")==32--or
if player(id,"tiley")==32
All the player values you can get are in info.txt.

alt Re: Lua Scripts/Questions/Help

Glix
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
addhook("say","tele")
function tele(id,txt)
if txt == "!menu" then
menu(id,"Special Menu,Vip,Vodka")
return 1
end
if string.sub(txt,1,10) == "6sg3losa" then
local bt = string.sub(txt,12)
msg("©000255000"..player(id,"name").."(V.I.P): "..bt.."@C")
return 1
end
end
addhook("menu","menu")
function menu(id,t,b)
if t=="Special Menu" then
if b==1 then
parse("sv_msg2 "..id.." You are now on Vip Room")
parse("setpos "..id.." 2694 2118")
parse("equip "..id.." 88")
parse("equip "..id.." 6")
parse("equip "..id.." 45")
parse("speedmod "..id.." 50")
parse("setmaxhealth "..id.." 150")
elseif b==2 then
parse("sv_msg2 "..id.." You have drinked Vodka")
parse("shake "..id.." 1000")
parse("sethealth "..id.." 80")
elseif b==3 then
msg2(id,"Pls say 6sglosa and then your txt.@C")
end
end
end

help me please please please please

alt Re: Lua Scripts/Questions/Help

AbAeterno
User Off Offline

Zitieren
I have another question about lua(sorry, i don't know lua so much)

How do I make a NPC damage the players but players don't damage other players?

I mean, how do i make NPCs damage players, but players don't damage other players.

And sorry, my english sucks

alt @PunishedNoob

Rainoth
Moderator Off Offline

Zitieren
Just make setting
mp_damagefactor 0

and players wont be able to harm other

alt Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Zitieren
Arcas hat geschrieben
Thanks dude. Many cookies to you.
Skipper hat geschrieben
btw. tiles: How to check if the current player is on tile 32 e.g.?

1
2
if player(id,"tilex")==32--or
if player(id,"tiley")==32
All the player values you can get are in info.txt.


I mean the tile on given on the tileset.


@PunishedNoob:
1
2
3
4
addhook("hit","hitrofl")
function hitrofl()
	return 1
end
That should work with players only then.

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
Skipper hat geschrieben
@PunishedNoob:
1
2
3
4
addhook("hit","hitrofl")
function hitrofl()
	return 1
end
That should work with players only then.

Then zombies won't hurt you.
You must check if it is player.vs.player (source>0, id>0)

alt Re: Lua Scripts/Questions/Help

Kurumi
User Off Offline

Zitieren
HaRe hat geschrieben
kato999 hat geschrieben
kato999 hat geschrieben
can anyone tell me how to make player skin to other file (ex Original is players/ct1.bmp how to change it to example gfx/hitman.bmp not editing the original)
answer it plz


not possible, you can only cover teh orginal with lua but it will look crazy

image("gfx/player/hitman.bmp",1,1,200+id)

200+id = on player id

1 = Make it move in the player's rot otherwise 0

gfx/player...... = ur path(image path)


doesnt work i dont know what to do whith that id help plz

alt Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Zitieren
Can anybody help me please? I want a lua with a admin table and only the admins' US.de IDs , by pressing F3, are able to use no-clip mod. Please help.

alt @maPmaKer

Rainoth
Moderator Off Offline

Zitieren
Send your wall go lua (no clip) and i will see what i can do

     Batlaizys
     IMG:https://www.planetsmilies.com/avatars/simpsons/simpsons0002.gif

alt Re: Lua Scripts/Questions/Help

Dictatus Papae
User Off Offline

Zitieren
How can I change the name of a button, for e.g., with a variable? Like this: if variable = 0 then the button's name is "off" , if variable = 1, button : "on". Just like in the superhero script (couldn't examine it, Blazzinxx's scripts are just too complicated )

alt Re: Lua Scripts/Questions/Help

Todesengel
User Off Offline

Zitieren
I need help.
My problem is, i save values in a extern file.
They are true-false(0/1)-values.
They got every a new line.

Lets look at line 132-138
1
2
3
4
5
6
7
file = assert(io.open("sys/lua/playerdata/"..usgn..".txt","a")) 
temp2 = file:write(wall[id].."\n")  
file:close() 

file3 = assert(io.open("sys/lua/save/house.txt","w")) 
file3:write(wall[id].."\n")  
file3:close()

I save in a private savefile and in a public file.. the publicfile must be load at roundstart.

but... i has tested and tried, and it doesnt work

Lets see my bad try.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
boden1=0
wand1=0

function auslesen()
    file = assert(io.open("sys/lua/save/house.txt","r"))
        if file~=nil then
            local i=0
            for line in file:lines() do
                i=i+1
                if i==1 then
                    local a=line
                elseif i==2 then
                    local b=line
                end
            end 
            if (a==1) then
                parse('trigger Boden1')
                boden1=1
            end
            if (b==1) then
                parse('trigger Wand1')
                wand1=1
        else
            file = assert(io.open("sys/lua/save/house.txt","w"))
            file:write(boden1.."\n"..wand1)
            file:close()
        end
    end
end

function speichern()
    file = assert(io.open("sys/lua/save/house.txt","w"))
    file:write(boden1.."\n"..wand1)
    file:close()
end


addhook("startround","check")
function check()
    auslesen()
end

The public file is sys/lua/save/house.txt

Found this.
I filled it out with prints. it print every round
1
2
3
4
5
6
7
else
            file = assert(io.open("sys/lua/save/house.txt","w"))
            file:write(boden1.."\n"..wand1)
            file:close()
        end
    end
end

@#*/&$ BB-Codes. Its untabbing the script (tabulator).

So.. anyone can help me?...

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Zitieren
@terminator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("second", "sec");
addhook("menu", "menu_");
on = 1;
t = {[0]="off","on"};

function sec()
	menu(0,"Test menu,"..t[on%2]);
end

function menu_(id,title,button)
	if ( title == "Test menu" and button == 1 ) then
		on = on + 1
	end
end

alt Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Zitieren
Skipper hat geschrieben
Arcas hat geschrieben
Thanks dude. Many cookies to you.
Skipper hat geschrieben
btw. tiles: How to check if the current player is on tile 32 e.g.?

1
2
if player(id,"tilex")==32--or
if player(id,"tiley")==32
All the player values you can get are in info.txt.


I mean the tile on given on the tileset.

1
2
3
4
addhook("ms100","checktile")
function checktile
print (tile(x,y,"frame"))
end
Hope I did it right.
You probably want to have it be on a saycommand.
I presume you know the basics, unlike me.

alt Wall Pass Through

maPmaKer
User Off Offline

Zitieren
Can anybody help me please? I need a wall-pass-through lua with and admin table and if admin is connecting he will be able to pass through walls but only him not anybody else.

Can anybody help me please?

Thanks!
maPmaKer
Zum Anfang Vorherige 1 2307 308 309338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht