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 2231 232 233338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
Hi all I want to make a time script.
But the hudtxt does not work.
I want that the hudtxt(time) appears at the right site!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
h = 0
min = 0
sec = 0

addhook ("ms100","a")
function a()
sec = sec + 6
if sec==60 then
sec = 0
min = min + 1
     if min==60 then
     min = 0
     h = h + 1
         if h==24 then
         h = 0
         end
     end
end
end

addhook ("ms100","b")
function b()
parse ("hudtxt 1 "..h..":"..min..":"..sec.." 550 20 0")--Here I need help! 
end

The text appears in the upper left corner and not top right.

HELP PLS!

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Snake_Eater has written
Hi all I want to make a time script.
But the hudtxt does not work.
I want that the hudtxt(time) appears at the right site!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
h = 0
min = 0
sec = 0

addhook ("ms100","a")
function a()
sec = sec + 6
if sec==60 then
sec = 0
min = min + 1
     if min==60 then
     min = 0
     h = h + 1
         if h==24 then
         h = 0
         end
     end
end
end

addhook ("ms100","b")
function b()
parse ("hudtxt 1 "..h..":"..min..":"..sec.." 550 20 0")--Here I need help! 
end

The text appears in the upper left corner and not top right.

HELP PLS!


change
1
550 20 0

old Re: Lua Scripts/Questions/Help

proxe
User Off Offline

Quote
hey, just a quick question.
Why is it that bots stand still in some custom maps when there is a visible easy to go path for them to use?

old please script

murilog
User Off Offline

Quote
someone makes one script to me ? i want , if txt !moneyto <id> <amount> and give money for id , THANK FOR YOUR HELP

old Re: Lua Scripts/Questions/Help

proxe
User Off Offline

Quote
not to be offending but would an english lesson do any damage? its like half the forum cant write decent english
This aint ment to be a flame post just a recomendation to people. Its really hard to understand what that they mean sometimes

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
proxe has written
hey, just a quick question.
Why is it that bots stand still in some custom maps when there is a visible easy to go path for them to use?

No idea, this problem is not related to Lua (yet), it has to do with the inner workings of CS2D and it's nothing we can fix with lua.

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
MuH_ has written
someone makes one script to me ? i want , if txt !moneyto <id> <amount> and give money for id , THANK FOR YOUR HELP


Here is it!

1
2
3
4
5
6
7
8
9
10
11
addhook ("say","f")
function f(p,t)
local m=t:sub(1,8)
local m2=t:sub(10,11)
local m3=t:sub(12)
if m=="!moneyto" then
   if player(m2,"exists") then
   parse ("setmoney "..m2.." "..player(m2,"money")+m3)
   end
end
end

old Load File in Lua, but not works!

tom282f3
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
addhook("say","loadcash")
function loadcash(p,t)
if t=="!load" then
	local usgn, i = player(p,[[usgn]])
	if player(p,[[usgn]]) > 0 then
		msg2(p,[[Your U.S.G.N. ID: ]]..usgn)
		local f = io.open([[data/usgn_stats/]]..usgn..[[.txt]],[[r]])
		if f then
			msg2(p,[[Your Save File Found!@C]])
			for line in f:lines() do
				i = 1
				if (i == 1) then
					bank_money_player[p] = tonumber(line)
				else
					break
				end
			end
			f:close()
			i = 1
		else
			msg2(p,[[We are sorry, but failed to load save!@C]])
		end
	else
		msg2(p,2,[[Please Check Your U.S.G.N. Account Settings!@C]])
	end
end
end

Above, bank_money_player[p] is player's bank's money.

But when I run this script, it says
1
LUA ERROR: bad argument #1 to '?' (function expected, got number)

Pleeeeeeeaase help me!!! It's a important function on my script!!!

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
tom282f3 has written
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
addhook("say","loadcash")
function loadcash(p,t)
if t=="!load" then
	local usgn, i = player(p,[[usgn]])
	if player(p,[[usgn]]) > 0 then
		msg2(p,[[Your U.S.G.N. ID: ]]..usgn)
		local f = io.open([[data/usgn_stats/]]..usgn..[[.txt]],[[r]])
		if f then
			msg2(p,[[Your Save File Found!@C]])
			for line in f:lines() do
				i = 1
				if (i == 1) then
					bank_money_player[p] = tonumber(line)
				else
					break
				end
			end
			f:close()
			i = 1
		else
			msg2(p,[[We are sorry, but failed to load save!@C]])
		end
	else
		msg2(p,2,[[Please Check Your U.S.G.N. Account Settings!@C]])
	end
end
end

Above, bank_money_player[p] is player's bank's money.

But when I run this script, it says
1
LUA ERROR: bad argument #1 to '?' (function expected, got number)

Pleeeeeeeaase help me!!! It's a important function on my script!!!


1
2
3
4
5
6
7
8
9
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

bank_money_player = initArray(32)

this should work, Also the bank_money_player dont exists thats why it didnt work

old Re: Lua Scripts/Questions/Help

tom282f3
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end

bank_money_player = initArray(32)
Well actually I wrote it on another script, and use dofile() to connect, so I think that might not the problem. (I run it and connection is sucessful)

old Re: Lua Scripts/Questions/Help

Ruirize
User Off Offline

Quote
proxe has written
hey, just a quick question.
Why is it that bots stand still in some custom maps when there is a visible easy to go path for them to use?


Sorry to follow this up but meh.

The map has no bot_nodes. Bots require nodes spread about the map to work, with each one having a clear line of sight to at least one other, preferably two.

old Disable Dispenser Limit

tom282f3
User Off Offline

Quote
How to disable minimum range of each dispenser by script?

Admin/mod comment

I deleted this "big" shit. You are not more important than any other user here! /TheKilledDeath

old Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Quote
Ruirize has written
proxe has written
hey, just a quick question.
Why is it that bots stand still in some custom maps when there is a visible easy to go path for them to use?


Sorry to follow this up but meh.

The map has no bot_nodes. Bots require nodes spread about the map to work, with each one having a clear line of sight to at least one other, preferably two.
No, maps don't need bot nodes. Bot nodes are fully additional! They just make the chance higher that a bot walks there. But they are not like the old botnodes which had to exist.

old Help!!!

GreenStatic
User Off Offline

Quote
Guys, I see that you know LUA,
Help please, I want to create a mod STALKER and I need a script that will create a lot of monsters on the map and they will kill players)
Just like Pokemon mod...

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
@Dark Byte yes i can do this, but i want laser for player at 100dmg and laser for player at 0dmg (from pacman-gaming.de | SpecialFor Server)

@EDIT: Fixed, thx

old How to type xA9 in Lua

tom282f3
User Off Offline

Quote
Well, default serverinfo.txt have some colored text and looks like "?55000000", but when I see them in Notepad++, it's unicode "[xA9]" then "255000000". So I want to ask, how to type [xA9] in Notepad++ or Notepad?
To the start Previous 1 2231 232 233338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview