Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2222 223 224338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Zitieren
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
1× editiert, zuletzt 23.07.10 20:20:39

alt Re: Lua Scripts/Questions/Help

firefox
BANNED Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
firefox hat geschrieben
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.

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Zitieren
Snake_Eater hat geschrieben
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
3× editiert, zuletzt 24.07.10 19:13:47

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
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 ?

alt Re: Lua Scripts/Questions/Help

texnonikWP
User Off Offline

Zitieren
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 .

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
batlaizys hat geschrieben
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)

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Zitieren
batlaizys hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
batlaizys hat geschrieben
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)

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Zitieren
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
Zum Anfang Vorherige 1 2222 223 224338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht