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 2191 192 193338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Anti
User Off Offline

Zitieren
BureX,

you use it?

1
2
if sample==nil then sample={} end
sample.sayfuncs={}
--- Its NO WORK

OR

1
2
3
if sample==nil then sample={} end
sample.sayfuncs={}
sample.classes={}
--- Its work

Or use it:
1
2
3
4
5
6
7
8
9
10
11
addhook("say","sample.classes.say")
function sample.classes.say(id,txt)
     if(txt=="!lm") then
     if (player(id,"money")>799) then
     parse("equip "..id.." 87")
     parse("setmoney "..id.." "..player(id,"money")-800)
     else
     msg2(id,"©255000000You don't have enough of money (need 800 money)")
     end
end
end

Here change: (sample.funcs == sample.classes)
addhook("say","sample.CLASSES.say") -- it no code
function sample.CLASSES.say(id,txt) -- It no code

Sorry for my bad english!

alt Re: Lua Scripts/Questions/Help

lol93
User Off Offline

Zitieren
hi i am kinda new and i have troble whit my script
plz dont say things like omg thats very stupid.

Script

1
2
3
4
5
6
7
8
addhook ("minute")
function tutorialadvertise()
   for player(i = 1, 60, 1) do
      if (player(i, "exists")) then
         equip("player "..player(id, "84")
      end
   end
end

I wanne have:
if a player gots a gut bomb, and after he used it he will get a new gut bomb in 60 sec.

alt Re: Lua Scripts/Questions/Help

SkullFace
User Off Offline

Zitieren
Anti, yes but Patassuss maked me the working one

so Here is the script I wanted to make

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
33
34
35
36
37
parse("sv_gm 5")
addhook("spawn", "ghostmode")
function ghostmode(id)
if player(id,"team") == 1 then
parse("setmaxhealth "..id.." 30")
parse("speedmod "..id.." 10")
parse("equip "..id.." 84")
parse("equip "..id.." 55")
parse("mp_wpndmg claw 100")
elseif player(id,"team") == 2 then
parse("equip "..id.." 87")
parse("mp_wpndmg awp 100")
parse("mp_wpndmg_z1 awp 150")
parse("mp_wpndmg_z2 awp 200")
parse("mp_wpndmg LaserMine 0")
end
end

if sample==nil then sample={} end
sample.classes={}

addhook("die","sample.classes.die")
function sample.classes.die()
	return 1
end

addhook("say","sayi")
function sayi(id,txt)
if(txt=="!lm") then
if (player(id,"money")>9999) then
parse("equip "..id.." 87")
parse("setmoney "..id.." "..(player(id,"money")-10000))
else
msg2(id,"©255000000You don't have enough of money (need 10000 money)")
end
end
end
i just changed it a little bit
this ghost mode is from one MMO game i dont remember how it is called

BTW : How could i make lua script when I press E on USE BUTTON and then appears some cr*p where i could choose stuff
1× editiert, zuletzt 19.04.10 17:41:25

alt Building health

SDKey
User Off Offline

Zitieren
> How many health has buildings, such as Turret, Barricade, Wall I, Wall II and other?
> And How many dmg has weapons?

Thanks.

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
SDKey hat geschrieben
> How many health has buildings, such as Turret, Barricade, Wall I, Wall II and other?
> And How many dmg has weapons?

Thanks.


For building health, for example AK-47 has 50dmg
count your shots to building and * 50.

You can find weapon dmgs in BUY MENU where is price etc.

alt Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Zitieren
Mehr >

some 1 help i need to make it able just for admins

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
lol93 hat geschrieben
1
2
3
4
5
6
7
8
addhook ("minute")
function tutorialadvertise()
   for player(i = 1, 60, 1) do
      if (player(i, "exists")) then
         equip("player "..player(id, "84")
      end
   end
end


Hmm...
I will fix it for you but:
You should use attack hook and timers, even though the timer system is really fucked up it should work for what you are trying to do.
Also, you shouldn't use a loop, they are way too fast

1
2
3
4
5
6
7
8
9
10
_GUTBOMB_ = 0 --Insert here the id of the gutbomb
function give_gutbomb(id)
	parse("equip "..id.." ".._GUTBOMB_)
end
addhook("projectile","asd")
function asd(id,wp)
	if wp == _GUTBOMB_ then
		timer(60*1000,"give_gutbomb",tostring(id),1)
	end
end

I'll try to explain the code so you can understand it.
Zitat
_GUTBOMB_ = 0 --Insert here the id of the gutbomb

Nothing too hard, I create a variable to store the gutbomb's id.
Zitat
function give_gutbomb(id)
     parse("equip "..id.." ".._GUTBOMB_)
end

Here I created the function that should be called by the timer. This function will take the id of the player and equip him a gutbomb (id is a string)
Zitat
addhook("projectile","asd")
function asd(id,wp)
     if wp == _GUTBOMB_ then
          timer(60*1000,"give_gutbomb",tostring(id),1)
     end
end

Here I used the projectile hook (it will be called once the gutbomb collides with a wall/ the floor)
I checked if the thrown weapon was the gutbomb and made a timer that would call our previous function only once in 60000 miliseconds passing to it the id of the player as a string.

BTW: I didn't test it

alt Re: Lua Scripts/Questions/Help

Anti
User Off Offline

Zitieren
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
33
34
35
36
addhook("menu","TESTmenu")
function TESTmenu(id,menu,sel)
	if (menu=="NAME") then
		if sel==1 then

		elseif sel==2 then

		elseif sel==3 then

		elseif sel==4 then

		elseif sel==5 then
			
		elseif sel==6 then

		elseif sel==7 then

		elseif sel==8 then

		elseif sel==9 then

		end
	end

addhook("use","test_shop")
function test_shop(id)
x = player(id,"tilex")
y = player(id,"tiley")
	if (x==XXX) and (y==YYY) then TESTmenus(id);end
end

function TESTmenus(id)
if (player(id,"team")==2) then
menu(id,"NAME, name1, name2, name3, name4, name5, name6, name7, name8, name9")
end
end


--
if (menu=="NAME") then
menu(id,"NAME, name1, name2, name3, name4, name5, name6, name7, name8, name9")

and, if name = LOL then -- no lua
if (menu=="LOL") then
menu(id,"LOL, name1, name2, name3, name4, name5, name6, name7, name8, name9")
--

• IT LOW
• 100 WORK % ("I TEST IT")
• AND PLEASE!

Screen:
∗Test

By Anti..
5× editiert, zuletzt 20.04.10 12:55:08

alt Re: Lua Scripts/Questions/Help

normix
User Off Offline

Zitieren
hello, today i downloaded a lua script that has alot of voting options in it... im not that very good at scripting so i would like to ask for help... can any1 please edit this script to disable all voting options except for map voting. kick voting and round restart? prity plss!
link of script : http://www.unrealsoftware.de/files_show.php?file=134

Admin/Mod Kommentar

I deleted the code. The download link is enough /TheKilledDeath

alt Re: Lua Scripts/Questions/Help

lol93
User Off Offline

Zitieren
2 flacko

ty it worked and also ty for da exsplanation

But i found somting thats wrong, when i get a gut bom and use it and get one again then there are 2 timers.
One for the first gut bom and one for the second.
How to solve it?
1× editiert, zuletzt 20.04.10 18:51:03

alt Re: Lua Scripts/Questions/Help

Sudden Death
User Off Offline

Zitieren
Omfg who can change this:
Spoiler >

to free image

alt Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Zitieren
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

function totable(t,match)
	local cmd = {}
	if not match then match = "[^%s]+" end
	for word in string.gmatch(t, match) do
		table.insert(cmd, word)
	end 
	return cmd 
end

addhook("say","car")
function car(i,txt)
	local parses = totable(txt)
	local cmd = tostring(parses[1])
	local id = tonumber(parses[2])
	local v = tonumber(parses[3])
		if (cmd=="!ally") then
			if (id ~= nil and v ~= nil) then
				if (player(id,"exists")) then
					pl_ally[i]=id
					pl_ally[id]=i
					mm_ally[i]=v
					mm_ally[id]=v
				end
			end
			return 1
		end
		if (txt=="!car") then
				if car[i]==0 then
					carx[i]=player(i,"tilex")
					cary[i]=player(i,"tiley")
					car[i]=1
				elseif car[i]==1 then
					msg2(i,"©255000000You have already a car!@C")
				end
			return 1
		end
		if (txt=="!eject") then
			if car[i]==1 then
				if playerisincar[i]==1 then
					car[i]=0
					freeimage(i)
					carxpos = carx[i]*32
					carypos = cary[i]*32
					parse("explosion "..carxpos.." "..carypos.." 300 3000 "..i)
					carx[i]=0
					cary[i]=0
					parse("sv_sound \"extasy/impact.ogg\"")
				elseif playerisincar[i]==0 then
					freeimage(i)
					parse("customkill "..i.." Eject "..i)
					parse("explosion "..player(i,"x").." "..player(i,"y").." 300 3000 "..i)
					carx[i]=0
					cary[i]=0
					car[i]=0
					parse("sv_sound \"extasy/impact.ogg\"")
				end
			elseif car[i]==0 then
				msg2(i,"©255000000You haven't car!@C")
			end
			return 1
		end
end

carx = initArray(maxp)
cary = initArray(maxp)
car = initArray(maxp)
playerisincar = initArray(maxp)
addhook("use","car_mod_use")
function car_mod_use(id,event,data,tx,ty)
	if playerisincar[id]==1 then
		if (player(id,"tilex")==carx[id] and player(id,"tiley")==cary[id]) then
			playerisincar[id]=0
			freeimage(id)
			imag=image("gfx/extasy/car9.bmp",player(id,"x"),player(id,"y"),200+id)
			imagescale(imag,0.3,0.3)
			parse("speedmod "..id.." 50")
			parse ("sv_sound \"extasy/usecar.ogg\"")
		end
	elseif playerisincar[id]==0 then
		playerisincar[id]=1
		parse("speedmod "..id.." 0")
		carx[id]=player(id,"tilex")
		cary[id]=player(id,"tiley")
		freeimage(id)
		imag=image("gfx/extasy/ajeep.bmp",player(id,"x"),player(id,"y"),000+id)
		imagescale(imag,0.3,0.3)
		imagepos(imag,player(id,"x"),player(id,"y"),player(id,"rot"))
		parse ("sv_sound \"extasy/stop.ogg\"")
	end
end
Why does'nt Work?
Zum Anfang Vorherige 1 2191 192 193338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht