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 2310 311 312338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
kNedLiik hat geschrieben
1
2
3
4
5
6
7
8
9
10
addhook("spawn"equip")
function equip(id)
	if (player(id,"team") == 1) then
		parse("strip "..id.." 2")
	elseif (player(id,"team") == 2) then
		parse("strip "..id.." 2")
		parse("equip "..id.." 58")
		parse("equip "..id.." 6")
	end
end

I can help you kato just add me at skype.


Look above my friend (:

But i see that your hook was actually better than mine (:
Just a little mistake.

Kato use this hook and func instead:
1
2
addhook("spawn","fequip")
function fequip()

alt Re: Lua Scripts/Questions/Help

kNedLiik
User Off Offline

Zitieren
Anders4000 hat geschrieben
kNedLiik hat geschrieben
1
2
3
4
5
6
7
8
9
10
addhook("spawn"equip")
function equip(id)
	if (player(id,"team") == 1) then
		parse("strip "..id.." 2")
	elseif (player(id,"team") == 2) then
		parse("strip "..id.." 2")
		parse("equip "..id.." 58")
		parse("equip "..id.." 6")
	end
end

I can help you kato just add me at skype.


Look above my friend (:

But i see that your hook was actually better than mine (:
Just a little mistake.

Kato use this hook and func instead:
1
2
addhook("spawn","fequip")
function fequip()


how long are u scripting ?
You make script much complicated

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Just realized that your script is actually better than mine (:
Mine is more complicated. But that's cus I made a Roundstart hook. Then i have to make a for statement to get through all the players. But you use the spawn hook. Then you don't have to use a for statement to get through the players, cus the spawn hook is called for every player (:

Your script is smaller than mine. And it does the same, therefore yours is better.

Kato, listen to kNed, not me
- Anders4000

alt Re: Lua Scripts/Questions/Help

AbAeterno
User Off Offline

Zitieren
Yay, i solved my problem

1
2
3
4
5
6
7
8
addhook("hit","pl_hit")
 function pl_hit(id, source)
  if (source>1) or (source == 1) then
   return 1
  else
   return 0
  end
 end

alt Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Zitieren
PunishedNoob hat geschrieben
Yay, i solved my problem

1
2
3
4
5
6
7
8
addhook("hit","pl_hit")
 function pl_hit(id, source)
  if (source>1) or (source == 1) then
   return 1
  else
   return 0
  end
 end


uhh i want to teach you something ..
1
2
3
4
-- you could use :
if (source>=1) then
--or
if (source>0) then
>= its above and the number like
">= 1" = 1 ,2 ,3 ..
">1" = 2,3,4 ..
"~=1" all the number exept 1
"==1" if == 1

well its more easy to you put
">=1" in

alt Re: Lua Scripts/Questions/Help

Ice-cream16
User Off Offline

Zitieren
I want lear make Lua.
As example, i want make easy script with picture over* head player.(how in multigame).
Please write here this script and say what is what.
1× editiert, zuletzt 17.11.10 17:37:09

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
kNedLiik hat geschrieben
Anders4000 hat geschrieben
Someone tell me what rp means (: Is it the town maps?

RP = Role Play

Ahh, ty I actually found out looking at some scipts, but somehow forgot it again s:

Thanks (:
- Anders4000

alt Re: Lua Scripts/Questions/Help

Blargh
User Off Offline

Zitieren
ok i'm noob into scripting

erm.. this is working but it's spamming the console with

Zitat
Lua: Adding function 'imgf' to hook 'die'


and the server lags bad O.o
what did I do wrong?

1
2
3
4
5
6
addhook("die","imgf")
function imgf(id)
	freeimage(blargh[id])
	end
	end
end

also I want a script example something like ~ an area in tiles where players cant damage each others like a safezone
1× editiert, zuletzt 17.11.10 19:36:47

alt Re: Lua Scripts/Questions/Help

Blargh
User Off Offline

Zitieren
thanks admir

also I want a script example something like ~ an area in tiles where players cant damage each others like a safezone

where can i find all the hooks ?
1× editiert, zuletzt 17.11.10 19:44:09

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
kNedLiik hat geschrieben
can someone explain me
1
for i = 1,#lol do


Eg:
1
2
3
for i = 1, 10 do	--This will go over the code below untill the variable(integer) i has reached 10. And it starts on 1.
	print("Hello "..i)
end

So in that example it will print out the following lines:
Spoiler >


If you didn't understand search: "For statement" on google (:
- Anders4000

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
1
for i = 1,#lol do

will only work like this:

1
2
3
4
lol = {1,54,68,10,68} --table
for i = 1,#lol do --it is like for i = 1,5 do,because lol has 5 ühm numbers
print(i)
end

Output hat geschrieben
1
2
3
4
5

alt Log Hook (AMX2D)

VaiN
User Off Offline

Zitieren
Tried searching and couldn't find any info on this.

I'm trying to change how logs work. I just want it to not log the unimportant repeated stuff like USGN server list and stats generation, so it's not flooding my logs with unnecessary data.

For some reason it seems to stop logging altogether after finding the string, instead of just ignoring what I'm specifying.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
init_mod("serverlog")

function hook_log_serverlog(text)
	if string.find(text,"U.S.G.N.: Sending serverlist") ~= nil then
		return 1
	elseif string.find(text, "U.S.G.N.: Serverlist") ~= nil then 
		return 1
	elseif string.find(text, "Cron Execution") ~= nil then
		return 1
	elseif string.find(text, "generating stats.") ~= nil then
		return 1
	elseif string.find(text, "stats generated in ") ~= nil then
		return 1
	else
		return 0
	end
end

return serverlog.name

Edit: Nevermind it's working fine
1× editiert, zuletzt 17.11.10 22:16:15

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
VaiN hat geschrieben
Tried searching and couldn't find any info on this.

I'm trying to change how logs work. I just want it to not log the unimportant repeated stuff like USGN server list and stats generation, so it's not flooding my logs with unnecessary data.

For some reason it seems to stop logging altogether after finding the string, instead of just ignoring what I'm specifying.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
init_mod("serverlog")

function hook_log_serverlog(text)
	if string.find(text,"U.S.G.N.: Sending serverlist") ~= nil then
		return 1
	elseif string.find(text, "U.S.G.N.: Serverlist") ~= nil then 
		return 1
	elseif string.find(text, "Cron Execution") ~= nil then
		return 1
	elseif string.find(text, "generating stats.") ~= nil then
		return 1
	elseif string.find(text, "stats generated in ") ~= nil then
		return 1
	else
		return 0
	end
end

return serverlog.name

Is this not the right way to approach this? Is return 1 supposed to stop all future log events or just the current one?


You cant do this since the luas loades after the USGN SERVERLIST and that

alt classes

WARM1NATOR
User Off Offline

Zitieren
I modified classes.lua that it has 9 classes instead of 6. But how can I set more that 9 classes?
Zum Anfang Vorherige 1 2310 311 312338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht