Forum

> > CS2D > Scripts > Sammelthread/FAQ zu Lua & Editor
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Deutsch Sammelthread/FAQ zu Lua & Editor

1.111 Antworten
Seite
Zum Anfang Vorherige 1 249 50 5155 56 Nächste Zum Anfang

alt Re: Sammelthread/FAQ zu Lua & Editor

TimeQuesT
User Off Offline

Zitieren
1
[15:04:58] LUA ERROR (ai_hear_chat): attempt to call a nil value
?

das ist ein Fehler aus dem botscript.Hast du irgendetwas an den Bots verändert ,oder hast du dein folgendes script darein geschrieben?

alt BITTETTETETE HILFE

Edik
User Off Offline

Zitieren
Hi, wollte fragen wie man abfragt ob man auf einen bestimmten Entity area steht oder nicht. will nämlich das man wenn man auf einem no buildings area steht , etwas nicht machen kann.

hab zwar das gefunden:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[ENTITY]
- entity(x,y,"value")		Return a value of an entity at the tile position (X|Y):
				exists, typename, type, name, trigger, state, int0, int1,
				int2, int3, int4, int5, int6, int7, int8, int9, str0, str1,
				str2, str3, str4, str5, str6, str7, str8, str9, aistate
				(int0-9 and str0-9 are used for entity settings and are
				different for each entity type)

- randomentity(type,[ai],[i0])	Returns the tile x and y position (2 values!) of a random entity
				of a certain type or -100,-100 if no entity has been found.
				ai=only find entities with this AI state (-1 to ignore)
				i0=only find entities with this int0 value (-1 to ignore)

- inentityzone(x,y,type)	Checks if the tile position (x|y) is in the area of a certain
				entity type and returns true or false

weiß aber nicht wie ich es anwenden soll! und welche value no buildings hat.

Es sollte ungefähr so aussehen:
1
2
3
4
5
function(x,y,Info.Nobuildings)
if Info.Nobuildings then
--CODE
end
end

alt Re: Sammelthread/FAQ zu Lua & Editor

Yasday
User Off Offline

Zitieren
@Nexmann
1. dieser script ist nicht von dir!
2. wenn du dass machen wilst entweder im dateiarchiv meine lua "CT Wallhack" laden und dann dieses adminlist zeug kopieren
3. dass ist nicht schwer und wer ein rp script den du gepostet hast machen kann der kann das auch leicht machen!
4. und nochmal dieser script ist NICHT von dir! sag nicht dass es deiner ist!
1× editiert, zuletzt 31.10.10 21:38:07

alt Re: Sammelthread/FAQ zu Lua & Editor

beckerchen
User Off Offline

Zitieren
Yasday hat geschrieben
@Nexmann
1. dieser script ist nicht von dir!
2. wenn du dass machen wilst entweder im dateiarchiv meine lua "CT Wallhack" laden und dann dieses adminlist zeug kopieren
3. dass ist nicht schwer und wer ein rp script den du gepostet hast machen kann der kann das auch leicht machen!
5. und nochmal dieser script ist NICHT von dir! sag nicht dass es deiner ist!

ähhhm sry da fehlt 4.

alt Re: Sammelthread/FAQ zu Lua & Editor

Yasday
User Off Offline

Zitieren
beckerchen hat geschrieben
Yasday hat geschrieben
@Nexmann
1. dieser script ist nicht von dir!
2. wenn du dass machen wilst entweder im dateiarchiv meine lua "CT Wallhack" laden und dann dieses adminlist zeug kopieren
3. dass ist nicht schwer und wer ein rp script den du gepostet hast machen kann der kann das auch leicht machen!
5. und nochmal dieser script ist NICHT von dir! sag nicht dass es deiner ist!

ähhhm sry da fehlt 4.


lol oops mein fehler editier ich gleich

alt Re: Sammelthread/FAQ zu Lua & Editor

DeKat
User Off Offline

Zitieren
Nexmann wenn es dein script ist warum weisst du es dann nicht?

//Edit: Es muss ein Admin PW geben sonst stände im script nicht das:

1
2
3
4
5
6
7
8
9
10
11
12
elseif sel == 6 then
      rp_msg2(id,"000255000","[RP] Command: !bring <player>")
      rp_msg2(id,"000255000","[RP] Command: !goto <player>")
      rp_msg2(id,"000255000","[RP] Command: !rp_arrest <player>")
      rp_msg2(id,"000255000","[RP] Command: !rp_free <player>")
      rp_msg2(id,"000255000","[RP] Command: !rp_give_money <player> <money>")
      rp_msg2(id,"000255000","[RP] Command: !rp_admin <password>")
      rp_msg2(id,"000255000","[RP] Command: !parse <command>")
      rp_msg2(id,"000255000","[RP] Command: !createt <player>")
      rp_msg2(id,"000255000","[RP] Command: !createct <player>")
    elseif sel == 7 then
      menu(id,[[CT Menu Props,]]..udp_scar(id)

alt Re: Sammelthread/FAQ zu Lua & Editor

ThunderByte
User Off Offline

Zitieren
TimeQuesT hat geschrieben
[15:04:58] LUA ERROR (ai_hear_chat): attempt to call a nil value --> dieser Fehler kommt nur ,wenn die funktion ai_hear_chat. Nicht definiert ist.


thx für alle antworten da oben^^
aber wie definiere ich ai_hear_chat?

alt Re: Sammelthread/FAQ zu Lua & Editor

244453211332112
User Off Offline

Zitieren
Wie ändere ich das "F2" um, damit es den Buchstaben M bekommt?

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
function initArray(size,value)
     local t = {}
     for i=1, size do
          t[i] = value
     end
     return t
end

hasgasmask = initArray(32,0)
gasmaskid = initArray(32,0)

addhook("startround","_startround")
function _startround()
     for i=1,32 do --Loop thru all possible ids
          if player(i,"exists") and player(i,"team") < 3 and player(i,"team") > 0 then --If the player exists and is T or CT
               if hasgasmask[i] == 1 then --And has bought a gasmask, give him the image of it.
                    local id1=image("gfx/todesengel/gasmask.bmp",1,1,200+i)
                    imagescale(id1,1,1)
                    imageblend(id1,0)
                    imagealpha(id1,1.0)
                    gasmaskid[i] = id1
               end
          else --Else, clear the array just in case
               hasgasmask[i] = 0
               gasmaskid[i] = 0
          end
     end
end


addhook("spawn","gfx")
function gfx(id)
parse("hudtxt 0 \"©255255255Press F2 to buy or drop a gasmask\" 4 102 0")
end


addhook("die","_die")
function _die(id) --Remove gasmask from this player
    if hasgasmask[id]==1 then
		freeimage(gasmaskid[id])
		gasmaskid [id] = 0
		dropmask(id)
	end
end


addhook("serveraction","fmenus")
function fmenus(id,btn)
    if (btn==1) then
          menu(id,"Equip,Gasmask| 1000$, Drop the Gasmask")
    end
end




addhook("hit","gashit")
function gashit(id,source,weapon,hpdmg,apdmg)
     if weapon==72 then -- wenn es die waffe mit der id 72 ist // No gas dmg
          if hasgasmask[id] == 1 then
               return 1
          end
     end
end

addhook ("menu","meno")
function meno(id,menoo,sel)
     if menoo=="Equip" then
          if sel==1 then
               if(player(id,"money")>=1000) then
                    if hasgasmask[id] == 0 then
                         parse("setmoney "..id.." "..(player(id,"money")-1000))
                         local id1=image("gfx/todesengel/gasmask.bmp",1,1,200+id)
                         imagescale(id1,1,1)
                         imageblend(id1,0)
                         imagealpha(id1,1.0)
                         hasgasmask[id] = 1
                         gasmaskid[id] = id1 
                    else
                         msg2(id,"©255000000You already have a gasmask!@C")
                    end
               else
                    msg2(id,"©255000000You dont have enough money for a gasmask!@C")
               end
          elseif sel==2 then
               if hasgasmask[id]==1 then
                    freeimage(gasmaskid[id])
                    gasmaskid [id] = 0
                    dropmask(id)
                    msg2(id,"©255000000You dropped your gasmask!@C")
               else
                    msg2(id,"©255000000You dont have a gasmask!@C")
               end
          end
     end
end


maskpath="gfx/todesengel/gasmask.bmp"
maskitms={}
maskimg={}

addhook("movetile","pickup_itms")
function pickup_itms(id,tx,ty)
     for i=1,#maskitms do
          if maskitms[i]~=nil and maskitms[i].exists and hasgasmask[id]==0 and maskitms[i].x==tx and maskitms[i].y==ty then
               maskitms[i].exists=false
               refreshgfx(i,"gasmask",0)
               hasgasmask[id]=1
               parse("sv_sound2 "..id.." items/pickup.wav")
               local id1=image("gfx/todesengel/gasmask.bmp",1,1,200+id)
               imagescale(id1,1,1)
               imageblend(id1,0)
               imagealpha(id1,1.0)
               gasmaskid[id] = id1 
          end
     end
end
function refreshgfx(id,type,mode)
	local rndrot
	if type=="gasmask" then
		if mode==1 then
			if maskimg[id]==nil then
				maskimg[id]=image(maskpath,0,0,0)
			end
			rndrot=math.random(0,359)
			imagepos(maskimg[id],maskitms[id].x*32+16,maskitms[id].y*32+16,rndrot)
			imagescale(maskimg[id],0.9,0.9)
		elseif mode==0 then
			if maskimg[id]~=nil then
				freeimage(maskimg[id])
				maskimg[id]=nil
			end
		else
		print("incorrect MODE setting!")
		end
	end
end

function dropmask(id)
	local tilex,tiley
	tilex=player(id,"tilex")
	tiley=player(id,"tiley")
	hasgasmask[id] = 0
	for i=1,#maskitms+1 do
		if maskitms[i]==nil or not maskitms[i].exists then
			maskitms[i]={}
			maskitms[i].exists=1
			maskitms[i].x=tilex
			maskitms[i].y=tiley
			refreshgfx(i,"gasmask",1)
			break
		end
	end
end

alt Re: Sammelthread/FAQ zu Lua & Editor

Snake_Eater
User Off Offline

Zitieren
Hallo estma

also ich weiß nicht ob es möglich ist aber wenn ja wäre es schön wenn es mir jemand erklären könnte

Ich möchte wissen wie man Einfalls bzw. Ausfallswinkel berechnet d.h.
wenn ein Objekt z.B. auf eine Horizontale trifft und die Rotation des Objektes ist 0 dann müsste es einen Einfallsewinkel von 0 haben und einen Ausfallswinkel von 180

Ich glaub zwar das dies nicht möglich ist aber wenn ja dann help pls

alt Re: Sammelthread/FAQ zu Lua & Editor

ohaz
User Off Offline

Zitieren
Mit sinus/cosinus/tangens zum Beispiel.
http://upload.wikimedia.org/wikipedia/commons/5/56/RechtwinkligesDreieck.svg ( Copyright von Wikipedia )
(In diesem Beispiel wäre z.b. CB die Wand, und der Punkt A der Punkt des Projektils. B ist der Auftreffpunkt, von daher müssen wir von Beta den Winkel bestimmen.
sin(Beta) = b/c
cos(Beta) = a/c
tan(Beta) = b/a
Du brauchst also einen Punkt vor dem Auftreffort, den Abstand dieses Punktes zum Auftreffpunkt und den Abstand der Senkrechten durch den Punkt zum Auftreffpunkt. Alternativ den Abstand des Punktes zur "Wand".
math.sin für Sinus
math.cos für Cosinus
math.tan für Tangens.
math.asin für den aSinus (die Umkehrfunktion von math.sin)
math.acos für den aCosinus (die Umkehrfunktion von math.cos)
math.atan für den aTangens (die Umkehrfunktion von math.tan)

alt Re: Sammelthread/FAQ zu Lua & Editor

Edik
User Off Offline

Zitieren
Hi, wollte fragen wie man abfragt ob man auf einen bestimmten Entity area steht oder nicht. will nämlich das man wenn man auf einem no buildings area steht , etwas nicht machen kann.

hab zwar das gefunden:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[ENTITY]
- entity(x,y,"value")		Return a value of an entity at the tile position (X|Y):
				exists, typename, type, name, trigger, state, int0, int1,
				int2, int3, int4, int5, int6, int7, int8, int9, str0, str1,
				str2, str3, str4, str5, str6, str7, str8, str9, aistate
				(int0-9 and str0-9 are used for entity settings and are
				different for each entity type)

- randomentity(type,[ai],[i0])	Returns the tile x and y position (2 values!) of a random entity
				of a certain type or -100,-100 if no entity has been found.
				ai=only find entities with this AI state (-1 to ignore)
				i0=only find entities with this int0 value (-1 to ignore)

- inentityzone(x,y,type)	Checks if the tile position (x|y) is in the area of a certain
				entity type and returns true or false

weiß aber nicht wie ich es anwenden soll! und welche value no buildings hat.

Es sollte ungefähr so aussehen:
1
2
3
4
5
function(x,y,Info.Nobuildings)
if Info.Nobuildings then
--CODE
end
end







KANN MIR BITTE JEMAND HELFEN?

alt Re: Sammelthread/FAQ zu Lua & Editor

TimeQuesT
User Off Offline

Zitieren
arghs... das ist das 2. mal das du das hier postest...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function maap()
local id = getplayers();
if id~=nil then
msg (string.format("%s stands in nobuildzone",id));
end

end

function getplayers()
for id=1,32 do
if player(id,"exists") and then
for y=0,map("sizey") do
for x=0,map("sizex") do
if entity(x,y,"exists") and entity(x,y"typename")=="Info_Nobuild" and player(id,"tilex")==x and player(id,"tiley")==y then
return id;
end
end
end
end
end

achtung! das überprüft nur ob der Spieler genau auf dem entity steht!!! du kannst jetz ,wenn du willst das er sich in einer befinden muss dann musst du das script noch mit :int0,int1 ergänzen. Also damit saugst du dir die x und y reichweite des entity. überprüfen ober der spieler drin steht und dann halt das was du willst.

--ich habe das script nicht getestet.
Zum Anfang Vorherige 1 249 50 5155 56 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht