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 2241 242 243338 339 Next To the start

old Re: Lua Scripts/Questions/Help

kalis
User Off Offline

Quote
help me fix script
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
42
43
44
45
46
function totable(t,match)
        local cmd = {}
        if not match then match = "[^%s]+" end
        for word in string.gmatch(t, match) do
                table.insert(cmd, word)
        end
        return cmd
end


addhook("join","load")
function load(id)
usgn = player(id,"usgn")
if (usgn > 0) then
 local usgn = player(id, "usgn")
files = io.open('sys/lua/saves/'..player(id,"usgn")..'.txt','r')
if(files~=nil) then
msg2(id,'©000255000Your save file found!@C')
msg2(id,'©160160255Your U.S.G.N ID: '..player(id,"usgn")..'@C')
for line in io.lines('sys/lua/saves/'..player(id,"usgn")..'.txt','r') do
local parses = totable(line)
if (tonumber(parses[1])>0) then
yourmon[id] = tonumber(parses[1])
license[id] = tonumber(parses[2])
break
end
end
else
msg2(id,'©255000000Failed to load save!@C')
msg2(id,'©255000000Please check your U.S.G.N account settings!@C')
end
end
end

addhook("leave","save")
function save(id)
if (player(id,"usgn") > 0) then
save_data = yourmon[id].."    "..license[id]
file = assert(io.open('sys/lua/saves/'..player(id,"usgn")..'.txt','w'))
file:write(save_data)
file:close()
msg2(id,'©000255001Save Data Successfull!@C')
else
msg2(id,'©255000000Failed to Save!@C')
end
end
why error? help pls

old Re: Lua Scripts/Questions/Help

Ruirize
User Off Offline

Quote
Skipper has written
hey there, I got a problem with this code, somehow it's not working, I can't understand it...

1
2
3
4
5
6
7
8
addhook("say","say_commands")
function say_commands(id,txt)
          if("kick"==string.sub(txt,1,5))then
          tt=tonumber(string.sub(txt,6,7))
               parse("kick " .. tt)
          end
     end
end

Would be great if someone could help me.

In fact, the Error is at line 3 - he doesn't expect "!"...

Lua doesn't use ! as an inverter. Instead it uses ~. Also, you need to concatenate the string, not just put the variable there.

old Menu and through wallz

Rainoth
Moderator Off Offline

Quote
Hello all does some1 know how to make such thing :
• A player can go through wallz...
I saw it in Wfw modded server.

Now with menu stuff...

Is it possible to make example 5 menus with 1 addhook "menu" hook ? If so then how ?

old Bug in 0.1.1.8

Snake_Eater
User Off Offline

Quote
Hi all I want make a script with images for all players

like this

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
42
addhook("say","spawn5")
function spawn5(id,txt) 
	if(txt=="!tank") then
          freeimage(id)
          parse("speedmod "..id.." 10")
		parse("equip "..id.." "..47)
		parse("setmaxhealth "..id.." "..250)
		parse("setarmor "..id.." "..200)
		parse([[mp_wpndmg "RPG Launcher" 2500]] )
          id1=image("gfx/xerohx/tank.bmp",1,1,200+id) 
          imagescale(id1,1,1) 
          imageblend(id1,0) 
          imagealpha(id1,1.0)
          if (player(id,"team") == 2) then 
               imagecolor(id1,255,255,255) 
                
          elseif (player(id,"team") == 1) then 
               imagecolor(id1,255,255,255) 
          end 
	end
end

addhook("say","spawn2") 
function spawn2(id,txt,p) 
	if(txt=="!notank") then
	  parse("speedmod "..id.." 0")
		parse("strip "..id.." "..47)
		parse("setmaxhealth "..id.." "..100)
		parse("setarmor "..id.." "..0)
          freeimage(id) 
          id1=image("gfx/flare2.bmp",0,0,100+id) 
          imagescale(id1,1,1) 
          imageblend(id1,1) 
          imagealpha(id1,0.7) 
          if (player(id,"team") == 2) then 
               imagecolor(id1,0,0,0) 
                
          elseif (player(id,"team") == 1) then 
               imagecolor(id1,0,0,0) 
          end 
	end
end

I maked it and it worked but then.....
the new version came and it no longer worked so...

old version=work√
new version=don't work×

BUT WHY??

Ps:You need this files for it:

http://unrealsoftware.de/files_show.php?file=1314

old 3 Questions

tom282f3
User Off Offline

Quote
How to make your moving like using "!noclip"?
Example:
1.
More >

2.
More >

3.
More >


Plus, how to make you moving at different speed depending on your cursor to player's distance?
Example:
4.
More >

5.
More >

6.
More >


And 2 questions above can integrate into a same script like pointed 320(North),240(1/2 Entire window high) and then player goes North at speed 100?

Sorry for my bad English

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
Hello another thing i wanna ask all of you scripters.

I need a lua that makes clan members make a message orange when they say something even if they are dead.
If you can please do it with Unreal software account ID's.
Thank you very much.

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
help i make map with npc and:
trigger start
Name:
Trigger:stop,zombie
trigger delay
name:zombie
trigger:zombie,zm
delay 8sec
trigger delay
Name:stop
trigger:zombie
delay:40sec
env_npc
name:zm
trigger:
spawn on start:NO!
and after 40sec zombies respawn;/
description:the point is that after 40 seconds npcs no longer respawn

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
I need to know thses two things what # does at the beginning of a source file and where can I get a library (for Lua) for some internet interface (something to get data from webpages.)

edit
Nvm about the internet thing I found a way.
edited 1×, last 28.08.10 06:49:16 am

old Re: Lua Scripts/Questions/Help

kalis
User Off Offline

Quote
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
42
43
44
45
46
function totable(t,match)
local cmd = {}
if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end


addhook("join","load")
function load(id)
usgn = player(id,"usgn")
if (usgn > 0) then
local usgn = player(id, "usgn")
files = io.open('sys/lua/saves/'..player(id,"usgn")..'.txt','r')
if(files~=nil) then
msg2(id,'©000255000Your save file found!@C')
msg2(id,'©160160255Your U.S.G.N ID: '..player(id,"usgn")..'@C')
for line in io.lines('sys/lua/saves/'..player(id,"usgn")..'.txt','r') do
local parses = totable(line)
if (tonumber(parses[1])>0) then
yourmon[id] = tonumber(parses[1])
license[id] = tonumber(parses[2])
break
end
end
else
msg2(id,'©255000000Failed to load save!@C')
msg2(id,'©255000000Please check your U.S.G.N account settings!@C')
end
end
end

addhook("leave","save")
function save(id)
if (player(id,"usgn") > 0) then
save_data = yourmon[id].." "..license[id]
file = assert(io.open('sys/lua/saves/'..player(id,"usgn")..'.txt','w'))
file:write(save_data)
file:close()
msg2(id,'©000255001Save Data Successfull!@C')
else
msg2(id,'©255000000Failed to Save!@C')
end
end
why error? can help me ?

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
Hello all ! I have two big things to ask and especially first one.

I want to make that clan members can chat in orange color. Example my US ID is 15476 and if i say "blabla" it prints me "batlaizys (Clan member) said : blabla" .The whole message i say has to be ORANGE. If you help me with this thing i give you cookies

Now a less important question...

Is it possible to make example 5 menus with 1 "menu" hook ? If so then how ?

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
batlaizys has written
Hello all ! I have two big things to ask and especially first one.

I want to make that clan members can chat in orange color. Example my US ID is 15476 and if i say "blabla" it prints me "batlaizys (Clan member) said : blabla" .The whole message i say has to be ORANGE. If you help me with this thing i give you cookies

Now a less important question...

Is it possible to make example 5 menus with 1 "menu" hook ? If so then how ?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("say","membersay")
function membersay(id,t)
	if (player(id,"usgn") == USID) then
		if t=="rank" then
			return 0
		else
			msg("©212121023"..player(id,"name").." (Clan Member): "..t)
			return 1 end
	elseif (player(id,"usgn") == USID) then
		if t=="rank" then
			return 0
		else
			msg("©212121023"..player(id,"name").." (Clan Member): "..t)
			return 1
		end
	end
end


i want my cookie now

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
And how about the second question ? if u answer i give you more. Here for the 1st question. cookie And if i want to add more US ID i have to seperate with comma ?

EDIT : It doesnt work and whats with the rank thingy ? I put my US ID

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("say","membersay")
function membersay(id,t)
     if (player(id,"15476") == USID) then
          if t=="rank" then
               return 0
          else
               msg("©212121023"..player(id,"name").." (Clan Member): "..t)
               return 1 end
     elseif (player(id,"15476") == USID) then
          if t=="rank" then
               return 0
          else
               msg("©212121023"..player(id,"name").." (Clan Member): "..t)
               return 1
          end
     end
end

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
@batlaizys

use the word "or"^^ like

if (player(...,"usgn")==USID) or (player(...,"usgn")==USID) then...........

Ps:

Snake_Eater has written
Hi all I want make a script with images for all players

like this

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
42
addhook("say","spawn5")
function spawn5(id,txt)
     if(txt=="!tank") then
freeimage(id)
parse("speedmod "..id.." 10")
          parse("equip "..id.." "..47)
          parse("setmaxhealth "..id.." "..250)
          parse("setarmor "..id.." "..200)
          parse([[mp_wpndmg "RPG Launcher" 2500]] )
id1=image("gfx/xerohx/tank.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id1,0)
imagealpha(id1,1.0)
if (player(id,"team") == 2) then
imagecolor(id1,255,255,255)

elseif (player(id,"team") == 1) then
imagecolor(id1,255,255,255)
end
     end
end

addhook("say","spawn2")
function spawn2(id,txt,p)
     if(txt=="!notank") then
      parse("speedmod "..id.." 0")
          parse("strip "..id.." "..47)
          parse("setmaxhealth "..id.." "..100)
          parse("setarmor "..id.." "..0)
freeimage(id)
id1=image("gfx/flare2.bmp",0,0,100+id)
imagescale(id1,1,1)
imageblend(id1,1)
imagealpha(id1,0.7)
if (player(id,"team") == 2) then
imagecolor(id1,0,0,0)

elseif (player(id,"team") == 1) then
imagecolor(id1,0,0,0)
end
     end
end

I maked it and it worked but then.....
the new version came and it no longer worked so...

old version=work√
new version=don't work×

BUT WHY??

Ps:You need this files for it:

http://unrealsoftware.de/files_show.php?file=1314


Help please
edited 1×, last 28.08.10 10:05:20 am

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
addhook("say","membersay")
function membersay(id,t)
if (player(id,"usgn")==15476) or (player(id,"usgn")==15476) then
  if t=="rank" then
         return 0
  else
  msg("©212121023"..player(id,"name").." (Clan Member): "..t)
         return 1 
  end
end
end

Like this I think
To the start Previous 1 2241 242 243338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview