Oh and please reply to my message I'm really confused about whats going on starkkz
Forum
Scripts
Lua Scripts/Questions/HelpOh and please reply to my message I'm really confused about whats going on starkkz
Hey starkkz there is no thing in it that enforces people from joining to ct or to t if not supposed to. People are randomly joining CT and its confusing people. Thanks! Also the !menu doesnt seem to be working.
MSek has written
It's possible to show money in menu? (like in buy menu or build menu)
Yes,
use this
1
2
2
idm = player(id,"money")
menu(id,"Drop Money ("..idm.."),100,500")
help me create a save programming
help me script combination license and position.
Code:
function array(m)
local array = {}
for i = 1, m do
array[i] = 0
end
return array
end
xp = array(32)
yp = array(32)
addhook ("join","rt")
function rt(p)
xp[p] = 0
yp[p] = 0
end
addhook ("serveraction","bu")
addhook ("menu","bu2")
addhook ("spawn","bu3")
function bu(id)
if player(id,"health")>0 then
menu (id,"Teleport menu,Set current Postion,Go to Postion,Reset Postion,Home")
end
end
function bu2(p,t,s)
if t=="Teleport menu" then
if s==1 then
xp[p]=player(p,"x")
yp[p]=player(p,"y")
msg2 (p,"©000255000Your saved teleport is x:"..xp[p].." y:"..yp[p].." now!@C")
elseif s==2 and xp[p]>0 and yp[p]>0 then
msg2 (p,"©000255000You have been teleported!@C")
parse ("setpos "..p.." "..xp[p].." "..yp[p])
elseif s==2 and xp[p]==0 and yp[p]==0 then
msg2 (p,"©255255000You no set teleport!@C")
elseif s==3 and xp[p]>0 and yp[p]>0 then
xp[p] = 0
yp[p] = 0
msg2 (p,"©255000000Your teleport has been deleted!@C")
elseif s==4 and xp[p]>-1 and yp[p]>-1 then
parse ("setpos "..p.." 850 150")
end
end
end
function bu3(p)
if xp[p]>0 and yp[p]>0 then
parse ("setpos "..p.." 850 150")
end
end
function string.split(t, b)
local cmd = {}
local match = "[^%s]+"
if b then
match = "%w+"
end
if type(b) == "string" then match = "[^"..b.."]+" end
if not t then return invalid() end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end
function initArray(n,v)
mt = {}
for i = 1,n do mt[i] = v end
return mt
end
license = initArray(0)
addhook("say","my_say")
function my_say(id,txt)
tab = string.split(txt,' ')
cmd = tab[1]
id_s = tab[2]
if(cmd == "!givelicense") then
license[id_s] = 1
end
if cmd == "removelicense" then
license[id_s] = 0
end
end
Stormtrooper595 has written
OH I got confused sorry starkkz I didn't realize that was for some else. Well I got someone working with me so it's all good.
here you go
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
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
addhook("team","adminteam")
function adminteam(id,team)
	if team==2 then
		for a=1,#admins do
			if (player(id,"usgn")==admins[a]) then
				return 0
			else
				msg2(id,"You cant join this team, You aint an admin")
				return 1
			end
		end
	end
end
addhook("say","adminsay")
function adminsay(id,t)
	for a=1,#admins do
		if (player(id,"usgn")==admins[a]) then
			if t=="rank" then
				return 0
			else
				msg(..player(id,"name").."(CT/ADMIN): "..t)
				return 1
			end
		end
	end
end
to add admins u need to do an new text file called
admin.txt
then open it and write
1
admins={XXXXX}
change XXXXX to your usgn
after that open the server.lua in the sys/lua
and add
1
dofile("sys/lua/admin.txt")
/edit
need help with
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("ms100","predator_checkpred")
function predator_checkpred()
	if cancheck==1 and stopcheck==0 then
		for i,v in ipairs(player(0,"table")) do
			if player(i,"team")==1 then
				return 0
			else
				parse("trigger predwin")
				msg("Predators won!")
				stopcheck=1
			end
		end
	end
end
edited 1×, last 04.08.10 03:15:00 pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("ms100","check_players")
function check_players()
local pl = {ct = 0, t = 0}
for i,v in ipairs(player(0,"table")) do
local team = player(i,"team")
	if(team == 1) then
		pl.t = pl.t + 1
	elseif(team == 2) then
		pl.ct = pl.ct + 1
	end
end
if(pl.t == 0) then
	parse("trigger predwin")
	--msg("predwin")
end
end
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
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
function initArray(m)
	local array = {}
	for i = 1, m do
	array[i]=0
	end
		return array
end
--------------------
addhook("ms100","timer")
addhook("attack","attack")
--------------------
time = initArray(32)
ene = initArray(32)
fun = initArray(32)
id = initArray(32)
--------------------
function timer()
	for i=1, 32 do
		if player(i,"exists") then	
			time[i] = time[i] + 0.1
			if ene[i] > 0 then
				if time[i] > ene[i] then
					pcall(fun[i],id)
					ene[i] = 0
				end	
			end
		end
		
	end
	
end
function clear(i)
	time[i]=0
end
function attack(i)
	parse("speedmod "..i.." -13")
	clear(i)
	ene[i] = 0.5
	fun[i] = parse
	id = "speedmod "..i.." 0"
end
Can somebody make me a script for the so-called private slot?
.
Script [ code ]function array(m)
local array = {}
for i = 1, m do
array[i] = 0
end
return array
end
function array2(m,c,d)
local array = {}
for i = 1, m do
array[i] = math.random(c,d)
end
return array
end
function array3(m,d)
local array = {}
for i = 1, m do
array[i] = d
end
return array
end
function st()
for id=1, player_count do
if (player(id,"exists")) then
if (player(id,"tilex")>=46) then
if (player(id,"tilex")<=48) then
if (player(id,"tiley")==46) then
setpos(id,player(id,"x")+10,player(id,"y"))
elseif (player(id,"tiley")==47) then
setpos(id,player(id,"x")+10,player(id,"y"))
elseif (player(id,"tiley")==48) then
setpos(id,player(id,"x")+10,player(id,"y"))
else
end
end
end
if (player(id,"tilex")>=1) then
if player(id,"tilex")<=3 then
if player(id,"tiley")>=1 then
if player(id,"tiley")<=48 then
setpos(id,player(id,"x"),player(id,"y")+10)
end
end
end
end
end
end
addhook("always","st")[ /code ]
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
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
function array(m)
	local a = {}
	for i = 1, m do
		a[i] = 0
	end
	return a
end
function array2(m,c,d)
	local a = {}
	for i = 1, m do
		a[i] = math.random(c,d)
	end
	return a
end
function array3(m,d)
	local a = {}
	for i = 1, m do
		a[i] = d
	end
	return a
end
addhook("always","st")
function st()
	for _, id in pairs(player(0,"table")) do
		if player(id,"tiley") == 46 then
			parse("setpos "..id.." "..(player(id,"x")+10).." "..player(id,"y"))
		elseif player(id,"tiley") == 47 then
			parse("setpos "..id.." "..(player(id,"x")+10).." "..player(id,"y"))
		elseif player(id,"tiley") == 48 then
			parse("setpos "..id.." "..(player(id,"x")+10).." "..player(id,"y"))
		end
		if player(id,"tilex")>=1 and player(id,"tilex")<=3 and player(id,"tiley")>=1 and player(id,"tiley")<=48 then
			parse("setpos "..id.." "..player(id,"x").." "..player(id,"y")+10)
		end
	end
end
Saving system, based on U.S.G.N. id. Saves characters, map items, house information, current weather & time, etc
On the command line:
luac file.lua
Will result in a file called luac.out which contains the lua bytecode.
Note that bytecode is not inherently portable as several lower level aspects of Lua is configured at compile time. Notably, the numerical offset that prefixes Lua strings is represented as a 64bit long integer on *nix machines and 32bit integers on windows and on the precompiled lua library that comes with CS2D.
Lua Scripts/Questions/Help


Offline