Player Location Display [v1.1.1] -
Infin1ty - 20.02.2019
Player Location Display
Player Location Display for SAMP, based off of it's GTA V counterpart.
Quote:
(These are images from when I first created the design, there is a more updated look at the design in a pretty shitty video I made.)
Video of latest update (yes its pretty shit please excuse me - in the video you will be able to see gangzones, in the actual scripts they can be toggled on/off, they are only there for debug purposes.): https://*********/ARc9RjMuZb0?t=19
|
PLD–Player Location Display SAMP is a filterscript that displays the player's current location (including street name or intersection, area name, and region) at the bottom-left corner of the user's screen. It also shows the player's current compass point depending on what direction they are facing.
Description- PLD displays your current compass point. At the moment it only supports North, East, South and West however I do plan on adding support for North East, South East, South West and North West in the future.
- PLD displays the player's current location. (Only caveat is that you have to provide XY coordinates)
- Location includes Street Name, Geographical Area & City.
- Players can disable the feature for theirselves by typing in /pld.
Dependencies- streamer by Incognito
- izcmd by Yashas
Installation
Please ensure you have the dependencies installed before attempting to compile the project!
- Download the full project and extract it.
- Drop the .pwn files inside of the filterscripts folder into your gamemode's filterscripts folder.
- Compile main.pwn
- Add 'main' to the filterscripts line inside of your server.cfg
- If streamer isn't added to your plugins line, add it! For more in-depth installation please see the wiki.
Notes- This is not an .ASI script like the GTA V Player Location Display, this is completely server-sided. Please do not contact me about making it into an ASI.
- This is for San Andreas Multiplayer, not any GTA 5 Multiplayer platform.
- Any other issues or queries please open up a issue!
Credits- Gravityfalls/Logic for helping me out with the streamer aspect of this.
- Incognito for streamer.
- Yashas for izcmd.
- Lt.Caine for inspiration and for part of this readme.md (specifically the paragraph under the first header).
Download: GitHub
Re: Player Location Display [v1.0] -
TheToretto - 20.02.2019
It is good looking and well done, but why split into several filterscripts? Even for two lines of code lol?
Re: Player Location Display [v1.0] -
Infin1ty - 20.02.2019
Quote:
Originally Posted by TheToretto
It is good looking and well done, but why split into several filterscripts? Even for two lines of code lol?
|
Newbies may find it easier to understand code when it is separated like this, especially with the zones module. Part of my wiki is now able to revolve around this entire module in regards to adding more locations. This will also reduce unnecessary help requests, you know, getting things like 'oh I can't find eZones'.
Here is that wiki post I was talking about.
Besides, another argument could be future proofing.
Re: Player Location Display [v1.0] -
Pottus - 20.02.2019
Well there is some stuff here......
1.) No textdraw create in OnFilterScriptInit() for connected players.
2.) Using textdraws that should be global as player textdraws only textdraws with per-player output should be player textdraws.
3.) Lacking clean up code in OnFilterScriptExit()
4.) Major fuck-up with OnPlayerSpawn() that continually creates textdraws without destroying. Textdraws should never be destroyed unless the filterscript is unloaded. Your textdraws need to be created when a player connects ideally when they actually login.
5.) Useless OnPlayerDisconnect() code all of it.
6.) Why bother updating anything if nothing actually changed? Save the last CHANGE in a variable if it is the same then don't update.
Code:
if(angle >= 355.0 || angle <= 5.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "N");
else if(angle >= 265.0 && angle <= 275.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "E");
else if(angle >= 175.0 && angle <= 185.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "S");
else if(angle >= 85.0 && angle <= 95.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "W");
Re: Player Location Display [v1.0] -
Infin1ty - 20.02.2019
Quote:
Originally Posted by Pottus
Well there is some stuff here......
1.) No textdraw create in OnFilterScriptInit() for connected players.
2.) Using textdraws that should be global as player textdraws only textdraws with per-player output should be player textdraws.
3.) Lacking clean up code in OnFilterScriptExit()
4.) Major fuck-up with OnPlayerSpawn() that continually creates textdraws without destroying. Textdraws should never be destroyed unless the filterscript is unloaded. Your textdraws need to be created when a player connects ideally when they actually login.
5.) Useless OnPlayerDisconnect() code all of it.
6.) Why bother updating anything if nothing actually changed? Save the last CHANGE in a variable if it is the same then don't update.
Code:
if(angle >= 355.0 || angle <= 5.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "N");
else if(angle >= 265.0 && angle <= 275.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "E");
else if(angle >= 175.0 && angle <= 185.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "S");
else if(angle >= 85.0 && angle <= 95.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "W");
|
Thanks for all this. This was old code stuffed somewhere in my hard drive and I decided to make something out of it. I can’t believe I missed out this in my clean up process. I’ll work on this tomorrow and will push the updates. I was planning to make this a include or a gamemode module hence why some of the things listed in your list are there, I just seemed to forget that this was a filterscript, lmao.
Re: Player Location Display [v1.0] -
Pottus - 20.02.2019
One more thing for you.
Code:
if(rz >= 348.75 || rz < 11.25) Direction = "N";
else if(rz >= 326.25 && rz < 348.75) Direction = "NNE";
else if(rz >= 303.75 && rz < 326.25) Direction = "NE";
else if(rz >= 281.25 && rz < 303.75) Direction = "ENE";
else if(rz >= 258.75 && rz < 281.25) Direction = "E";
else if(rz >= 236.25 && rz < 258.75) Direction = "ESE";
else if(rz >= 213.75 && rz < 236.25) Direction = "SE";
else if(rz >= 191.25 && rz < 213.75) Direction = "SSE";
else if(rz >= 168.75 && rz < 191.25) Direction = "S";
else if(rz >= 146.25 && rz < 168.75) Direction = "SSW";
else if(rz >= 123.25 && rz < 146.25) Direction = "SW";
else if(rz >= 101.25 && rz < 123.25) Direction = "WSW";
else if(rz >= 78.75 && rz < 101.25) Direction = "W";
else if(rz >= 56.25 && rz < 78.75) Direction = "WNW";
else if(rz >= 33.75 && rz < 56.25) Direction = "NW";
else if(rz >= 11.5 && rz < 33.75) Direction = "NNW";
Re: Player Location Display [v1.0] -
Undef1ned - 20.02.2019
Quote:
Originally Posted by TheToretto
It is good looking and well done, but why split into several filterscripts? Even for two lines of code lol?
|
Exactly, I don't see any sense in that, the truth is I do not even know why you took the time to do something like that.
Quote:
Originally Posted by Pottus
Well there is some stuff here......
1.) No textdraw create in OnFilterScriptInit() for connected players.
2.) Using textdraws that should be global as player textdraws only textdraws with per-player output should be player textdraws.
3.) Lacking clean up code in OnFilterScriptExit()
4.) Major fuck-up with OnPlayerSpawn() that continually creates textdraws without destroying. Textdraws should never be destroyed unless the filterscript is unloaded. Your textdraws need to be created when a player connects ideally when they actually login.
5.) Useless OnPlayerDisconnect() code all of it.
6.) Why bother updating anything if nothing actually changed? Save the last CHANGE in a variable if it is the same then don't update.
Code:
if(angle >= 355.0 || angle <= 5.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "N");
else if(angle >= 265.0 && angle <= 275.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "E");
else if(angle >= 175.0 && angle <= 185.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "S");
else if(angle >= 85.0 && angle <= 95.0) PlayerTextDrawSetString(playerid, p_DirectionTextdraw[playerid], "W");
|
All this and many other things more, honestly, your filter script is a disaster.
I think it is not necessary to do this:
OnPlayerLeaveDynamicArea
"if (!IsPlayerInAnyDynamicArea(playerid)) "
I don't understand what you tried to do with this.
PHP Code:
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) {
if(playertextid == p_DirectionTextdraw[playerid]) {
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Player Location Display", "Player Location Display\nCreated by Infinity\n\
With help from Gravityfalls!", "Okay", "");
}
return 1;
}
Re: Player Location Display [v1.0] -
Infin1ty - 21.02.2019
Quote:
Originally Posted by Undef1ned
Exactly, I don't see any sense in that, the truth is I do not even know why you took the time to do something like that.
All this and many other things more, honestly, your filter script is a disaster.
I think it is not necessary to do this:
OnPlayerLeaveDynamicArea
"if (!IsPlayerInAnyDynamicArea(playerid)) "
I don't understand what you tried to do with this.
PHP Code:
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) {
if(playertextid == p_DirectionTextdraw[playerid]) {
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Player Location Display", "Player Location Display\nCreated by Infinity\n\
With help from Gravityfalls!", "Okay", "");
}
return 1;
}
|
I'd appreciate if you got the fuck out of here and got a pair of glasses. Then read everything I said.
'This was a project dug out of my hard drive'.
'Newbies may find it easier to understand code when it is separated like this, especially with the zones module. Part of my wiki is now able to revolve around this entire module in regards to adding more locations. This will also reduce unnecessary help requests, you know, getting things like 'oh I can't find eZones'.
Here is that wiki post I was talking about.
Besides, another argument could be future proofing.'
What is this, 2013? Everyone praises people for modulated code but then when I release something which has some modules for some pretty good reasons I get scolded for it. You venezuelans must be back in 2013 or something, jesus. I'd like to see you release something like this with your idea of 'perfect programming'.
Quote:
Constructive criticism never gets to the point where it becomes rude or unjust.
|
Re: Player Location Display [v1.1] -
Infin1ty - 21.02.2019
v1.1 Changelog
- Removed the colors.pwn module.
- Removed OnPlayerDisconnect.
- Removed p_PlayerSpawned.
- Added a couple new variables, updating will only happen if the player's direction has actually changed.
- Player is now able to know whether or not they have PLD disabled with a notification.
- Textdraws now load when a player connects.
- I forgot to distrubute the bars between the direction, it's added now.
- A wide range of compass points added, thanks to Pottus.
Re: Player Location Display [v1.0] -
TheToretto - 21.02.2019
Isn't your command to activate/deactivate swapped? You output an "activated" to the player but do the opposite, and vice-versa
Re: Player Location Display [v1.0] -
Infin1ty - 21.02.2019
Quote:
Originally Posted by TheToretto
Isn't your command to activate/deactivate swapped? You output an "activated" to the player but do the opposite, and vice-versa
|
Corrected, thank you!
Also repped.
Re: Player Location Display [v1.0] -
Infin1ty - 21.02.2019
Current version: v1.1.2
Re: Player Location Display [v1.0] -
Undef1ned - 21.02.2019
You have to fix 'OnPlayerSpawn'.
You also forgot to remove this line: #include "filterscripts/pld/colors.pwn"
Re: Player Location Display [v1.0] -
Kasichok - 21.02.2019
OnPlayerClickPlayerTextDraw should return 0 or it wont work in other filterscripts.
Re: Player Location Display [v1.0] -
Infin1ty - 21.02.2019
Quote:
Originally Posted by Undef1ned
You have to fix 'OnPlayerSpawn'.
You also forgot to remove this line: #include "filterscripts/pld/colors.pwn"
|
You're looking at an old commit. 87e43b2 is the latest.
That line isn't even there nor is OnPlayerSpawn.
Re: Player Location Display [v1.0] -
Infin1ty - 21.02.2019
Quote:
Originally Posted by Kasichok
OnPlayerClickPlayerTextDraw should return 0 or it wont work in other filterscripts.
|
What do you mean 'wont work in other filterscripts'? Do you mean this filterscript will not work in conjunction with other filterscripts or what?
I'm considering just removing that as a whole however I believe its a better solution to adding credits than creating a command like /pldcredits or something, though I do plan on adding more features meaning I may have to add commands with arguments.
Re: Player Location Display [v1.0] -
Kasichok - 21.02.2019
Quote:
Originally Posted by Infin1ty
What do you mean 'wont work in other filterscripts'? Do you mean this filterscript will not work in conjunction with other filterscripts or what?
I'm considering just removing that as a whole however I believe its a better solution to adding credits than creating a command like /pldcredits or something, though I do plan on adding more features meaning I may have to add commands with arguments.
|
Re: Player Location Display [v1.0] -
Infin1ty - 21.02.2019
Quote:
Originally Posted by Kasichok
|
Thanks for the clarification, even though the screenshot of the wiki post with that line circled around is kind of inferring that you believe I'm a total idiot. Repped.
Please correct your grammar in future, no offense to you and I do understand that English may not be your first language as it is for me.
'wont work
in other filterscripts'
v1.1.3 pushed.
Re: Player Location Display [v1.0] -
Undef1ned - 21.02.2019
Quote:
Originally Posted by Infin1ty
You're looking at an old commit. 87e43b2 is the latest.
That line isn't even there nor is OnPlayerSpawn.
|
It was, you have already corrected it.
Another detail that I think you forgot: you are already running 'CreateTextDraws' in 'OnPlayerConnect', you do not need to create a loop in 'OnFilterScriptInit' for the same function.
Re: Player Location Display [v1.0] -
OutlawPC - 24.03.2019
Nice work, thoroughly enjoy this.
Would you allow this to be used on role play communities by any chance?