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 2254 255 256338 339 Next To the start

old Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Quote
Thank you.

Another little question: Is it easily possible to build in a little wait function - like wait 2 seconds - and then he's proceeding the next step? Would be interesting.

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Skipper has written
Thank you.

Another little question: Is it easily possible to build in a little wait function - like wait 2 seconds - and then he's proceeding the next step? Would be interesting.


w00t, Explain better i understand NADA

old Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Quote
HaRe has written
Skipper has written
Thank you.

Another little question: Is it easily possible to build in a little wait function - like wait 2 seconds - and then he's proceeding the next step? Would be interesting.


w00t, Explain better i understand NADA


look, for example, I want that you say !random and then you have to wait 5 seconds and you get a random weapon. that !random and the random weapon are not the problem, the wait time is my problem.

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Skipper has written
HaRe has written
Skipper has written
Thank you.

Another little question: Is it easily possible to build in a little wait function - like wait 2 seconds - and then he's proceeding the next step? Would be interesting.


w00t, Explain better i understand NADA


look, for example, I want that you say !random and then you have to wait 5 seconds and you get a random weapon. that !random and the random weapon are not the problem, the wait time is my problem.



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
function Array(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

timeplayer = Array(32)

addhook("say","sayrandom")
function sayrandom(id,)
	if t=="!random" then
		if (timeplayer[id]>5) then
			timeplayer[id]=0
			parse("equip "..id.." math.random(1,3)")
			return 1
		else
			msg2(id,"You cant type it yet")
			return 1
		end
	end
end

addhook("second","randomsec")
function randomsec()
	for id = 1,32 do
		if (player(id,"exists")) then
			timeplayer[id]=timeplayer[id]+1
		end
	end
end

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
Does anybody know:

1
2
3
.....
parse ("setpos "..id.." "..math.random(1,2000).." "..math.random(1,2000))
.....

I want if the first math.random is 1345 that the second math.random is 1345 too.

How to make??

old Re: Lua Scripts/Questions/Help

head600
BANNED Off Offline

Quote
addhook("hit","ssss")
function ssss (id,src,wpn)
if wpn==1 then
      if (sample.classes.class[id]==1) then
      if (sample.classes.class[src]==5) then
parse("setpos "..id.." 10 10")
msg2( id, " "..player(source,"name").." Tarafindan Hapse Tikildin...")


end
end
end
end


whats wrong??

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
@ head600
You cant use the vaule src and later source ,only one is possible

1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("hit","ssss")
function ssss (id,src,wpn) 			<-- here you use src
if wpn==1 then
      if (sample.classes.class[id]==1) then
      if (sample.classes.class[src]==5) then
parse("setpos "..id.." 10 10")
msg2( id, " "..player(source,"name").." Tarafindan Hapse Tikildin...") 			<-- here you use source


end
end
end
end

old Re: Lua Scripts/Questions/Help

murilog
User Off Offline

Quote
Code:

addhook("leave","RPsave")
function RPsave(id)
if (player(id,"usgn") > 0) then
f = assert(io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','w'))
f:write(rp_cr[id])
f:close()
msg2(id,"©000255000Jogo salvo com sucesso!@C")
else
msg2(id,"©000255000Falha ao salvar o jogo!@C")
end
rp_cr[id] = 0
end

addhook("join","RPload")
function RPload(id)
if (player(id,"usgn") > 0) then
msg2(id,'Seu U.S.G.N. ID é : '..player(id,"usgn")..'@C')
f = io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','r')
if (f ~= nil) then
RPTransition(id,f)
f:close()
else
msg2(id,'Falha ao carregar seu Save!@C')
end
else
msg2(id,'Falha ao carregar seu Save!@C')
end
end

addhook("say","SaySaveLoad")
function SaySaveLoad(id,txt)
if (txt=="!save") then
if (player(id,"usgn") > 0) then
msg2(id,'Salvando U.S.G.N. : '..player(id,"usgn")..'@C')
f = assert(io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','w'))
f:write(rp_cr[id])
f:close()
msg2(id,"©000255000Jogo salvo com sucesso!@C")
else
msg2(id,"©000255000Falha ao salvar o jogo!@C")
end
end
if (txt=="!load") then
if (player(id,"usgn") > 0) then
msg2(id,'Carregando U.S.G.N. : '..player(id,"usgn")..'@C')
f = io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','r')
if (f ~= nil) then
RPTransition(id,f)
f:close()
else
msg2(id,'Falha ao carregar seu Save!@C')
end
else
msg2(id,'Falha ao carregar seu Save!@C')
end
end
end

function RPTransition(id,f:read("*all"))
rp_cr[id] = f
msg2(id,'Save carregado com sucesso!@C')
parse('hudtxt2 '..id..' 3 "©000000255Dinheiro : R$ '..rp_cr[id]..'" 17 430')
end

What's wrong ?

and , can make !givemoney <id> whit this script

old Re: Lua Scripts/Questions/Help

murilog
User Off Offline

Quote
Code:
addhook("leave","RPsave")
function RPsave(id)
if (player(id,"usgn") > 0) then
f = assert(io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','w'))
f:write(rp_cr[id])
f:close()
msg2(id,"©000255000Jogo salvo com sucesso!@C")
else
msg2(id,"©000255000Falha ao salvar o jogo!@C")
end
rp_cr[id] = 0
end

addhook("join","RPload")
function RPload(id)
if (player(id,"usgn") > 0) then
msg2(id,'Seu U.S.G.N. ID é : '..player(id,"usgn")..'@C')
f = io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','r')
if (f ~= nil) then
RPTransition(id,f)
f:close()
else
msg2(id,'Falha ao carregar seu Save!@C')
end
else
msg2(id,'Falha ao carregar seu Save!@C')
end
end

addhook("say","SaySaveLoad")
function SaySaveLoad(id,txt)
if (txt=="!save") then
if (player(id,"usgn") > 0) then
msg2(id,'Salvando U.S.G.N. : '..player(id,"usgn")..'@C')
f = assert(io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','w'))
f:write(rp_cr[id])
f:close()
msg2(id,"©000255000Jogo salvo com sucesso!@C")
else
msg2(id,"©000255000Falha ao salvar o jogo!@C")
end
end
if (txt=="!load") then
if (player(id,"usgn") > 0) then
msg2(id,'Carregando U.S.G.N. : '..player(id,"usgn")..'@C')
f = io.open('sys/lua/saved/'..player(id,"usgn")..'.txt','r')
if (f ~= nil) then
RPTransition(id,f)
f:close()
else
msg2(id,'Falha ao carregar seu Save!@C')
end
else
msg2(id,'Falha ao carregar seu Save!@C')
end
end
end

function RPTransition(id,f:read("*all"))
rp_cr[id] = f
msg2(id,'Save carregado com sucesso!@C')
parse('hudtxt2 '..id..' 3 "©000000255Dinheiro : R$ '..rp_cr[id]..'" 17 430')
end

What's wrong ?

and , can make !givemoney <id> whit this script

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
Hello could some one show me such code:

You spawn with random items. If i write it would do 1-6 weapons but what to do to example get 3 or 5 or 6 ?

Plz explain me this math.random stuff

old Re: Lua Scripts/Questions/Help

RAVENOUS
BANNED Off Offline

Quote
math.random() is randomizing between the two numbers in the brickets.

Example: math.random(10,50) = random number between 10 and 50.
To the start Previous 1 2254 255 256338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview