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 2222 223 224338 339 Next To the start

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
function zm_hit(id,src,w,h,a)
     zm_lasthit[id] = src
     if (player(id, "team") == 1 ) then
          if ( zm_chp[i] - h <= 0 ) then
               parse("customkill "..id.." killed "..zm_lasthit[id])
          else
 	      zm_chp[id] = zm_chp[id] - h
          end
          return 1
     end
end
I think that should fix it.

Edit:
@VegBerg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
adhook("say", "adminsay")
function adminsay(id, message)
     if (player(id,"usgn")==62805) then
          if (message == "@*") then -- need to put quotes around
             --  return 1 -- cant return here or script wont finish
               parse("msg"..id(message, "text").."@C") --Need closing parenthesis
		return 1 -- return here
          else
               return 0
          end
     else
          return 0
     end
end
edited 1×, last 23.07.10 08:20:39 pm

old Re: Lua Scripts/Questions/Help

firefox
BANNED Off Offline

Quote
idk a lot a bout script and lua thing , i hope if i can see script make no time limit for spry logo
thx if some one make it

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
firefox has written
idk a lot a bout script and lua thing , i hope if i can see script make no time limit for spry logo
thx if some one make it

It's not possible, BUT: you can make "simulation", so you do not actually spray, but do some image on some other key.

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
Snake_Eater has written
Hi all
•Does anybody know a position save and load script??
•Can anybody explain me the return function??

To your first question:
You need to use io.write() file:write() and file:close()

To your second the return function can only be used in functions and tells the function what to pass on.
1
2
3
4
5
func = function () end	-- This will return nothing
print(func())	-- Since the function returns nothing you would get  "" (nothing)
----------
func = function () return math.random(100) end -- Returns a random number
print(func())	-- Prints a random number
edited 3×, last 24.07.10 07:13:47 pm

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
thx

but what does return function here??

1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("say", "adminsay")
function adminsay(id, message)
if (player(id,"usgn")==62805) then
if (message == "@*") then 
parse("msg"..id(message, "text").."@C")
          return 1
else
return 0
end
else
return 0
end
end

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
Hello all !
I have an idea on such a script :

When you say certain text buildings appear around you like in superhero mod ?

Is that possible ?

Should in "spawn object" I should write x+1,x-1,y+1,y-1 ?

old Re: Lua Scripts/Questions/Help

texnonikWP
User Off Offline

Quote
Starkkz pliz add my in spype my login is : dawbawBK
very need help whith ramdom tigger its dont workidng i give you files and check then pliz.Thanks .

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
batlaizys has written
Hello all !
I have an idea on such a script :

When you say certain text buildings appear around you like in superhero mod ?

Is that possible ?

Should in "spawn object" I should write x+1,x-1,y+1,y-1 ?

yes
yes

you should write x+1,x-1,y+1,y-1 (x=player x, y=player y) in function added by addhook("say","yoursayfunction")
say(id,text)

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
Should it look similar to this ?

1
2
3
4
5
6
Addhook ("say","around")
function around(id,txt)
     if txt == "!around" then
          parse ("spawnobject 12 "..player(id,x+1).." "..player(id,y+1).."
     end
end

Uhhh... If this is correct a triple turret should appear in 1 of the corners ? Please correct if its wrong and explain what is wrong.

Thanks

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
batlaizys has written
Should it look similar to this ?

1
2
3
4
5
6
Addhook ("say","around")
function around(id,txt)
     if txt == "!around" then
          parse ("spawnobject 12 "..player(id,x+1).." "..player(id,y+1).."
     end
end

Uhhh... If this is correct a triple turret should appear in 1 of the corners ? Please correct if its wrong and explain what is wrong.

Thanks

OMG, no one know about lua scripting.

1
2
3
4
5
6
addhook("say","around")
function around(id,txt)
	if txt == "!around" then
		parse("spawnobject 12 "..(player(id,"tilex")+1).." "..player(id,"tiley")+1)
	end
end

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
batlaizys has written
Thank you starkkz !
But i want the turret to be my team !
(appears Neutral and killz me...)



parse("spawnobject 12 "..(player(id,"tilex")+1).." "..player(id,"tiley")+1.." 0 0 "..player(id,"team").." "..id)

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
addhook("say","around")
function around(id,txt)
	if txt == "!around" then
		parse(
			string.format(
				"spawnobject 12 %i %i 0 0 %i %i",
				player(id,"tilex")+1, player(id,"tiley")+1, player(id,"team"), id
			)
		)
	end
end

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
you can change the money with the cs2d command cs2d cmd setmoney
1
2
3
4
5
6
currentmoney=player(id,"money")
if (currentmoney>=15000) then
	parse("setmoney "..id.." "..(currentmoney-15000))
else
	-- not enough money action
end

with id = id of a player
To the start Previous 1 2222 223 224338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview