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 2266 267 268338 339 Next To the start

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
i have an problem with this script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook("projectile","throwsnowball") function throwsnowball(id,wpn,x,y)
	if wpn==75 then
		parse("spawnitem "..wpn.." "..(x/32).." "..(y/32))
		parse("equip "..id.." 50")
		parse("strip "..id.." 75")
		parse("setweapon "..id.." 50")
		hassnowball=0
	end
end

addhook("ms100","checksnowball") function checksnowball()
	if hassnowball==0 then
		if (item(75,"exists")) then
			--
		else
			parse("equip "..id.." "..math.random(1,game("sv_maxplayers"))
			parse("strip "..id.." 50")
			parse("setweapon "..id.." 75")
			hassnowball=1
		end
	end
end

i want if you throw an snow ball on the wall it dosent spawns there it spawns in the arena

old Re: Lua Scripts/Questions/Help

MasterAsp
User Off Offline

Quote
And question towards others, how can I get a screen x y position of a person on my screen? @Hare, second hook is redundant, as you could just give 10 snowballs when the person spawns, and whenever someone throws a snowball, just equip them. So, besides that, I don't exactly get what your saying, but, if you want it to spawn where the person threw it, just change x/32 and y/32 to player(id,"x")/32 and player(id,"y")/32.

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Quote
@Burex try this:
1
2
3
4
addhook("kill","no_money")
function no_money(id)
	parse("setmoney "..id.." "..(player(id,"money")-290))
end

old Re: Lua Scripts/Questions/Help

Surplus
User Off Offline

Quote
iDios has written
Lol, I don't understand tiiger87, you want make a deal ?!
And i have my RP lua, i just want the save !
What is your pseudo in game ?
...


its like wfws one, only with different design
and i didnt copy it
And yes, i want to make a deal

cookie lololol COOKIES! cookie

old Please help!

GreenDevil
User Off Offline

Quote
I don't get it, i getting an error.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
team1 = 0
addhook("second","on")
function on(id,)
if (team1=1) then
msg(id,"hello world!")
end
end

addhook("say","makeon")
function makeon(id,txt)
if (txt=="!hello") then
team1 = 1
end
end

old Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
team1 = 0
addhook("second","on")
function on()
	if (team1==1) then
		msg("hello world!") -- for msg that see it one player: msg2(id,"hello world!")
	end
end

addhook("say","makeon")
function makeon(id,txt)
	if (txt=="!hello") then
		team1 = 1
	end
end

in if you must use only: ==, >=, <=, ~=
edited 1×, last 27.09.10 03:53:38 pm

old Re: Lua Scripts/Questions/Help

Casper-
User Off Offline

Quote
my god ! what have i done here wrong now ?
1
2
3
4
5
6
7
if (x == 35 and y == 13) then
		local money = player(id,"money")
        	if money>999 then
		parse("setmoney "..id.." "..(player(id,"money") - 1000))
		end
	end
end
doors open even if i didnt had 1000 $ money ...

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
1
2
3
4
5
if (player(id,'tilex') == 35 and player(id,'tiley') == 13) then
	if player(id,"money")>=1000 then
		parse("setmoney "..id.." "..(player(id,"money") - 1000))
	end
end

think this should work

old Re: Lua Scripts/Questions/Help

Caelenn
User Off Offline

Quote
I have got a question.When I write a word,I want do make
a colored word.For example:
msg2(id,"©160160255Current Class: Infantry")
there is a number how can i know the color of this number in text?

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
Nelight has written
I have got a question.When I write a word,I want do make
a colored word.For example:
msg2(id,"©160160255Current Class: Infantry")
there is a number how can i know the color of this number in text?


map editor -> Create an msg -> Change color ->
RED = First 000
GREEN = Secound 000
BLUE = Third 000

so theres 9 numbers

if you want it to be green then do this

1
000255000

Red is the first and has no color to mix with
Green is the secound which is 255, 255 = the max value of the colours so it will be fully green
As in the red the Blue has no color to mix with since we wanted to have an green color

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
BureX has written
@Yasday
doesnt work ...

pic 1.
IMG:https://i51.tinypic.com/ivg22v.jpg

~~~
pic 2.
IMG:https://i55.tinypic.com/2j5bggh.jpg


omg

1
2
3
4
5
6
if (x == 35 and y == 13) then
     if (player(id,"money")>999) then
          parse("setmoney "..id.." "..(player(id,"money") - 1000))
          end
     end
end

old Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Quote
I'm trying to make a script that you kill a zombie (NPC) and you get money (300), but its doesn't work..

1
2
3
4
addhook("objectkill","npcmoney")
function npcmoney(id,player)
     parse("setmoney "..id.." "..(player(id,"money")+300))
end

old [FIXED]

J4x
User Off Offline

Quote
Help me with this, i make this lua and it suppose that when i press f2 a image should appear, but nothing happens..



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
addhook("serveraction","spawn5")
function spawn5(id,action)
if act == 1 then
freeimage(id)
id1=image("gfx/light.bmp",1,1,200+id)
imagescale(id1,1,1)
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

addhook("buy","spawn2")
function spawn2(id,weapon)
if weapon ==50 then
freeimage(id)
id1=image("gfx/flare2.bmp",0,0,100+id)
imagescale(id1,1,1)
imageblend(id1,1)
imagealpha(id1,0.7)
if (player(id,"team") == 2) then
imagecolor(id1,0,0,0)
elseif (player(id,"team") == 1) then
imagecolor(id1,0,0,0)
end
end
end

FIXED
edited 6×, last 29.09.10 10:26:17 pm

old Re: Lua Scripts/Questions/Help

MasterAsp
User Off Offline

Quote
@Deatherr Your using the object ids id for the money equip, you want to use the second parameter for the setmoney funciton.
1
2
3
4
addhook("objectkill","npcmoney")
function npcmoney(id,player)
parse("setmoney "..player.." "..(player(player,"money")+300))
end

And, I'd also like to ask how to use the string.format function, as I see it as a powerful tool, yet I don't know how to use it.
edited 1×, last 28.09.10 02:07:59 am

old Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Quote
MasterAsp has written
@Deatherr Your using the object ids id for the money equip, you want to use the second parameter for the setmoney funciton.
1
2
3
4
addhook("objectkill","npcmoney")
function npcmoney(id,player)
parse("setmoney "..player.." "..(player(player,"money")+300))
end

And, I'd also like to ask how to use the string.format function, as I see it as a powerful tool, yet I don't know how to use it.


Like I said i'm horrible at script so... idk is my anwser.. thanks for fixing it
To the start Previous 1 2266 267 268338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview