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 2263 264 265338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
FiiD hat geschrieben
Hey Snake_Eater...the script you gave me dont works...thanks that you tried to help me but it dont works...can be something other wrong now on my script...Im not sure...I hope someone can help me...


1
2
3
4
5
addhook("hit","freeze") function freeze(id,source,weapon,hpdmg,apdmg)
	if weapon==50 then 
		parse("speedmod "..id.." -100") return 1
	end
end

alt .YeaH.

FiiD
User Off Offline

Zitieren
...It dont works...thank you HaRe why you tried to help me but it cant...when I get a hit from anything I be freezed...but I want just to get a freeze when I get a hit from the knife...if you dont trust me than please check it out if you got time...

alt .YeaH.

FiiD
User Off Offline

Zitieren
It WOKRS!!! Thank you HaRe and Snake_Eater!!! I had the old script written in server.lua and I forgot to change it...so it dont worked and I saw that and changed and it works!!!
Thank you really much...

Edit: what do the return 1 in the script HaRe??? Do it return the speedmod to 0 back...if than its good...

alt Re: Lua Scripts/Questions/Help

Jynxxx
User Off Offline

Zitieren
can someone help me with this script it has an error it say
LUA ERROR: sys/lua/cs2dtibia/monsters.lua:9: unexpected symbol near '='

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
{
			name = 'Bulbasaur', health = 100, image = 
'gfx/weiwen/pokemon/1.png', scalex = 2, scaley = 2, r = 136, g = 224, b = 32, 
		atk = 1.9, def = 2.1, spd = 6, atkspd = 8, x = 

0, y = 0, ang = 0, imgang = 0, spawnchance = 5, runat = 10, 
		exp = 15, money = 100, loot = {chance = 5000, 

id = 102}}, {chance = 50, id = 221}}, spawn1 = {0, 100}, 

spawn2 = {150, 150}, 
		spc = {1500, function(self) 
			radiusmsg("Bulbasaur casts heal!", 

self.x, self.y)
			parse("effect \"colorsmoke\" " .. 

self.x .. " " .. self.y .. " 5 5 255 255 255")
		end}, 
	}, 
	{							

		 name = 'Scyther', health = 200, image = 

'gfx/pokemon/123.png', scalex = 1, scaley = 1, 
		atk = 20, def = 25, spd = 10, atkspd = 8, x = 

0, y = 0, ang = 0, imgang = 0, spawnchance = 2000, runat = 10 	

	exp = 1000, money = 5000, loot = {{chance = 1000,id = 

307}, {chance = 1000, id = 327}}, spawn1 = {0, 100, spawn2 = 

{150, 150}, 
		spc = {1500, function(self, id, dist)
			if dist <= 96 then
				radiusmsg("Scyther uses 

razorleaf!",self.x, self.y)				
				self:hit(id, 20)
		        end  
		end},
	},

alt Re: Lua Scripts/Questions/Help

J4x
User Off Offline

Zitieren
Hi guys i need help with this..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("spawn3") 
 function spawn3(id) 

addhook("spawn4") 
 function spawn4(id) 
	if(weapon...id...30) then        
          freeimage(id)
          id1=image("gfx/light.png",1,1,200+id)  								
            imageblend(id,1)								
		imagealpha(id,0.5)								
          if (player(id,"team") == 2) then 
               imagecolor(id1,255,255,255) 
                
          elseif (player(id,"team") == 1) then 
               imagecolor(id1,255,255,255) 
          end 

end

alt Re: Lua Scripts/Questions/Help

Brandy
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("spawn3") 
function spawn3(id) 

addhook("spawn4") 
function spawn4(id) 
     if("weapon "..id.." 30")then 
freeimage(id)
id1=image("gfx/light.png",1,1,200+id)                                         
imageblend(id,1)                                        
          imagealpha(id,0.5)                                        
if(player(id,"team")==2)then 
imagecolor(id1,255,255,255) 

elseif (player(id,"team")==1)then 
imagecolor(id1,255,255,255) 
end
end
end 
end

now it will work look you do this:
1
if (player(id,"team")==2) then
Whats the mistake? The space at then.

1
if (player(id,"team") == 2) then
Look there are many spaces...
So then I correct it

alt .YeaH.

FiiD
User Off Offline

Zitieren
Thank you HaRe...you are really helpfull...I need that function when I get freezed than in 5 seconds I be unfreezed...and can you say me if there is one function for teamkills...I want to make a script that when youu get a hit with knife from your team player than you dont be freezed...

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
FiiD hat geschrieben
Thank you HaRe...you are really helpfull...I need that function when I get freezed than in 5 seconds I be unfreezed...and can you say me if there is one function for teamkills...I want to make a script that when youu get a hit with knife from your team player than you dont be freezed...


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

freeze = initArray(32)

addhook("join","rfreeze") function rfreeze(id)
	freeze[id]=0
end

addhook("hit","freeze") function freeze(id,source,weapon,hpdmg,apdmg)
	if weapon==50 then -- if knife
		if (player(id,"team") == player(source,"team")) then -- If player hitter is your team
			--
		else
			freeze[source]=0
			parse("speedmod "..source.." -100")
			return 1
		end
	end
end

addhook("second","freezeun") function freezeun()
	for id = 1,32 do
		if (player(id,"exists")) then
			freeze[id]=freeze[id]+1
			if freeze[id]==5 then
				parse("speedmod "..id.." 0")
				msg2(id,"You are unfreezed")
			end
		end
	end
end

alt Question

sixpack
User Off Offline

Zitieren
Okay! Here's my question:

I saw the whisper script in some servers.
I wonder, how to make a script like that so when you say
!whisper 'pid' 'message' to send an msg2 to the player with this id.

Also, can I make it work with cmd too?

alt Re: Lua Scripts/Questions/Help

Surplus
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
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","msgto")
function msgto(id,txt)
	_msg=totable(txt)
	_t1=tostring(_msg[1])
	if (_t1=="!whisper") then
		_t2=tonumber(_msg[2])
		_t3=string.sub(txt,10)
		if (_t2 ~= nil) then
			msg2(_t2,"©000150255From "..player(id,"name").." : ".._t3.."@C")
			msg2(id,"©000255150To "..player(id,"name").." : ".._t3.."@C")
		end
return 1
	end
end

This should to the trick

alt Tibia RPG

byengul
User Off Offline

Zitieren
hi i've loaded this mod to my server and i wanted to restart for activating mode but it does not restarting. i mean how can i apply this mod to my server? sorry for my bad english..

alt Re: Lua Scripts/Questions/Help

sixpack
User Off Offline

Zitieren
tiiger87 hat geschrieben
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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","msgto")
function msgto(id,txt)
	_msg=totable(txt)
	_t1=tostring(_msg[1])
	if (_t1=="!whisper") then
		_t2=tonumber(_msg[2])
		_t3=string.sub(txt,10)
		if (_t2 ~= nil) then
			msg2(_t2,"©000150255From "..player(id,"name").." : ".._t3.."@C")
			msg2(id,"©000255150To "..player(id,"name").." : ".._t3.."@C")
		end
return 1
	end
end

This should to the trick


I kinda need to modfy this one but I just can't!
Can you please explain it?

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
Hi all
I need a script like a "dayspeakfile" that means If somebody say something then a .txt file open and computer write in "Player ... said:text" and if another say sometihng then the computer leave one line blank and write "Player ... said:text"
again

So that I have at end of day a list with all texts like dayspeak.txt

help pls

Ps:Sorry for my bad english
Zum Anfang Vorherige 1 2263 264 265338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht