Forum
Scripts
Sammelthread/FAQ zu Lua & Editor1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook ("use","usen")
function usen(id)
if (player(id,"tilex")==x and player(id,"tiley")==y) then
menu (id,"shop,eine deagle|500$")
end
end
addhook ("menu","meno")
function meno(id,menoo,sel)
if (menoo=="shop" and sel==1) then
if (player(id,"money")>=500) then
parse ("equip "..id.." 3");
parse ("setmoney "..id.." "..(player(id,"money")-500));
else
msg2(id,"©255000000du hast nicht genug geld");
end
end
end
ich werde auf bug suche gehen ; )
Ach ich habe dazu noch ne frage Schinken
muss ich diesen Lua Script verdoppeln oder gild das dann für alle shops ? oder hengt das vom Trigger_use Name ab ?
dies gild nur für einen shop.
Aber ich habe ne frage ich habe hinbekommen das ich 2 Items in der Menu liste stehen habe, aber nur das erste zieht mir geld ab und wenn ich aufs 2 klicke bekomme ich keine Kevlar und kein geld abgezogen, was mache ich falsch. ?
Hir mein Code:
addhook ("use","usen")
function usen(id)
if (player(id,"tilex")==130 and player(id,"tiley")==18) then
menu (id,"shop,Tactical shild|520$,Kevlar|350$")
end
end
addhook ("menu","meno")
function meno(id,menoo,sel)
if (menoo=="shop" and sel==1) then
if (player(id,"money")>=520) then
parse ("equip "..id.." 41");
parse ("setmoney "..id.." "..(player(id,"money")-520));
else
msg2(id,"©255000000Du hast nicht genug geld");
end
end
end
könntest du mir hirbei etwas helfen ?
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
addhook("parse","mparse")
function mparse(cmd)
if(string.sub(cmd,1,10)=="file_write") then
		local file=io.open("lol.txt","r")
		io.write(string.sub(cmd,12,string.len(cmd)))
		print("©255255255 Wrote in file: "..(string.sub(cmd,12,string.len(cmd))))
		return 1
	end
end
@Nexos
Du musst natürlich auch gucken ob Kevlar ausgewählt wurde^^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook ("use","usen")
function usen(id)
if (player(id,"tilex")==130 and player(id,"tiley")==18) then
menu (id,"shop,Tactical shild|520$,Kevlar|350$")
end
end
addhook ("menu","meno")
function meno(id,menoo,sel)
if (menoo=="shop" and sel==1) then
if (player(id,"money")>=520) then
parse ("equip "..id.." 41");
parse ("setmoney "..id.." "..(player(id,"money")-520))
else
msg2(id,"©255000000Du hast nicht genug geld");
end
end
if(menoo=="shop" and sel==2 and player(id,"money")>=500) then
parse("equip "..id.." 57")
parse("setmoney "..id.." "..(player(id,"money")-500))
end
end
die datei wird nicht bei dem script geschrieben,sondern bei der .exe(in dem ordner)
frag einfach mal blazz.
das 2te Funkt
wie mache ich das ich 2 shops in eine lua rein mache ?
was muss ich da hinzufügen.
Code:
addhook ("use","usen")
function usen(id)
if (player(id,"tilex")==34 and player(id,"tiley")==174) then
menu (id,"shop,Tactical shild|520$,Kevlar|350$")
end
end
addhook ("menu","meno")
function meno(id,menoo,sel)
if (menoo=="shop" and sel==1) then
if (player(id,"money")>=520) then
parse ("equip "..id.." 41");
parse ("setmoney "..id.." "..(player(id,"money")-520));
else
msg2(id,"©255000000Du hast nicht genug geld");
end
end
if(menoo=="shop" and sel==2 and player(id,"money")>=350) then
parse("equip "..id.." 57")
parse("setmoney "..id.." "..(player(id,"money")-350))
end
end
edited 5×, last 10.03.10 05:57:24 am
Das ist jetzt nur dein jetziger Shop-Code, nur mit Erklärungen und ein bisschen umgeschrieben
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
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
function gmoney(id) --Funktion,welche das Vermögen eines Spielers angibt
return player(id,"money")
end
addhook ("use","usen")
function usen(id) --Wenn etwas benutzt wird (e)
	if (player(id,"tilex")==34 and player(id,"tiley")==174) then --Wenn tileX=34 und tileY = 174 ist
		menu (id,"shop,Tactical shild|520$,Kevlar|350$") --Zeige ein Menu ("shop" ist der Name vom Menu)
	end
