SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 08/02/2019, 11:21 PM   #1
XpDeviL
Big Clucker
 
XpDeviL's Avatar
 
Join Date: Sep 2009
Posts: 72
Reputation: 8
Default xNavigator - Navigation System ~ with Direction Arrow!

Hi everyone,

With this system you can use a nice navigation feature on your server.
In addition to marking the selected location on the map, you can also see the direction of the location by the arrow on the top of the vehicle.


Features
  • You can easily add your locations by typing {"Location Name", X, Y, Z} in the location list in the script.
  • You can open and use the navigation by typing /nav in the game.
  • After selecting a location, the selected position is marked on the map, and also you can see the direction of the location by the arrow that appears on the vehicle.
  • You can also see how much distance to the destination with textdraw, which is shown on the screen.
  • Navigation closes when you get out of the car, when you type /navclose or when you reach the destination.

Images






Download

MediaFire


Note

I used zcmd as a command system when coding the system. Ive also added it in the rar.
__________________
XpDeviL is offline   Reply With Quote
Old 08/02/2019, 11:47 PM   #2
TheSlenderman
Little Clucker
 
TheSlenderman's Avatar
 
Join Date: Feb 2019
Location: The Forest
Posts: 33
Reputation: 32
Default Re: xNavigator - Navigation System ~ with Direction Arrow!

It reminds me of the Need For Speed Underground 2 for some reason haha, even tho the arrow in that game was blue as far as I remember. You done a good job.
TheSlenderman is offline   Reply With Quote
Old 09/02/2019, 12:32 AM   #3
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,854
Reputation: 1292
Default Re: xNavigator - Navigation System ~ with Direction Arrow!

Never check if floats are equal to a specific value! Always <= or >=

Code:
if (yc == 0.0 || xc == 0.0)
	{
		if(yc == 0 && xc > 0) angle = 0.0;
		else if(yc == 0 && xc < 0) angle = 180.0;
		else if(yc > 0 && xc == 0) angle = 90.0;
		else if(yc < 0 && xc == 0) angle = 270.0;
		else if(yc == 0 && xc == 0) angle = 0.0;
	}
Why bother making extra variables and assignments here? This can be useful when you have more code but this is just a short bit of code why bother?

Code:
	pPos[0] = NavData[pNavID[playerid]][NAV_X];
	pPos[1] = NavData[pNavID[playerid]][NAV_Y];
	pPos[2] = NavData[pNavID[playerid]][NAV_Z];
Where is OnFilterScriptExit() with clean up code?

How do you know that will work for all vehicles and look good?
Code:
AttachObjectToVehicle(ok[playerid], GetPlayerVehicleID(playerid), 0.000000, 0.000000, 1.399998, 0.000000, 90.0, rot + 180);
Alright that is nice but what about checking if the player is a driver?
Code:
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{FF0000}<!> You must be in a vehicle to use navigation!");
Always define your dialog id's! That way if there is a collision all you have to do is change the id once.
Code:
ShowPlayerDialog(playerid, 112, DIALOG_STYLE_LIST, "[Navigation] Locations", string, "Select", "Close");
Critical issue here.
Code:
if(IsValidObject(ok[playerid])) DestroyObject(ok[playerid]);
If you have the dialog open and you exit a vehicle that object will be destroyed. Now if someone creates an object for any reason and it takes that id and it so happens the player was put back into a vehicle then there is the potential for objects to be deleted.

Always avoid creating player textdraws when a player connects. Reason being, maybe they disconnect. Maybe they fail to log in. What is the point of creating textdraws that majority of the time probably won't be used? Create when a player types a command or when a player actually logs in (gamemodes).

Code:
public OnPlayerConnect(playerid)
{
	NAVpTD[playerid] = CreatePlayerTextDraw(playerid, 405.724487, 415.166564, "Distance Left: ~y~0000.00m");
	PlayerTextDrawLetterSize(playerid, NAVpTD[playerid], 0.179326, 1.109999);
	PlayerTextDrawAlignment(playerid, NAVpTD[playerid], 1);
	PlayerTextDrawColor(playerid, NAVpTD[playerid], -1);
	PlayerTextDrawSetShadow(playerid, NAVpTD[playerid], 0);
	PlayerTextDrawSetOutline(playerid, NAVpTD[playerid], 0);
	PlayerTextDrawBackgroundColor(playerid, NAVpTD[playerid], 255);
	PlayerTextDrawFont(playerid, NAVpTD[playerid], 2);
	PlayerTextDrawSetProportional(playerid, NAVpTD[playerid], 1);
	PlayerTextDrawSetShadow(playerid, NAVpTD[playerid], 0);
	return 1;
}
Pottus is offline   Reply With Quote
Old 09/02/2019, 12:44 AM   #4
XpDeviL
Big Clucker
 
XpDeviL's Avatar
 
Join Date: Sep 2009
Posts: 72
Reputation: 8
Default Re: xNavigator - Navigation System ~ with Direction Arrow!

Quote:
Originally Posted by Pottus View Post
Why bother making extra variables and assignments here? This can be useful when you have more code but this is just a short bit of code why bother?

Code:
	pPos[0] = NavData[pNavID[playerid]][NAV_X];
	pPos[1] = NavData[pNavID[playerid]][NAV_Y];
	pPos[2] = NavData[pNavID[playerid]][NAV_Z];
Where is OnFilterScriptExit() with clean up code?
I wrote this system a long time ago for my gamemode. Now I took it from the gm. So there could be useless codes that overlooked. Sorry about them. Thanks for the info. Ill be more carefull next time.
__________________
XpDeviL is offline   Reply With Quote
Old 09/02/2019, 12:45 AM   #5
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,854
Reputation: 1292
Default Re: xNavigator - Navigation System ~ with Direction Arrow!

Quote:
Originally Posted by XpDeviL View Post
I wrote this system a long time ago for my gamemode. Now I took it from the gm. So there could be useless codes that overlooked. Sorry about them. Thanks for the info. Ill be more carefull next time.
There is a lot in this most of it is harmless but a few critical mistakes.
Pottus is offline   Reply With Quote
Old 09/02/2019, 12:51 AM   #6
XpDeviL
Big Clucker
 
XpDeviL's Avatar
 
Join Date: Sep 2009
Posts: 72
Reputation: 8
Default Re: xNavigator - Navigation System ~ with Direction Arrow!

Quote:
Originally Posted by Pottus View Post
There is a lot in this most of it is harmless but a few critical mistakes.
Nice analyse by the way I should use you as my compiler
__________________
XpDeviL is offline   Reply With Quote
Old 09/02/2019, 12:53 AM   #7
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,854
Reputation: 1292
Default Re: xNavigator - Navigation System ~ with Direction Arrow!

Quote:
Originally Posted by XpDeviL View Post
Nice analyse by the way I should use you as my compiler
Yeah I am really good at knowing what to look for when looking at a script of where the break points/bugs are.
Pottus is offline   Reply With Quote
Old 01/08/2019, 01:21 AM   #8
CrimsonWatcher
Little Clucker
 
Join Date: Dec 2018
Posts: 1
Reputation: 0
Default Re: xNavigator - Navigation System ~ with Direction Arrow!

I try to use the filterscript for my server but I am in conflict with one that I have on teleportation by giving a location to use the xnavigator teleports me to a location that I have with another filterscript know how to fix that
CrimsonWatcher is offline   Reply With Quote
Old 01/08/2019, 06:29 AM   #9
GTLS
High-roller
 
GTLS's Avatar
 
Join Date: Aug 2014
Location: India
Posts: 1,049
Reputation: 115
Default Re: xNavigator - Navigation System ~ with Direction Arrow!

Quote:
Originally Posted by CrimsonWatcher View Post
I try to use the filterscript for my server but I am in conflict with one that I have on teleportation by giving a location to use the xnavigator teleports me to a location that I have with another filterscript know how to fix that
create a public function and forward it in your FS. Now, you can use that function to get coords from other FS. This is better than PVars which is your second option if you dont wanna use a function.
__________________

I don't help for rep. I help cuz I was helped in the past.


Retired from SAMP Scene. Might open SAMP Forums once in a while.

Some treats for ya. Click em
Basic House System
Simple Speedo
Base Login/Register Script

GTLS is offline   Reply With Quote
Old 14/09/2019, 09:42 AM   #10
TheMarioTR
Little Clucker
 
Join Date: Jun 2019
Location: pawno.exe // Turkey
Posts: 4
Reputation: 0
Default Re: xNavigator - Navigation System ~ with Direction Arrow!

Eline sağlık ^-^
TheMarioTR is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Y_INI GANG SYSTEM SAVING HELP.. (Just need right direction), Scrillex Scripting Help 6 12/04/2014 04:27 PM
My Navigation/GPS System Austin Help Archive 24 03/01/2011 11:00 AM
Navigation System - SetObjectRot to AttachObjectToPlayer Stas92 Help Archive 4 22/05/2010 08:17 AM
[FilterScript] [FS] Navigation System Michelle1991 Filterscripts 30 19/09/2009 12:29 PM
[FilterScript] [FS] SA Navigation System Weed_ Filterscripts 15 07/04/2009 08:43 PM


All times are GMT. The time now is 03:31 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.