I made this GPS maybe ~week ago and now impoved it a bit.
There is a video about it, but i changed it a lil bit:
The video is laggy due to my bad pc and attempt to make high qwaleti:
https://www.youtube.com/watch?v=PvmYj_emDjg
Firstly i wanna to credit Gaios. Helped me to make it work with other scripts(idk really if it would).
Secondly:
Attention!!! Do not forget to add these files(or yours) to the servertransfer file to make others visible them.
Features:
Since i make it depending on sayin' pos to find players i decided to make it for locations, so:
x:xpos, y:ypos to set position in x, y on map, where xpos,ypos is your value(added limits of map)
ex:
x:300
y:400
make your own gps locations on your map:
use any entity you'd like to, name it "[GPS]" (and only!), use trigger as location name(Please do :1)not use brackets inside to avoid "disabled" button until you really need to make it disabled, 2)not use | symbol to make it looks properly, 3) don't try to make shitty ".., ..", '.., ..' to experiment with it's buggy, be srs and write normal shit there)
commas automatically changed to ";" in menu, and from ";" to "," in the messages. thanks to DC for that.
menu with pages of your locations on map.
super-duper arrow :D, in fact i copied a formula to make it looks good.
when the distance between you and the target is more or equals 100 distance would be reach
etc(if there any others)
Bug when the round restarts.
Feel free for edit for your own but keep in the mind is not fully yours. So do not claim it yourself.
The 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
MORA_GPS={} --player table MORA_GPS.PLAYERS={} local PLAYERS=MORA_GPS.PLAYERS --gps locations table MORA_GPS.GPSLOCATIONS={} local GPSLOCATIONS=MORA_GPS.GPSLOCATIONS --map size local xmax=map'xsize'*32+32 local ymax=map'ysize'*32+32 timer(1,"start") GPSLOCATIONS={} function start() --adding positions in table 	for _,e in pairs(entitylist()) do 		if entity(e.x,e.y,"name") == "[GPS]" then 			local x=e.x 			local y=e.y 			local s=entity(e.x,e.y,"trigger") 			table.insert(GPSLOCATIONS,{x,y,string.gsub(s, ",", ";")}) 		end 	end end addhook("serveraction","MORA_GPS.SERVER_ACTION") function MORA_GPS.SERVER_ACTION(id,action) 	if action==1 then 	PLAYERS[id].idPage=1 	local tab={"","","","","","","","","Next"} 		for i=1,8 do 			if GPSLOCATIONS[i]~=nil then 				tab[i]=GPSLOCATIONS[i][3].."|[X: "..GPSLOCATIONS[i][1]*32 .."][Y: "..GPSLOCATIONS[i][2]*32 .."]" 			else 				tab[9]="" 				break 			end 		end 		if GPSLOCATIONS[9]==nil then 			tab[9]="" 		end 			menu(id,"GPS - Page "..PLAYERS[id].idPage.."@b,"..tab[1]..","..tab[2]..","..tab[3]..","..tab[4]..","..tab[5]..","..tab[6]..","..tab[7]..","..tab[8]..","..tab[9].."") 	end 	gps_update(id) 	hud_update(id) end addhook("menu","MORA_GPS.MENU") function MORA_GPS.MENU(id,title,sel) 	if title=="GPS - Page 1" then 		if sel>=1 and sel<=8 then 			PLAYERS[id].GPS.Numbers[1]=GPSLOCATIONS[sel][1]*32+16 			PLAYERS[id].GPS.Numbers[2]=GPSLOCATIONS[sel][2]*32+16 			msg2(id,"GPS navigation [X] set at: "..PLAYERS[id].GPS.Numbers[1]) 			msg2(id,"GPS navigation [Y] set at: "..PLAYERS[id].GPS.Numbers[2]) 			msg2(id,"GPS navigation [Target] is: "..GPSLOCATIONS[sel][3]) 			PLAYERS[id].GPS.Target=GPSLOCATIONS[sel][3] 		elseif sel==9 then 			PLAYERS[id].idPage=PLAYERS[id].idPage+1 			local tab={"","","","","","","","Next","Previous"} 			local pos=8+((7*(PLAYERS[id].idPage-2))) 			for i=1,7 do 				if GPSLOCATIONS[i+pos] then 					tab[i]=GPSLOCATIONS[i+pos][3].."|[X: "..GPSLOCATIONS[i+pos][1]*32 .."][Y: "..GPSLOCATIONS[i+pos][2]*32 .."]" 				else 					tab[8]="" 					break 				end 			end 			if GPSLOCATIONS[pos+8]==nil then 				tab[8]="" 			end 			menu(id,"GPS - Page "..PLAYERS[id].idPage.."@b,"..tab[1]..","..tab[2]..","..tab[3]..","..tab[4]..","..tab[5]..","..tab[6]..","..tab[7]..","..tab[8]..","..tab[9].."") 		end 	elseif title=="GPS - Page "..PLAYERS[id].idPage.."" then 		local pos=8+((7*(PLAYERS[id].idPage-2))) 		if sel>=1 and sel<=7 then 			if GPSLOCATIONS[sel+pos] then 				PLAYERS[id].GPS.Numbers[1]=GPSLOCATIONS[sel+pos][1]*32+16 				PLAYERS[id].GPS.Numbers[2]=GPSLOCATIONS[sel+pos][2]*32+16 				msg2(id,"GPS navigation [X] set at: "..PLAYERS[id].GPS.Numbers[1]) 				msg2(id,"GPS navigation [Y] set at: "..PLAYERS[id].GPS.Numbers[2]) 				msg2(id,"GPS navigation [Target] is: "..GPSLOCATIONS[sel+pos][3]) 				PLAYERS[id].GPS.Target=GPSLOCATIONS[sel+pos][3] 			end 		elseif sel==8 then 			PLAYERS[id].idPage=PLAYERS[id].idPage+1 			local tab={"","","","","","","","Next","Previous"} 			local pos=8+((7*(PLAYERS[id].idPage-2))) 			for i=1,7 do 				if GPSLOCATIONS[i+pos] then 					tab[i]=GPSLOCATIONS[i+pos][3].."|[X: "..GPSLOCATIONS[i+pos][1]*32 .."][Y: "..GPSLOCATIONS[i+pos][2]*32 .."]" 				else 					tab[8]="" 					break 				end 			end 			if GPSLOCATIONS[pos+8]==nil then 				tab[8]="" 			end 			menu(id,"GPS - Page "..PLAYERS[id].idPage.."@b,"..tab[1]..","..tab[2]..","..tab[3]..","..tab[4]..","..tab[5]..","..tab[6]..","..tab[7]..","..tab[8]..","..tab[9].."") 		elseif sel==9 then 			PLAYERS[id].idPage=PLAYERS[id].idPage-1 			local tab={} 			if PLAYERS[id].idPage~=1 then 				tab={"","","","","","","","Next","Previous"} 				local pos=8+((7*(PLAYERS[id].idPage-2))) 				for i=1,7 do 					if GPSLOCATIONS[i+pos] then 						tab[i]=GPSLOCATIONS[i+pos][3].."|[X: "..GPSLOCATIONS[i+pos][1]*32 .."][Y: "..GPSLOCATIONS[i+pos][2]*32 .."]" 					else 						tab[8]="" 						break 					end 				end 			menu(id,"GPS - Page "..PLAYERS[id].idPage.."@b,"..tab[1]..","..tab[2]..","..tab[3]..","..tab[4]..","..tab[5]..","..tab[6]..","..tab[7]..","..tab[8]..","..tab[9].."") 			else 				PLAYERS[id].idPage=1 					tab={"","","","","","","","","Next"} 					for i=1,8 do 						if GPSLOCATIONS[i] then 							tab[i]=GPSLOCATIONS[i][3].."|[X: "..GPSLOCATIONS[i][1]*32 .."][Y: "..GPSLOCATIONS[i][2]*32 .."]" 						else 							tab[9]="" 							break 						end 					end 			menu(id,"GPS - Page "..PLAYERS[id].idPage.."@b,"..tab[1]..","..tab[2]..","..tab[3]..","..tab[4]..","..tab[5]..","..tab[6]..","..tab[7]..","..tab[8]..","..tab[9].."") 			end 		end 	end 	gps_update(id) 	hud_update(id) end addhook("startround","MORA_GPS.STARTROUND") function MORA_GPS.STARTROUND(roundmode) 	gps_check(id) end addhook("endround","MORA_GPS.ENDROUND") function MORA_GPS.ENDROUND(roundmode) 	gps_check(id) end addhook("team","MORA_GPS.TEAM") function MORA_GPS.TEAM(id, team) 	gps_check(id) end addhook("die","MORA_GPS.DIE") function MORA_GPS.DIE(id) 	PLAYERS[id].GPS.Numbers[1]=0 	PLAYERS[id].GPS.Numbers[2]=0 	gps_update(id) end addhook("leave","MORA_GPS.LEAVE") function MORA_GPS.LEAVE(id,reason) 	if PLAYERS[id] then 		if PLAYERS[id].GPS.Images[1] then 			freeimage(PLAYERS[id].GPS.Images[1]) 			freeimage(PLAYERS[id].GPS.Images[2]) 			PLAYERS[id].GPS.Images[2]=nil 			PLAYERS[id].GPS.Images[1]=nil 		end 	end end addhook("say","MORA_GPS.SAY") function MORA_GPS.SAY(id,txt) 	if txt:sub(1,2)=="x:" then 		xx = tonumber(txt:sub(3,#txt)) 		if xx and xx>0 and xx<=xmax then 			if PLAYERS[id].GPS.Target~="Say" then 				PLAYERS[id].GPS.Numbers[2]=0 			end 			PLAYERS[id].GPS.Numbers[1]=xx 			msg2(id,"GPS navigation [X] set at: "..xx) 			PLAYERS[id].GPS.Target="Say" 			gps_update(id) 			hud_update(id) 			return 1 		else 			errors(id,1) 			gps_update(id) 			hud_update(id) 			return 1 		end 	elseif txt:sub(1,2)=="y:" then 		yy = tonumber(txt:sub(3,#txt)) 		if yy and yy>0 and yy<=ymax then 			if PLAYERS[id].GPS.Target~="Say" then 				PLAYERS[id].GPS.Numbers[1]=0 			end 			PLAYERS[id].GPS.Numbers[2]=yy 			msg2(id,"GPS navigation [Y] set at: "..yy) 			PLAYERS[id].GPS.Target="Say" 			gps_update(id) 			hud_update(id) 			return 1 		else 			errors(id,1) 			gps_update(id) 			hud_update(id) 			return 1 		end 	end end addhook("move","MORA_GPS.MOVE") function MORA_GPS.MOVE(id,x,y) 	gps_update(id) 	hud_update(id) end function errors(id,errorid) 	if not id then return end 	if not errorid or errorid==0 then return end 	if errorid==1 then 		msg2(id,"[GPS Error]: Something wrong in position set.") 		msg2(id,"[GPS Info]: Map [x]:"..xmax.."[y]:"..ymax..".") 	end end function gps_check(id) 	for _,id in pairs(player(0, "table")) do 		if PLAYERS[id]==nil then 			PLAYERS[id]={GPS={Images={nil,nil},Numbers={0,0},Target="Say"},idPage=1} 		end 		PLAYERS[id].GPS.Numbers[1]=0 		PLAYERS[id].GPS.Numbers[2]=0 		if not PLAYERS[id].GPS.Images[1] then 			PLAYERS[id].GPS.Images[1]=image("gfx/mora/GPS/flare.bmp<a>",0,0,3,id) 			imagecolor(PLAYERS[id].GPS.Images[1],255,0,0) 			imagealpha(PLAYERS[id].GPS.Images[1],0) 			tween_rotateconstantly(PLAYERS[id].GPS.Images[1],1) 		else 			freeimage(PLAYERS[id].GPS.Images[1]) 			PLAYERS[id].GPS.Images[1]=nil 			PLAYERS[id].GPS.Images[1]=image("gfx/mora/GPS/flare.bmp<a>",0,0,3,id) 			imagecolor(PLAYERS[id].GPS.Images[1],255,0,0) 			imagealpha(PLAYERS[id].GPS.Images[1],0) 			tween_rotateconstantly(PLAYERS[id].GPS.Images[1],1) 			 		end 		if not PLAYERS[id].GPS.Images[2] then 			PLAYERS[id].GPS.Images[2]=image("gfx/mora/GPS/arrow.bmp<a>",0,0,3,id) 			imagecolor(PLAYERS[id].GPS.Images[2],255,0,0) 			imagealpha(PLAYERS[id].GPS.Images[2],0) 		else 			freeimage(PLAYERS[id].GPS.Images[2]) 			PLAYERS[id].GPS.Images[2]=nil 			PLAYERS[id].GPS.Images[2]=image("gfx/mora/GPS/arrow.bmp<a>",0,0,3,id) 			imagecolor(PLAYERS[id].GPS.Images[2],255,0,0) 			imagealpha(PLAYERS[id].GPS.Images[2],0)			 		end 		gps_update(id) 		hud_update(id) 	end end function gps_update(id) 	if PLAYERS[id]~=nil then 		if PLAYERS[id].GPS.Numbers[1]~=0 and PLAYERS[id].GPS.Numbers[2]~=0 then 			if PLAYERS[id].GPS.Images[1] then 				imagepos(PLAYERS[id].GPS.Images[1],PLAYERS[id].GPS.Numbers[1],PLAYERS[id].GPS.Numbers[2],object(PLAYERS[id].GPS.Images[1],'rot')) 				imagealpha(PLAYERS[id].GPS.Images[1],0.5) 			end 			if PLAYERS[id].GPS.Images[2] then 				local obx,oby=object(PLAYERS[id].GPS.Images[1],"x"),object(PLAYERS[id].GPS.Images[1],"y") 				local px,py=player(id,"x"),player(id,"y") 				local radiusx, radiusy = 320, 240 				local x1, y1, x2, y2 = px-radiusx, py-radiusy, px+radiusx, py+radiusy 				local a = -(math.atan2(obx-px,oby-py)+math.pi/2)%(2*math.pi) 				local nx, ny = px - math.cos(a)*196, py - math.sin(a)*196 				dist=math.sqrt((obx-px)^2+(oby-py)^2) 				if obx >= x1 and obx <= x2 and oby >= y1 and oby <= y2 then 					imagepos(PLAYERS[id].GPS.Images[2],PLAYERS[id].GPS.Numbers[1],PLAYERS[id].GPS.Numbers[2],0) 					imagealpha(PLAYERS[id].GPS.Images[2],1) 					imagecolor(PLAYERS[id].GPS.Images[2],0,255,0) 					imagecolor(PLAYERS[id].GPS.Images[1],0,255,0) 					imagescale(PLAYERS[id].GPS.Images[2],1,1) 				else 					imagepos(PLAYERS[id].GPS.Images[2],nx,ny,-math.deg(math.atan2((obx - px), (oby - py)))) 					imagealpha(PLAYERS[id].GPS.Images[2],1) 					imagecolor(PLAYERS[id].GPS.Images[2],255,0,0) 					imagecolor(PLAYERS[id].GPS.Images[1],255,0,0) 					imagescale(PLAYERS[id].GPS.Images[2],1,2) 				end 			end 			if dist<=100 then 				msg2(id,"You reach target position.") 				parse("effect \"flare\" " .. PLAYERS[id].GPS.Numbers[1] .. " " .. PLAYERS[id].GPS.Numbers[2] .. " 32 32 111 255 111") 				PLAYERS[id].GPS.Numbers[1]=0 				PLAYERS[id].GPS.Numbers[2]=0 			end 		else 			if PLAYERS[id].GPS.Images[1] then 				imagepos(PLAYERS[id].GPS.Images[1],0,0,object(PLAYERS[id].GPS.Images[1],'rot')) 				imagealpha(PLAYERS[id].GPS.Images[1],0) 			end 			if PLAYERS[id].GPS.Images[2] then 				imagepos(PLAYERS[id].GPS.Images[2],0,0,0) 				imagealpha(PLAYERS[id].GPS.Images[2],0) 			end 		end 	end end function hud_update(id) 	parse('hudtxt2 '..id..' 1 "Your position:" 635 240 2') 	parse('hudtxt2 '..id..' 2 "[X: '..player(id,"x")..']" 635 252 2') 	parse('hudtxt2 '..id..' 3 "[Y: '..player(id,"y")..']" 635 264 2') 	if PLAYERS[id].GPS.Numbers[1]~=0 and PLAYERS[id].GPS.Numbers[2]~=0 then 		parse('hudtxt2 '..id..' 4 "Target position:[X: '..PLAYERS[id].GPS.Numbers[1]..'][Y: '..PLAYERS[id].GPS.Numbers[2]..']" 635 276 2') 		if PLAYERS[id].GPS.Target=="Say" then 			parse('hudtxt2 '..id..' 5 "Target :[Custom position]" 635 288 2') 		else 			parse('hudtxt2 '..id..' 5 "Target :['..string.gsub(PLAYERS[id].GPS.Target, ";", ",")..']" 635 288 2') 		end 	else 		parse('hudtxt2 '..id..' 4 ""') 		parse('hudtxt2 '..id..' 5 ""') 	end	 end
Sorry me for my bad english and grammar,
thank you for attention.
edited 11×, last 13.06.17 07:05:25 am
Approved by Sparty
Download
7 kb, 443 Downloads