Liberty Unleashed

Scripting => Script Releases => Topic started by: ZX_Lost_Soul on November 06, 2013, 11:52:41 pm

Title: District Name
Post by: ZX_Lost_Soul on November 06, 2013, 11:52:41 pm
That script displays a name of current district on the left bottom corner of the screen, under radar. Can be useful for RP servers.

(http://files.4ky.ru/games/lu_01.jpg)

That is client script.

Code: [Select]
/* District Name  ||  Author: ZX_Lost_Soul  ||  Free to use
That script displays a name of current district on the left bottom corner of the screen, under radar */

local plr=FindLocalPlayer();
local CurDistrict;

// Initializing
function onScriptLoad() {
DistrictName <- GUILabel(VectorScreen(20, ScreenHeight-45), ScreenSize(100,3), "Welcome");
DistrictName.FontName="Tahoma";
DistrictName.FontSize=18;
DistrictName.TextColour=Colour(255, 123, 0);
AddGUILayer(DistrictName);
NewTimer("district_name_upd", 2500, 0);
}

// District name update
function district_name_upd() {
local pos=plr.Pos;
local dis=GetDistrictName(pos.x, pos.y);
if(CurDistrict!=dis) {
DistrictName.Text=dis;
CurDistrict=dis;
  }
}
Title: Re: District Name
Post by: sasha19323 on November 07, 2013, 12:14:04 am
There's command for turn it on without any scripts...
Title: Re: District Name
Post by: ZX_Lost_Soul on November 07, 2013, 05:10:40 am
There's command for turn it on without any scripts...
What command?

p.s. Script is better anyway) You can make a translations of district names, for example, and show it on the player's language. You can doesn't show names of some districts. Or stylize color/font/position of this label )
Title: Re: District Name
Post by: neocortex on November 07, 2013, 08:15:27 am
this script should be in every server, simple but usefull
Title: Re: District Name
Post by: Thijn on November 07, 2013, 04:55:58 pm
You can make a translations of district names,
Why on earth would you translate names :P



Script seems good enough. I don't like timers, but I guess it's fine in this case.
Title: Re: District Name
Post by: Shadow. on November 07, 2013, 06:31:07 pm
Why not have it on onClientRender ?
Title: Re: District Name
Post by: Thijn on November 07, 2013, 07:34:06 pm
Why not have it on onClientRender ?
Because doing inPoly (Which I guess is what getdistrictname does) a lot of time isn't going to end well on a wooden computer.
Title: Re: District Name
Post by: ZX_Lost_Soul on November 07, 2013, 08:47:48 pm
Why on earth would you translate names :P

(http://files.4ky.ru/games/lu_02.png)
...not all words is the names. And it looks nicer at native language, if it has different alphabet)

Why not have it on onClientRender ?

1. Reason, described by Thijn.
2. If player walks on a district edge, you can see a label flickering - fast changing between two names. That's not good. 2,5 seconds update is optimal.

p.s. If using custom font...
(http://files.4ky.ru/games/lu_03.jpg)
Title: Re: District Name
Post by: Fredd on February 05, 2014, 06:47:46 am
Oh thanks friend. My first script xD  :P