Admirdee has written
Thank you (: I'm gonna go ahead!
*Update: Lol!
I actually understand it now
I didn't thought i would do (;Now the only thing i need is to get rid of the "attempt to call a nil value" (:
I know that the error is in the "akd_setpos_script_team"-section (i'll make that bold)
And i think that the error is that i'm using both nil, "" and {}...
Here is my full script:
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
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
[spoiler]
--[[ Info:
Script: AKD Setpos Script.
Credits:
1. Blazzingxx						- Helped with the "!setpos" command.
Features:
1. !Setpos <x> <y>					- Teleports the player to the desired location (in tiles).
2. !Save						- Saves the curret location.
3. !Load						- Loads the saved location.
4. !pps or !PlayerPositions				- Gives a list of all players locations.
One line from the !pps would look like this:		Name: XXX | ID: XXX | Player-position: XXX x XXX
Highlights:
1. You don't have to use capital or small letters.
2. When you change team the saved location is deleted.
--]]
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
savex = initArray(32)
savey = initArray(32)
admin={27747}		-- IMPORTANT: This is my USGN!
addhook("say","akd_setpos_script_setpos_say")
function akd_setpos_script_setpos_say(id, message)
	local cmd, m = {}, [[[^ ]+]]
	for word in string.gmatch(message, m) do table.insert(cmd, word); end
	if (string.sub(string.lower(message), 1, 7)=="!setpos") then
		if not (player(id, "health")==0) then
			local lenght = #cmd
			if (lenght==3) then
				local x, y = cmd[2], cmd[3]
				if (map("xsize")>=x-1) and (map("ysize")>=y-1) then
					parse ([[setpos ]]..id..[[ ]]..x*32-16 ..[[ ]]..y*32-16)
				elseif (lenght==3) and (map("xsize")+1<x+0) or (map("ysize")+1<y+0) then
					msg2(id, "©255000000Setpos ERROR: Too Big Parameters!")
				end
			elseif (lenght<3) then
				msg2(id, "©255000000Setpos ERROR: Not Enough Parameters!")
			elseif (lenght>3) then
				msg2(id, "©255000000Setpos ERROR: Too Many Parameters!")
			end
		else
			msg2(id, [[©255000000Setpos ERROR: You can't use command "!Setpos" when you are dead!]])
		end
	end
end
addhook("always","akd_setpos_script_always")
function akd_setpos_script_always()
	rot={}
	for id = 1, game("sv_maxplayers"), 1 do
		if player(id,"exists") then
			rot[id] = player(id,"rot")
			ppx = math.ceil(player(id, "x")+1)
			ppy = math.ceil(player(id, "y")+1)
			parse([[hudtxt2 ]]..id..[[ 6 "©000255000Player-Position:" 5 170]])
			parse([[hudtxt2 ]]..id..[[ 7 "©000255000Pixels: ]]..ppx..[[ x ]]..ppy..[[" 5 183]])
			parse([[hudtxt2 ]]..id..[[ 8 "©000255000Tiles: ]]..player(id,"tilex")+1 ..[[ x ]]..player(id,"tiley")+1 ..[[" 5 196]])
			if (savex[id]==nil) or (savey[id]==nil) then
				parse([[hudtxt2 ]]..id..[[ 9 "©000255000Saved location: No saved location!" 5 209]])
			else
				parse([[hudtxt2 ]]..id..[[ 9 "©000255000Saved location: ]]..savex[id]..[[ x ]]..savey[id]..[[" 5 209]])
			end
		end
	end
end
addhook("say","akd_setpos_script_save_load_say")
function akd_setpos_script_save_load_say(id, message)
	rot={}
	rot[id] = player(id,"rot")
	if (string.lower(message)=="!load") then
		if not (player(id, "health")==0) then
			if (savex[id]==nil) or (savey[id]==nil) then
				msg2(id, "©255000000No saved location to load!")
			else
				parse([[setpos ]]..id..[[ ]]..savex[id]*32-16 ..[[ ]]..savey[id]*32-16)
				msg2(id, "©000255000Location successfully loaded!")
			end
		else
			msg2(id, [[©255000000Setpos ERROR: You can't use command "!Load" when you are dead!]])
		end
	end
	if (string.lower(message)=="!save") then
		if not (player(id, "health")==0) then
			savex[id] = player(id,"tilex")+1
			savey[id] = player(id,"tiley")+1
			if (savex[id]==player(id,"tilex")+1) and (savey[id]==player(id,"tiley")+1) then
				msg2(id, "©000255000Location successfully saved!")
			else
				msg2(id, "©255000000Location not saved!")
			end
		else
			msg2(id, [[©255000000Setpos ERROR: You can't use command "!Save" when you are dead!]])
		end
	end
end
[b]addhook("team","akd_setpos_script_team")[/b]
function akd_hud_pp_save_team(id)
	if not (savex[id]=="") or not (savex[id]==nil) or not (savex[id]=={}) then
		savex[id]=nil
		savey[id]=nil
	end
[b]end[/b]
addhook("say","akd_setpos_script_pps_say")
function akd_setpos_script_pps_say(id, message)
	if (player(id, "usgn")==admin) then
		if (string.lower(message)=="!playerpositions") or (string.lower(message)=="!pps") then
			msg2(id, "©255255255Player Positions:")
			for i = 1, game("sv_maxplayers"), 1 do
				if player(i, "exists") then
					if not (player(i, "health")==0) then
						msg2(id, [[©255255255Name: ]]..player(i,"name")..[[ | ID: ]]..i..[[ | Player-position: ]]..player(i,"tilex")+1 ..[[ x ]]..player(i,"tiley")+1)
					else
						msg2(id, [[©255255255Name: ]]..player(i,"name")..[[ *DEAD* | ID: ]]..i)
					end
				end
			end
		end
	end
end
print("©000255000AKD Setpos Script successfully launched!")
[/spoiler]
Another thing: Can't you tell me what the "look" does in the hook "team"?
edited 3×, last 20.02.10 08:56:12 pm
Lua Scripts/Questions/Help


Offline