end
addhook ("menu","meno")
function meno(id,menoo,sel)
	if (menoo=="shop") then --Wenn das Menu den Namen "shop" hat
		if(sel==1) then --Wenn die erste Auswahl genommen wurde
			if(gmoney(id)>=520) then --Wenn das Geld ausreicht
				parse ("equip "..id.." 41"); --Gib den Gegenstand
				parse ("setmoney "..id.." "..(gmoney(id)-520)); --Ziehe das Geld ab
			else --Wenn nicht genug Geld vorhanden ist
				msg2(id,"©255000000Du hast nicht genug geld"); --erklärt sich selbst
		end
end
	if(sel==2 ) then --Wenn das zweite ausgewählt wurde
		if(gmoney(id)>=350) then --Wenn das Geld reicht
			parse("equip "..id.." 57") --Gib den Gegenstand
			parse("setmoney "..id.." "..(gmoney(id)-350)) --Ziehe das Geld ab
		else
			msg2(id,"©255000000 Du hast nicht genug Geld!") --erklärt sich selbst
		end
	end
end
Ok, hab ein Problem, ich will nähmlich die lua-Scripts neuladen ,während der Server läuft!
Also ohne das der Server restartet werden muss,da sonst viele nicht mehr raufjoinen. -.-
EDIT: Das war kein push, hab nur ausversehen vergessen das Häkchen bei "Als neu markieren" wegzumachen
edited 4×, last 11.03.10 02:31:19 pm
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
function werbung.join(p)
... (unwichtiger teil)
	 if (p == 1) then
	 freeimage(p)
id1=image("gfx/absol/admin.png",1,1,200+p)
imagescale(id1,1,1)
imageblend(id1,0)
imagealpha(id1,1.0)
	 end
end
Oder was funktioniert nicht?
Was willst du mit dem Script erreichen?
Vielleicht ist der Fehler im unwichtigem Teil....
der unwichtige teil funktioniert, da es eig das sample.ads ist, halt nur mit werbung die ich hier nicht zeigen wollte.
in der konsole steht leider nichts, sonst hätte ich das schon genannt.
weil beim joinen das player model noch nicht da ist,und dieser daher keine x und y pos hat.
1
2
3
4
5
2
3
4
5
spawn(id)						on spawn -id: player id >return:	"" - (nothing) spawn with regular items 		"x" - spawn with melee weapon only 		"typeid,typeid,..." - spawn with these items + melee
bei "x" steht nicht,das es x/y pos. zurückgibt. oder versteh ich da was falsch?
EDIT: doch ich habs grad verstanden wie du es meinst, ich teste es mal
EDIT2: ok wenn ich das jetzt einbaue und den server starte und dann spawne stürzt das Spiel ab:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
addhook("spawn","admin.join")
function admin.join(p)
	 if (p == 1) then
	 freeimage(p)
id1=image("gfx/absol/admin.bmp",1,1,200+p)
imagescale(id1,1,1)
imageblend(id1,0)
imagealpha(id1,1.0)
	 end
end
edited 1×, last 12.03.10 12:46:12 pm
1
freeimage(p)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
addhook ("spawn","span")
function span(id)
if (id == 1) then
freeimage(iid)
iid=image("gfx/absol/admin.bmp",1,1,200+p)
imagescale(id1,1,1)
imageblend(id1,0)
imagealpha(id1,1.0)
end
end
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
iid=image("gfx/absol/admin.bmp",1,1,200+p)
freeimage(iid)
addhook ("spawn","span")
function span(id)
	if (id == 1) then
		freeimage(iid)
		iid=image("gfx/absol/admin.bmp",1,1,200+p)
		imagescale(id1,1,1)
		imageblend(id1,0)
		imagealpha(id1,1.0)
	end
end
Kann mir jemand eine Lua machen, dass wenn 2 Hostages "died" die tt gewonnen haben, und wenn ein tt mehr als ein Hostages killt, der die nächste Spielrunde bestraftwied, indem er stirbt. Ist das möglich?
Danke im voraus
Sammelthread/FAQ zu Lua & Editor


Offline