Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2316 317 318338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
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
edited 1×, last 24.11.10 10:59:03 pm

old Re: Lua Scripts/Questions/Help

Chex
User Off Offline

Quote
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?
edited 1×, last 24.11.10 11:27:28 pm

old Re: Lua Scripts/Questions/Help

kNedLiik
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

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

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
@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
edited 1×, last 25.11.10 11:07:15 pm

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Infinite Rain
Reviewer Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Yasday
User Off Offline

Quote
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()
edited 1×, last 25.11.10 11:09:51 pm

old Re: Lua Scripts/Questions/Help

FiiD
User Off Offline

Quote
factis699 has written
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...???

old Re: Lua Scripts/Questions/Help

Jake-rus
User Off Offline

Quote
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)

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

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

old Re: Lua Scripts/Questions/Help

Surplus
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
@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
To the start Previous 1 2316 317 318338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview