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 2223 224 225338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("say","buildings")
function around(id,txt)
     if txt == "!around" then
     if (player(id,"money")>14999) then
          parse("spawnobject 8 "..(player(id,"tilex")+1).." "..player(id,"tiley")+1).." 0 0 "..player(id,"team").." "..id)
	  parse("spawnobject 8 "..(player(id,"tilex")+1).." "..player(id,"tiley")-1).." 0 0 "..player(id,"team").." "..id)
	  parse("spawnobject 8 "..(player(id,"tilex")-1).." "..player(id,"tiley")+1).." 0 0 "..player(id,"team").." "..id)
	  parse("spawnobject 8 "..(player(id,"tilex")-1).." "..player(id,"tiley")-1).." 0 0 "..player(id,"team").." "..id)
	  parse("spawnobject 6 "..(player(id,"tilex")+1).." "..player(id,"tiley")+0).." 0 0 "..player(id,"team").." "..id)
	  parse("spawnobject 6 "..(player(id,"tilex")+0).." "..player(id,"tiley")+1).." 0 0 "..player(id,"team").." "..id)
	  parse("spawnobject 6 "..(player(id,"tilex")-1).." "..player(id,"tiley")+0).." 0 0 "..player(id,"team").." "..id)
	  parse("spawnobject 6 "..(player(id,"tilex")+0).." "..player(id,"tiley")-1).." 0 0 "..player(id,"team").." "..id)
	  parse("setmoney "..id.." "..player(id,"money")-15000)
	 end
end

Error : unexpected simbol near ".." in 5th line
I don't see wrong simbols...

old Re: Lua Scripts/Questions/Help

VegBerg
User Off Offline

Quote
As all of you previous readers of my posts know, I'm very bad in Lua. So I wonder, is it possible to make a Google Translate script so you can say e.g. "!nor-eng <meaage here> that translates from Norwegian to English, and also other languages

If you want to make a script like that to me or help me you should get the credits for it

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Adollo has written
Does anybody know how to make better timer?


1
2
3
4
5
6
7
8
9
10
11
12
_timer=0

addhook("second","timersec") -- change second to minute if u want it to be every minute
function timersec()
_timer=_timer+1
	if _timer==1 then -- if timer is 1 then
		msg2(id,"timer is 1 omg")
		_timer=_timer+1
	elseif _timer==10 then - if timer is 10 then timer go down to 1 again
		_timer=0
	end
end

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
@ batlaizys

try this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("say","buildings")
function buildings(id,txt)
tx=player(id,"tilex")
ty=player(id,"tiley")
if txt == "!around" then
parse("spawnobject 8 "..(tx+1).." "..(ty+1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 8 "..(tx+1).." "..(ty-1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 8 "..(tx-1).." "..(ty+1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 8 "..(tx-1).." "..(ty-1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 6 "..(tx+1).." "..(ty+0).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 6 "..(tx+0).." "..(ty+1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 6 "..(tx-1).." "..(ty+0).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 6 "..(tx+0).." "..(ty-1).." 0 0 "..player(id,"team").." "..id)
end
end

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Snake_Eater has written
@ batlaizys

try this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("say","buildings")
function buildings(id,txt)
tx=player(id,"tilex")
ty=player(id,"tiley")
if txt == "!around" then
parse("spawnobject 8 "..(tx+1).." "..(ty+1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 8 "..(tx+1).." "..(ty-1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 8 "..(tx-1).." "..(ty+1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 8 "..(tx-1).." "..(ty-1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 6 "..(tx+1).." "..(ty+0).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 6 "..(tx+0).." "..(ty+1).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 6 "..(tx-1).." "..(ty+0).." 0 0 "..player(id,"team").." "..id)
parse("spawnobject 6 "..(tx+0).." "..(ty-1).." 0 0 "..player(id,"team").." "..id)
end
end


You forgot the money

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
addhook("say","buildings")
function buildings(id,txt)
tx=player(id,"tilex")
ty=player(id,"tiley")
	if txt == "!around" then
		if (player(id,"money")>4999) then
			parse("spawnobject 8 "..(tx+1).." "..(ty+1).." 0 0 "..player(id,"team").." "..id)
			parse("spawnobject 8 "..(tx+1).." "..(ty-1).." 0 0 "..player(id,"team").." "..id)
			parse("spawnobject 8 "..(tx-1).." "..(ty+1).." 0 0 "..player(id,"team").." "..id)
			parse("spawnobject 8 "..(tx-1).." "..(ty-1).." 0 0 "..player(id,"team").." "..id)
			parse("spawnobject 6 "..(tx+1).." "..(ty+0).." 0 0 "..player(id,"team").." "..id)
			parse("spawnobject 6 "..(tx+0).." "..(ty+1).." 0 0 "..player(id,"team").." "..id)
			parse("spawnobject 6 "..(tx-1).." "..(ty+0).." 0 0 "..player(id,"team").." "..id)
			parse("spawnobject 6 "..(tx+0).." "..(ty-1).." 0 0 "..player(id,"team").." "..id)
			msg2(id,"Youve builded the Around Base")
			parse("setmoney "..id.." "..player(id,"money") - 5000)
			return 1
		else
			msg2(id,"You dont have enough money")
			return 1
		end
	end
end

/edit

i need a script when you walkover a claw then it strips an HE

/edit

nvm dont need anymore
edited 3×, last 25.07.10 09:57:46 pm

old !spawn

Soja1997
User Off Offline

Quote
Hi i need script on standart game mode
only TT Can use this script CT Cant
iF TT Say !spawn
he got spawn on pos x y z

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Soja1997 has written
Hi i need script on standart game mode
only TT Can use this script CT Cant
iF TT Say !spawn
he got spawn on pos x y z

there u go
1
2
3
4
5
6
7
8
9
addhook("say","saytt")
function saytt(id,txt)
	if (player(id,"team") == 1) then
		if txt=="!spawn" then
			parse("spawnplayer "..id.." X Y")
			return 1
		end
	end
end

So i need help with this script

1
2
3
4
5
6
7
8
9
10
addhook("drop","dropknife_dropcheck")
function dropknife_dropcheck(id,iid,type,ain,a,mode,x,y)
	if knife[id]==1 then
		parse("strip "..id.." 50")
		parse("equip "..id.." 78")
		parse("setweapon "..id.." 78")
	elseif knife[id]==0 then
		return 0
	end
end

it wont work i need if knife[id]==1 then it strips the players knife and equips an claw and sets the claw as the players weapon

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
wait i test script ;P
LUA ERROR: sys/lua/tt.lua:5: 'then' expected near 'parse'
1
2
3
4
5
6
7
8
9
addhook("say","saytt")
function saytt(id,txt)
     if (player(id,"team") == 1) then
          if txt=="!spawn tt"
               parse("spawnplayer "..id.." 48 750")
               return 1
          end
     end
end
you script here but if you drop claw you got knife ;/ you can make script cant drop claw ;]
1
2
3
4
5
6
addhook("spawn","clawtoknife")
function clawtoknife(id)
		parse ("equip "..id.." 78")
		parse ("setweapon "..id.." 78")
		parse ("strip "..id.." 50")
     end

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Soja1997 has written
wait i test script ;P
LUA ERROR: sys/lua/tt.lua:5: 'then' expected near 'parse'
1
2
3
4
5
6
7
8
9
addhook("say","saytt")
function saytt(id,txt)
     if (player(id,"team") == 1) then
          if txt=="!spawn tt"
               parse("spawnplayer "..id.." 48 750")
               return 1
          end
     end
end
you script here but if you drop claw you got knife ;/ you can make script cant drop claw ;]
1
2
3
4
5
6
addhook("spawn","clawtoknife")
function clawtoknife(id)
		parse ("equip "..id.." 78")
		parse ("setweapon "..id.." 78")
		parse ("strip "..id.." 50")
     end


1
2
3
4
5
6
7
8
9
addhook("say","saytt")
function saytt(id,txt)
if (player(id,"team") == 1) then
if txt=="!spawn tt" then
parse("spawnplayer "..id.." 48 750")
return 1
end
end
end

and i didnt mean that, I meant if knife[id]==1 then it strips the players knife and equips an claw and sets the claw as the players weapon

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
first test my script is works
1
2
3
4
5
6
7
8
9
addhook("say","saytt")
function saytt(id,txt)
     if (player(id,"team") == 1) then
          if txt=="!spawn tt"
               parse ("spawnplayer "..id.." 48 750")
               return 1
          end
     end
end
here is error
1
LUA ERROR: sys/lua/tt.lua:5: 'then' expected near 'parse'

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Soja1997 has written
first test my script is works
1
2
3
4
5
6
7
8
9
addhook("say","saytt")
function saytt(id,txt)
     if (player(id,"team") == 1) then
          if txt=="!spawn tt"
               parse ("spawnplayer "..id.." 48 750")
               return 1
          end
     end
end
here is error
1
LUA ERROR: sys/lua/tt.lua:5: 'then' expected near 'parse'


ive already fixed it omg

1
2
3
4
5
6
7
8
9
addhook("say","saytt")
function saytt(id,txt)
if (player(id,"team") == 1) then
if txt=="!spawn tt" then
parse("spawnplayer "..id.." 48 750")
return 1
end
end
end

old parse colorsmoke

Alex_Aaa789
User Off Offline

Quote
parse colorsmoke wont work
1
parse('effect "colorsmoke" '..x..' '..y..' 140 96 0 0 0)

But it comes an error that ')' is expected near 'colorsmoke'

Is it possible to be fix?

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Alex_Aaa789 has written
parse colorsmoke wont work
1
parse('effect "colorsmoke" '..x..' '..y..' 140 96 0 0 0)

But it comes an error that ')' is expected near 'colorsmoke'

Is it possible to be fix?


1
parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 0')

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Alex_Aaa789 has written
fixed
But why ) still expected near colorsmoke?


you didnt put an ' in the end

Mine:
1
')
Yours:
1
)

old Re: Lua Scripts/Questions/Help

Alex_Aaa789
User Off Offline

Quote
Omg, now it keeps spamming
1
LUA ERROR: attempt to call a nil value

My full lua:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook("hit","heal")
function healgun(id,source,wpn,hpdmg,apdmg,x,y)
local x, y
x = player( id, "x")
y = player( id, "y")
     if wpn == 2 then
          parse("sethealth "..id.." "..player(id,"health")+10)
          parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 255 192 203')
          parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 128 0 128')
		  msg2(id,"You got healed by "..player(p,"name").."")
          return 1
     end
     if wpn == 1 then
          parse("setpos "..id.." 544 1888")
          parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 0')
          parse('effect "colorsmoke" ' ..x.. ' ' ..y.. ' 140 96 0 0 139')
		  msg2(id,"You got jailed by "..player(p,"name").."")
		  return 1
     end
end

I should add what to stop that calling nil value?
To the start Previous 1 2223 224 225338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview