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 2242 243 244338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
batlaizys has written
And how about the second question ? if u answer i give you more. Here for the 1st question. cookie And if i want to add more US ID i have to seperate with comma ?

EDIT : It doesnt work and whats with the rank thingy ? I put my US ID

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("say","membersay")
function membersay(id,t)
     if (player(id,"15476") == USID) then
          if t=="rank" then
               return 0
          else
               msg("©212121023"..player(id,"name").." (Clan Member): "..t)
               return 1 end
     elseif (player(id,"15476") == USID) then
          if t=="rank" then
               return 0
          else
               msg("©212121023"..player(id,"name").." (Clan Member): "..t)
               return 1
          end
     end
end


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("say","membersay")
function membersay(id,t)
     if (player(id,"usgn") == 15476) then
          if t=="rank" then
               return 0
          else
               msg("©212121023"..player(id,"name").." (Clan Member): "..t)
               return 1 end
     elseif (player(id,"usgn") == 15476) then
          if t=="rank" then
               return 0
          else
               msg("©212121023"..player(id,"name").." (Clan Member): "..t)
               return 1
          end
     end
end

Do you wanted to get "player(id,"15476")" ??
because that value doesn't exist. Try

1
player(id,"usgn") == 15476

Read: sys/lua/info.txt

old Re: Lua Scripts/Questions/Help

Kurt Cobain
User Off Offline

Quote
MP-999 has written
can any one please make me a voting lua e.g. 5 different maps and you can choose. Like Counter-Strike 1.6 vote system. thanks!


cany anyone help me please?

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
why it dont work? There isnt any error in console but if i click F2 there isnt counter 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
31
32
33
34
35
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
kamikaze=initArray(32)

addhook("serveraction","kamikaze_button")
function kamikaze_button(id,action)
	if action == 1 then
		kamikaze[id]=1
		parse("speedmod "..id.." 12")
	end
end

addhook("second","kamikaze_timer")
function kamikaze_timer(id)
	if kamikaze[id] == 1 then
		msg2(id,"3@C")
		kamikaze[id]=2
	elseif kamikaze[id] == 2 then
		msg2(id,"2@C")
		kamikaze[id]=3
	elseif kamikaze[id] == 3 then
		msg2(id,"1@C")
		kamikaze[id]=4
	elseif kamikaze[id] == 4 then
		msg(""..player(id,"name").." Uses KAMIKAZE!!!")
		msg2(id,"EXPLOSION!!!@C")
		parse("explosion "..player(id,"x").." "..player(id,"y").." 100 9999 "..id)
		kamikaze[id]=0
	end
end

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
try this
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
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
kamikaze=initArray(32)

addhook("serveraction","kamikaze_button")
function kamikaze_button(id,action)
     if action == 1 then
          kamikaze[id]=1
          parse("speedmod "..id.." 12")
     end
end

addhook("second","kamikaze_timer")
function kamikaze_timer()
for i = 1, 32 do
     if kamikaze[i] == 1 then
          msg2(i,"3@C")
          kamikaze[i]=2
     elseif kamikaze[i] == 2 then
          msg2(i,"2@C")
          kamikaze[i]=3
     elseif kamikaze[i] == 3 then
          msg2(i,"1@C")
          kamikaze[i]=4
     elseif kamikaze[i] == 4 then
          msg(""..player(i,"name").." Uses KAMIKAZE!!!")
          msg2(i,"EXPLOSION!!!@C")
          parse("explosion "..player(i,"x").." "..player(i,"y").." 100 9999 "..i)
          kamikaze[i]=0
     end
end
end

Your mistake:
For the hook second is no id vaule you have to work with for ... to get the vaules with ids working.

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
1
2
3
4
addhook("say","images")
function membersay(id,t)
if (player(id,"usgn") == 13922) then
if t=="!Vip" then
Now goes your image stuff... this should work... I dont know how to correct it if this dont work...

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Soja1997 has written
i dont need this script but now i need reset funciton glow,freeimage on player


reset or remove the image?

for hook 'say' this is example! others thing use your brain.
1
2
3
if (txt == "!remove") then
		freeimage(id)
end

for hook 'serveraction'
1
2
3
if (action == 1) then -- 1 mean for F2/serveraction1
		freeimage(id)
end

old Re: Lua Scripts/Questions/Help

kalis
User Off Offline

Quote
help me
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
addhook ("serveraction","ser")
function ser(id,ac)
if ac==2 then
Picense(id)
end
end

function Picense(id)
menu (id,"License Menu,Set pos,Go pos,drop armor")
end

addhook ("menu","License")
function License(id,menu,sel)
if (menu=="License Menu") then
if sel>=1 and sel<=3 then
Picense(id)
end

          if sel==1 then
               posx[id]=player(id,"x")
               posy[id]=player(id,"y")
               msg2(id,"©000255000Your saved spawnpoint is x:"..posx[id].." y:"..posy[id].." now!@C")
          elseif sel==2 and posy[id]==0 and posx[id]==0 then
               msg2(id,"©000255000 You don't have Position")
          else
               parse ("setpos "..id.." "..posx[id].." "..posy[id])
	  elseif sel==3 and posy[id]==0 and posx[id]==0 then
               msg2(id,"©000255000 You don't @@")
	      end
	end
end
          elseif sel==9 and collect[id]==0 then
               msg2(id,"©000255000Togle Spawn(ON)")
               collect[id]=1
          elseif sel==9 and collect[id]==1 and license[id]==1 then
               msg2(id,"©000255000Togle Spawn(OFF)")
               collect[id]=0
	  elseif sel==9 and posy[id]==0 and posx[id]==0 and license[id]==1 then
		 msg2(id,"©000255000You don't have position")
          end
     end


addhook("walkover","license_collect")
function license_collect(id)
     if collect[id]==1 then
          return 1
     elseif collect[id]==0 then
          return 0
     end
end
why error??? @ @

old Re: Lua Scripts/Questions/Help

Doctor Freeman
User Off Offline

Quote
anybody can help me make this npcs for my map Red letter day..

>Alyx Vance
>Barney Calhoun
>Isaac Kleiner
>Lamarr
>Eli Vance

Sorry about this favor guys, because my red letter day map was finished, but all I need is some npcs

for this map Red Letter day

old Re: Lua Scripts/Questions/Help

KenVo
User Off Offline

Quote
I need some help with my mana system in my tibia script
when i have under 100 mana and when i quit then rejoin the server, my mana will me glitched and i'm not gaining mana any more

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
addhook("second","EXPsecond")
function EXPsecond()
	updateTime()
	for _, id in ipairs(player(0, 'table')) do
		iterator[id] = iterator[id] + 1
		if player(id, 'health') > 0 and PLAYERS[id] then
			setscore(id, PLAYERS[id].Level)
			setdeaths(id, id)
		end
		if PLAYERS[id] and PLAYERS[id].x then
			local tile = gettile(PLAYERS[id].x, PLAYERS[id].y)
			if tile.HEAL and ((tile.HEAL > 0 and tile.HOUSE) or (tile.HEAL < 0 and not tile.SAFE)) and PLAYERS[id].tmp.hp > PLAYERS[id].HP then
				PLAYERS[id].HP = player(id, "health") + math.min(10, tile.HEAL)
				sethealth(id, PLAYERS[id].HP)
			end
		end
	if iterator[id] == 2 then
		if PLAYERS[id].Class then
			if PLAYERS[id].Class == "Magician" then
				if PLAYERS[id].Mana < 100 then
					PLAYERS[id].Mana = PLAYERS[id].Mana + 10
				end
			else
				if PLAYERS[id].Mana < 100 then
					PLAYERS[id].Mana = PLAYERS[id].Mana + 1
				end
			end
			updateHUD(id)
			end
			iterator[id] = 0
		end
	end
end

please help

old Re: Lua Scripts/Questions/Help

kalis
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("second","kamikaze_timer")
function kamikaze_timer()
for i = 1, 32 do
if kamikaze[i] == 1 then
kamikaze[i]=2
parse('effect "smoke" ' ..player(i,"x").. ' ' ..player(i,"y").. ' 50 200 0 25 255')
elseif kamikaze[i] == 2 then
kamikaze[i]=3
parse('effect "smoke" ' ..player(i,"x").. ' ' ..player(i,"y").. ' 50 200 0 25 255')
elseif kamikaze[i] == 3 then
kamikaze[i]=4
parse('effect "smoke" ' ..player(i,"x").. ' ' ..player(i,"y").. ' 50 200 0 25 255')
elseif kamikaze[i] == 4 then
parse('effect "smoke" ' ..player(i,"x").. ' ' ..player(i,"y").. ' 50 200 0 25 255')
kamikaze[i]=0
x=player(i,"x")
y=player(i,"y")
parse("spawnitem 68 "..(x-32).." "..(y-32))
end
end
end
help why no spawn item
?? position out maps help pls!
To the start Previous 1 2242 243 244338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview