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 2275 276 277338 339 Next To the start

old Help with "talk" Lua

gear
User Off Offline

Quote
Hello!
I'm looking for a lua script make talking in a radius, like the Tibia script talking idea, with the images popping up above the player! If you have a file like this, or can make one for me, I would be very thankfull.

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Yasday has written
I have a question:
Is it possible to edit the name of an entity with lua?

ye i think so

1
2
3
4
5
6
7
8
addhook("startround","rename") function rename()
local x,y = X,Y -- change X,Y to your x and y
	if (entity(x,y,"exists")) then
		if (entity(x,y,"name") == "NAME") then
			local Namehere = (entity(x,y,"name") == "NAME")
		end
	end
end

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
How do i make text "!shop" dont appear ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","shop")
function shop(id,txt)
if txt == "!shop" then
parse("sv_msg2 "..id.." ©255000000WELCOME TO BATLAIZYS SHOP")
parse("sv_msg2 "..id.." Heal ! (5 Credits) ")
parse("sv_msg2 "..id.." More Health ! (50 Credits) ")
parse("sv_msg2 "..id.." Book for Beginers ! (50 Credits) ")
parse("sv_msg2 "..id.." Book for Players ! (100 Credits)")
parse("sv_msg2 "..id.." Book for Skillerz ! (200 Credits)")
parse("sv_msg2 "..id.." Book for Masters ! (500 Credits) ")
parse("sv_msg2 "..id.." ©255000000WELCOME TO BATLAIZYS SHOP")
	return 1
end
end

Thank you for your help

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
Unknown Killer has written
how do i use map command in lua script i mean if i have object name "blabla" how do i use this object in lua

is this possible?


if you want to disable a trigger use then do it like this:
1
2
3
4
addhook([[startround]],[[startbutton]])
function startbutton(id)
	parse("trigger NAME_OF_BUTTON_OR_STH_ELSE")
end

old oO

Rainoth
Moderator Off Offline

Quote
@Tajifun I DID use one say hook cant you see ?

old Re: Lua Scripts/Questions/Help

Unknown Killer
User Off Offline

Quote
batlaizys has written
@Tajifun I DID use one say hook cant you see ?


check your script if there is any other say remove it and will work, this happened to me also but i put the codes in 1 say and works fine

Edit:

@yasday

the codes works fine but how do i make if player at "object name" then display a msg?

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
Wow this is not "The Love thread :D"

Anyway how do i make other things in 1 say hook ?

example
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
addhook("say","shop")
function shop(id,txt)
if txt == "!shop" then
parse("sv_msg2 "..id.." ©255000000WELCOME TO BATLAIZYS SHOP")
parse("sv_msg2 "..id.." Heal ! (5 Credits) ")
parse("sv_msg2 "..id.." More Health ! (20 Credits) ")
parse("sv_msg2 "..id.." Book for Beginers ! (50 Credits) ")
parse("sv_msg2 "..id.." Book for Players ! (100 Credits)")
parse("sv_msg2 "..id.." Book for Skillerz ! (200 Credits)")
parse("sv_msg2 "..id.." Book for Masters ! (500 Credits) ")
parse("sv_msg2 "..id.." ©255000000WELCOME TO BATLAIZYS SHOP")
	return 1
end
end



addhook("say","resetsay")
function resetsay(id,txt)
if txt == "!reset" then
parse("sv_msg2 "..id.." You have reset your stats !")
level[id]=0
exp[id]=0
	return 1
end
end

should i do it

1
2
3
4
5
if txt == "haha!" then
blabla...
elseif
txt == "lolz" then 
blabla2.
Should i do it like i did now ?

old Re: Lua Scripts/Questions/Help

Unknown Killer
User Off Offline

Quote
@batlaizys

try this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("say","blabla")
function blabla(id,txt)
if txt == "!shop" then
parse("sv_msg2 "..id.." ©255000000WELCOME TO BATLAIZYS SHOP")
parse("sv_msg2 "..id.." Heal ! (5 Credits) ")
parse("sv_msg2 "..id.." More Health ! (20 Credits) ")
parse("sv_msg2 "..id.." Book for Beginers ! (50 Credits) ")
parse("sv_msg2 "..id.." Book for Players ! (100 Credits)")
parse("sv_msg2 "..id.." Book for Skillerz ! (200 Credits)")
parse("sv_msg2 "..id.." Book for Masters ! (500 Credits) ")
parse("sv_msg2 "..id.." ©255000000WELCOME TO BATLAIZYS SHOP")
     return 1
	 elseif txt == "!reset" then
parse("sv_msg2 "..id.." You have reset your stats !")
level[id]=0
exp[id]=0
     return 1
end
end

old KnockieBackDack

hyh2
COMMUNITY BANNED Off Offline

Quote
Hello.

I'm good writing in LUA, made carmod with my friend and...
i dont still understand how knockback works. So if someone can code one for me? Example. 1 hit = 1 step back, 2 hit = 2 step back...

I'll will be very happy, and giving Admin to my Carmod server.cookie

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
@hyh2 it?:
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
recoil_factor = 3

addhook('hit','knockback')
function knockback(id,source,weapon)
local killer_x = player(source,'x')
local killer_y = player(source,'y')
local victim_x = player(id,'x')
local victim_y = player(id,'y')
local recoil = itemtype(weapon,'recoil') * recoil_factor
	if player(source,'exists') then
		if killer_x > victim_x then 
			if tile(player(id,'tilex') - 1,player(id,'tiley'),'walkable') then
				parse('setpos '..id..' '..(player(id,'x') - recoil)..' '..player(id,'y')) 
			end
		end
		if killer_x < victim_x then 
			if tile(player(id,'tilex') + 1,player(id,'tiley'),'walkable') then
				parse('setpos '..id..' '..(player(id,'x') + recoil)..' '..player(id,'y')) 
			end
		end
		if killer_y > victim_y then
			if tile(player(id,'tilex'),player(id,'tiley') - 1,'walkable') then
				parse('setpos '..id..' '..player(id,'x')..' '..(player(id,'y') - recoil)) 
			end
		end
		if killer_y < victim_y then 
			if tile(player(id,'tilex'),player(id,'tiley') + 1,'walkable') then
				parse('setpos '..id..' '..player(id,'x')..' '..(player(id,'y') + recoil)) 
			end
		end	
	end
end

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
Why this "no super supply" script dont work?
1
2
3
4
5
6
7
8
addhook("objectdamage","no_super_supply")
function no_super_supply(id,dmg,wpn,object)
	if object == 9 then
		if dmg == 0 then
			return 1
		end
	end
end

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Because it was written by someone who obviously can't read his info.txt file in his lua folder
1
2
3
4
5
6
7
8
addhook("objectdamage","no_super_supply")
function no_super_supply(id,dmg,pl)
	if object(id,"type") == 9 then
		if dmg == 0 then
			return 1
		end
	end
end

old Re: Lua Scripts/Questions/Help

head600
BANNED Off Offline

Quote
addhook("hit","healgun")
function healgun(id)
if level[id] >= 4 then
local x, y
x = player( id, "x")
y = player( id, "y")
           parse('effect "fire" ' ..x.. ' ' ..y.. ' 1 1 0 0 0')
           parse("sethealth "..id.." "..(player(id,"health")-7))
end
end          

what wrong??

error = level < 4 and if you shot enemy your shots are explosive

normal = level > 4 and if you shot enemy your shots are explosive (i need this)

i need help
To the start Previous 1 2275 276 277338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview