Author Topic: District Name  (Read 3240 times)

ZX_Lost_Soul

  • Newbie
  • *
  • Posts: 25
  • Karma: +1/-1
    • View Profile
District Name
« 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.



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;
  }
}
« Last Edit: November 06, 2013, 11:57:32 pm by ZX_Lost_Soul »
My English is very poor, please try to understand me)

sasha19323

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +25/-24
    • View Profile
Re: District Name
« Reply #1 on: November 07, 2013, 12:14:04 am »
There's command for turn it on without any scripts...

ZX_Lost_Soul

  • Newbie
  • *
  • Posts: 25
  • Karma: +1/-1
    • View Profile
Re: District Name
« Reply #2 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 )
My English is very poor, please try to understand me)

neocortex

  • Full Member
  • ***
  • Posts: 102
  • Karma: +10/-63
  • Fuhrer of C.R.C
    • View Profile
Re: District Name
« Reply #3 on: November 07, 2013, 08:15:27 am »
this script should be in every server, simple but usefull

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: District Name
« Reply #4 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.

Shadow.

  • Tester
  • Full Member
  • ****
  • Posts: 144
  • Karma: +16/-35
    • View Profile
Re: District Name
« Reply #5 on: November 07, 2013, 06:31:07 pm »
Why not have it on onClientRender ?

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: District Name
« Reply #6 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.

ZX_Lost_Soul

  • Newbie
  • *
  • Posts: 25
  • Karma: +1/-1
    • View Profile
Re: District Name
« Reply #7 on: November 07, 2013, 08:47:48 pm »
Why on earth would you translate names :P


...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...
« Last Edit: November 07, 2013, 10:07:55 pm by ZX_Lost_Soul »
My English is very poor, please try to understand me)

Fredd

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-6
    • View Profile
Re: District Name
« Reply #8 on: February 05, 2014, 06:47:46 am »
Oh thanks friend. My first script xD  :P

 

© Liberty Unleashed Team.