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 2316 317 318338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
1.Yes you can use both
2.yes you can use both
3.yes i did repeat me (lol)
@Arcas
no it's not txt its message look in the info.txt file
1× editiert, zuletzt 24.11.10 22:59:03

alt Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Zitieren
Yes, the parameters are assigned by which parameter it is.
say(id,txt)
say(i,t)
'id' is the same as 'i' because they are both the first parameter.
Same with 'txt' and 't'.

Thanks for your help, kned.

Oh yeah, and what is the 'type' part of playerweapons?
Is it primary/secondary/melee/grenade/mine?
1× editiert, zuletzt 24.11.10 23:27:28

alt Re: Lua Scripts/Questions/Help

kNedLiik
User Off Offline

Zitieren
Thx Yasday, So now I'll use the better forms for the say hooks
1
2
3
4
5
6
addhook("say","example")
function example(p,t)
	if t == "exaple_text" then
		[my function]
	end
end

alt Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Zitieren
can any1 give me function script for "sequip" command?
It equip for selected player 1-20 weapons like:
1
sequip(id,3,30,32,51)
to equip deagle, ak47, m4a1 and HE.

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
@RyceR
its working i tried it
1
2
3
4
5
function sequip(id,...)
	for i = 1,#arg do
		parse([[equip ]]..id..[[ ]]..arg[i])
	end
end
@snake_eater
idk if you can make it easier but use the walkover hook and if the item is a sa then it should give the one whos got it a variable wichs true
1× editiert, zuletzt 25.11.10 23:07:15

alt Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Zitieren
try this snake eater
1
2
3
4
5
6
7
8
9
function checkweapon(id,weapon)
     local weapons = playerweapons(id)
     for i = 1, #weapons do
          if weapons[i] == weapon then
               return true
          end
     end
     return false
end

alt Re: Lua Scripts/Questions/Help

Infinite Rain
Reviewer Off Offline

Zitieren
Can somebody fix that lua?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook("kill","minigun")
function minigun(killer)
if kills == nil then kills = 0 end
kills=kills+1
end

addhook("say","quests")
function quests(id,t)
if t == "!quest1" then
if kills == nil then kills = 0 end
if kills <= 1 then kills = 0 end
msg("Kill 10 enemies to complete quest!")
if t == "!info" then
msg("You killed: "..kills..", Need to kill 10!")
end
if kills == 10 then
msg("You complete the quest!")
end
end
end

alt Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Zitieren
use the array function for the kills, like this

1
2
3
4
5
6
7
8
9
10
11
function Array(m,v)
	local array = {}
	if m == nil then m = tonumber(game("sv_maxplayers")) end
	if v == nil then v = 0 end
	for i = 1,m do
		array[i] = v
	end
	return array
end

kills = Array()
1× editiert, zuletzt 25.11.10 23:09:51

alt Re: Lua Scripts/Questions/Help

FiiD
User Off Offline

Zitieren
factis699 hat geschrieben
Can somebody fix that lua?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook("kill","minigun")
function minigun(killer)
if kills == nil then kills = 0 end
kills=kills+1
end

addhook("say","quests")
function quests(id,t)
if t == "!quest1" then
if kills == nil then kills = 0 end
if kills <= 1 then kills = 0 end
msg("Kill 10 enemies to complete quest!")
if t == "!info" then
msg("You killed: "..kills..", Need to kill 10!")
end
if kills == 10 then
msg("You complete the quest!")
end
end
end


Is it possible from this script to make a new script like if someone said 5 bad words he get a kick...if it is than just say yes or no and I try to make it...

Factis do you give me permission to edit your script for my idea...???

alt Re: Lua Scripts/Questions/Help

Jake-rus
User Off Offline

Zitieren
yes i can ...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("kill","minigun")
function minigun(killer)
kills[id]=kills[id]+1
end

addhook("say","quests")
function quests(id,t)
if t == "!quest1" then
msg("Kill 10 enemies to complete quest!")
if t == "!info" then
msg("You killed: "..kills[id]..", Need to kill 10!")
if kills[id] == 10 then
msg("You complete the quest!")
end
end
end
end

BUT you just need write this line in the begin of the script ->
1
kills = initArray(32)

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
Not only initArray line, you must enter initArray function!
1
2
3
4
5
6
7
function initArray(m)
	local array={}
	for i=1,m do
		array[i]=0
	end
	return array
end

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
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
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
level=initArray(32)
exp=initArray(32)
credits=initArray(32)
hacker=initArray(32)

function string.split(text,b)
local cmd = {}
if b then
b = b
else
b = "%s"
end
b = "[^"..b.."]+"
for o in string.gmatch(text,b) do
table.insert(cmd,o)
end
return cmd
end
if hacker==nil then hacker={} end
hacker={}

addhook("second","hack")
function hack()
if (hacker[id]==1) then
credits[id]=credits[id]+15
	end
end

addhook("spawn","class")
function class(id)
parse("equip "..id.." 56") -- Equips Ct's with defuse kit.
hacker[id] = 1 -- The Hacker Special is on
	parse("strip "..id)
Please help i cant finish my lua cause im stuck on this

EDIT //: In console says this "hack" function is added, however dont work..

alt Re: Lua Scripts/Questions/Help

Surplus
User Off Offline

Zitieren
What is wrong with the following code

1
2
3
4
5
6
7
8
9
10
11
12
13
admin_usgn = {18724,28429} 

addhook("team","adminteam") 
function adminteam(id,team) 
	if team == 2 then
			if player(id,"usgn") == admin_usgn then 
				return 0
			else 
				return 1
			end 
		end 
	end 
end

alt Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Zitieren
@PartyPooPer
1
2
3
4
5
6
7
8
9
10
11
12
admin_usgn = {18724,28429} 

addhook("team","adminteam") 
function adminteam(id,team) 
	if team == 2 then
		if player(id,"usgn") == admin_usgn then 
			return 0
		else 
			return 1
		end 
	end 
end
Zum Anfang Vorherige 1 2316 317 318338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht