SA-MP Forums Archive
[FilterScript] Player Location Display [v1.0] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Player Location Display [v1.0] (/showthread.php?tid=664162)



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 Dependencies Installation
Please ensure you have the dependencies installed before attempting to compile the project!
Notes Credits 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
View Post
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
View Post
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
View Post
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
View Post
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(playeridPlayerText:playertextid) {
    if(
playertextid == p_DirectionTextdraw[playerid]) {
        
ShowPlayerDialog(playerid0DIALOG_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
View Post
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(playeridPlayerText:playertextid) {
    if(
playertextid == p_DirectionTextdraw[playerid]) {
        
ShowPlayerDialog(playerid0DIALOG_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



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
View Post
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
View Post
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
View Post
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
View Post
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
View Post
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
View Post
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?