English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 307 308 309 ... 338 339 Next To the start
13.11.10 10:28:23 pm
Up
CmDark
User
Offline Off
Arcas has written:
Code:
1
2
3
4
5
addhook ("spawn","meleespawn")
     if (player(id,"exists")) then
          >return "x"
     end
end

and
Code:
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

Code:
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
IMG:http://i54.tinypic.com/auk478.png
13.11.10 10:43:46 pm
Up
Loooser
User
Offline Off
guys how to return the moving on tiles
i tried:
Code:
1
2
3
4
addhook("movetile","movetile")
function movetile(id,x,y)
return 1
end

there must be something wrong with the return
IMG:http://i45.tinypic.com/saus1e.jpg
13.11.10 10:50:32 pm
Up
Banaan
User
Offline Off
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 has written:
Code:
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)
13.11.10 10:51:09 pm
Up
CmDark
User
Offline Off
@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?
IMG:http://i54.tinypic.com/auk478.png
13.11.10 11:06:57 pm
Up
RAVENOUS
BANNED
Offline Off
btw. tiles: How to check if the current player is on tile 32 e.g.?
"A work of art is the unique result of a unique temperament." - Oscar Wilde
14.11.10 02:38:54 am
Up
Chex
User
Offline Off
Thanks dude. Many cookies to you.
Skipper has written:
btw. tiles: How to check if the current player is on tile 32 e.g.?

Code:
1
2
if player(id,"tilex")==32--or
if player(id,"tiley")==32

All the player values you can get are in info.txt.
Who needs a sig?
14.11.10 11:40:04 am
Up
Glix
User
Offline Off
Code:
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
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
14.11.10 02:29:10 pm
Up
AbAeterno
User
Offline Off
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
14.11.10 03:03:49 pm
Up
Rainoth
Moderator
Offline Off
Just make setting
mp_damagefactor 0

and players wont be able to harm other
14.11.10 03:54:02 pm
Up
RAVENOUS
BANNED
Offline Off
Arcas has written:
Thanks dude. Many cookies to you.
Skipper has written:
btw. tiles: How to check if the current player is on tile 32 e.g.?

Code:
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:
Code:
1
2
3
4
addhook("hit","hitrofl")
function hitrofl()
     return 1
end

That should work with players only then.
"A work of art is the unique result of a unique temperament." - Oscar Wilde
14.11.10 04:23:19 pm
Up
Vectarrio
User
Offline Off
Skipper has written:
@PunishedNoob:
Code:
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)
14.11.10 05:17:49 pm
Up
Kurumi
User
Offline Off
HaRe has written:
kato999 has written:
kato999 has written:
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
Uhm... Hello
14.11.10 05:40:58 pm
Up
maPmaKer
User
Offline Off
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.
14.11.10 05:49:22 pm
Up
Rainoth
Moderator
Offline Off
Send your wall go lua (no clip) and i will see what i can do

     Batlaizys
     IMG:http://www.planetsmilies.com/avatars/simpsons/simpsons0002.gif
14.11.10 07:07:41 pm
Up
maPmaKer
User
Offline Off
nvm I found something better Ty anyway
14.11.10 07:51:04 pm
Up
Dictatus Papae
User
Offline Off
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 )
14.11.10 07:54:00 pm
Up
Todesengel
User
Offline Off
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
Code:
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.

Code:
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
Code:
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?...
Aus technischen Gründen steht die Signatur auf der Rückseite dieses Beitrags.
14.11.10 09:17:09 pm
Up
archmage
User
Offline Off
@terminator
Code:
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
We must secure the existence of our people and a future for white children. 14/88
15.11.10 04:11:16 am
Up
Chex
User
Offline Off
Skipper has written:
Arcas has written:
Thanks dude. Many cookies to you.
Skipper has written:
btw. tiles: How to check if the current player is on tile 32 e.g.?

Code:
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.

Code:
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.
Who needs a sig?
15.11.10 09:24:10 am
Up
maPmaKer
User
Offline Off
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
To the start Previous 1 2 ... 307 308 309 ... 338 339 Next To the start