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 2266 267 268338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

MasterAsp
User Off Offline

Zitieren
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.

alt Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

Surplus
User Off Offline

Zitieren
iDios hat geschrieben
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

alt Please help!

GreenDevil
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
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: ==, >=, <=, ~=
1× editiert, zuletzt 27.09.10 15:53:38

alt Re: Lua Scripts/Questions/Help

SkullFace
User Off Offline

Zitieren
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 ...

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Caelenn
User Off Offline

Zitieren
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?

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
Nelight hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
BureX hat geschrieben
@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

alt Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Zitieren
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

alt [FIXED]

J4x
User Off Offline

Zitieren
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
6× editiert, zuletzt 29.09.10 22:26:17

alt Re: Lua Scripts/Questions/Help

MasterAsp
User Off Offline

Zitieren
@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.
1× editiert, zuletzt 28.09.10 02:07:59

alt Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Zitieren
MasterAsp hat geschrieben
@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
Zum Anfang Vorherige 1 2266 267 268338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht