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 2246 247 248338 339 Next To the start

old Re: Lua Scripts/Questions/Help

CJ7
BANNED Off Offline

Quote
@MSek:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function hp_text()
	for i,v in ipairs(player(0,"table")) do
		parse('hudtxt2 '..i..' 1 \"©000200000Health: '..player(i,"health")..' \"13 200 ')
		
		
		local health = player(i,"health")
		
		if health < 26 then			
			parse('hudtxt2 '..i..' 2 \"Low \"13 212')
		elseif health < 71 then
			parse('hudtxt2 '..i..' 2 \"Good\"13 212')
		elseif health < 101 then
			parse('hudtxt2 '..i..' 2 \"Super!\" 13 212')
		elseif health < 201 then
			parse('hudtxt2 '..i..' 2 \"The best! \" 13 212')
		end
	end
end

addhook("ms100","hp_counter")
function hp_counter()
	hp_text()
end

old Re: Lua Scripts/Questions/Help

KenVo
User Off Offline

Quote
Hi guys, i need a script that have delay between 2 explosion, like:

say: !a
Explode
*After 2 second
Explode again

I tried to do that many time but i failed,I'll be glad if someone help me

Thank you

Edit: Here is my script

1
2
3
4
5
6
7
8
9
10
11
12
function addtimer(delay, func, ...)
     if type(func) == 'function' and type(delay) == 'number' then
          for i = 1, #_TIMER+1 do
               if not _TIMER[i] then
                    _TIMER[i] = {func, _time+delay, ...}
                    return i
               end
          end
     else
          return false
     end
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
....................................................
function(id, itemslot, itemid,equip)
			if PLAYERS[id].Class == "Magician" then
			if PLAYERS[id].Level >= 20 then
				if PLAYERS[id].Mana >= 0 then
				local x = player(id,"x")
				local y = player(id,"y")
				explosion(x,y,180,100,id)
               	addtimer(1000,explosion(x,y,100, 0))
               	parse('effect "colorsmoke" ' .. x .. ' ' .. y .. ' 125 96 255 255 255')
				PLAYERS[id].Mana = PLAYERS[id].Mana - 0
				updateHUD(id)
				end
			else
				message(id, 'You are not the required level!', '255255255')
			end
			else
				message(id, 'You are not a Magician!', '255255255')
			end
		end,
..................................................

And when i use it, the error is
Line 822: Bad argument #1 to 'player' (number expected, got nil)
1
2
3
4
5
6
7
8
function explosion(x, y, size, damage, id)
     for _, m in ipairs(MONSTERS) do
          if math.sqrt((m.x-player(id,'x'))^2+(m.y-player(id,'y'))^2) <= size then  -- line 822
               m:damage(id, math.floor(damage*math.random(60,140)/100), 251)
          end
     end
     parse("explosion " .. x .. " " .. y .. " " .. size .. " " .. damage .. " " .. id)
end

I just learn lua script about 2 month so i suck at it....
edited 1×, last 31.08.10 09:38:32 pm

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
MSek has written
who can make me script for this:
random people at round start has menu:
title - MENU
buttons: 1,2,3
plz help!


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
addhook("startround","randomstart")
function randomstart()
	for id = 1,32 do
		if (player(id,"exists")) then
			local randomuser = math.random(0, 2)
			if randomuser==1 then
				randomact(id)
			elseif randomuser==2 then
				-- dont put anything here
			end
		end
	end
end

function randomact(id)
	menu(id,"Title Menu,Button 1,Button 2,Button 3")
end

addhook("menu","randommenu")
function randommenu(id,title,button)
	if title=="Title Menu" then
		if button==1 then
			-- whatever 1
		elseif button==2 then
			-- whatever 2
		elseif button==3 then
			-- whatever 3
		end
	end
end

this is for many users, but if you want for one user tell me

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
its not work
i give your script and help me
wolfen.lua
its general script
axiss< TT classes dont work but ct works
allies< CT
axis<Functions
LINK:
∗http://www.speedyshare.com/files/24061925/help_me.rar

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
More >


ops there will be the smillies

change it to

8 ) without space
edited 4×, last 31.08.10 10:58:59 pm

old Re: Lua Scripts/Questions/Help

KenVo
User Off Offline

Quote
@HaRe Could you help me with this

Spoiler >

thank you

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("hit","healammo")
function healammo(victim,source,weapon)
     if player(victim,"team") == player(source,"team") then
          if weapon == 75 then
               parse("spawnitem 65 "..player(source,"tilex").." "..player(source,"tiley"))
               return 1
          elseif weapon == 86 then
               parse("spawnitem 61 "..player(source,"tilex").." "..player(source,"tiley"))
               parse("spawnitem 62 "..player(source,"tilex").." "..player(source,"tiley"))
               return 1
          end
     end
end
can make where explode snowball or gutbomb make this item on this tile?

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
@KenVo idk if this was what u meant

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

explodetime = Array(32)
expy = Array(32)
expx = Array(32)
haswritten = Array(32)
expid = Array(32)

addhook("say","saya")
function saya(id,t)
	if t=="!a" then
		explodetime[id]=0
		expx[id]=player(id,"x")
		expy[id]=player(id,"y")
		expid[id]=id
		haswritten[id]=1
		parse("explosion "..expx[id].." "..expy[id].." 10 0 "..expid[id])
		return 1
	end
end

addhook("second","explodesec")
function explodesec()
	for id = 1,32 do
		if (player(id,"exists")) then
			explodetime[id]=explodetime[id]+1
			if explodetime[id]==2 and haswritten[id]==1 then
				expx[id]=player(id,"x")
				expy[id]=player(id,"y")
				parse("explosion "..expx[id].." "..expy[id].." 10 0 "..expid[id])
				haswritten[id]=0
			end
		end
	end
end

but its the basic as you said

it explodes when you say !a after 2 sec it explodes again

@Soja explain more i cant understand ^^^

btw i gtg now so ill check tommorow

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
[code]
function admms(id)
     if (player(id,"maxhealth")==250) then
          parse("sethealth "..id.." 250")
          parse("setmaxhealth "..id.." 250")
     end
end
[code]

"Bad argument #1 to "player" ( number expected got nil )
To the start Previous 1 2246 247 248338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview