VC:MP 0.4 (Beta) > Script Releases

Position System

(1/3) > >>

Flockshot:
Hello Guys I present u with m Positioning System.

So what basically it do is that it shows you ur position + angle + district name at will.

Using F3 Key you can enable/disable it.

Images




Global Variable

--- Code: ---local posofplr = []; //Place it in any file but out of any function because we want it to be a global variable not local.

--- End code ---

OnServerStart

--- Code: ---xyz <- BindKey(true,0x72,0,0); //we will bind key for it to make it easy for player, F3.
showpos <- array( GetMaxPlayers(), false );
NewTimer("PlayerPos", 300, 0); //starts the timer

--- End code ---

OnPlayerJoin

--- Code: ---posofplr.push({Player = player, x = null, y = null, z = null, angle = null, district=null}); //We will push the player in the array we created.

--- End code ---

OnKeyDown

--- Code: ---function onKeyDown(player, bindid)
{
   if(bindid == xyz ) // xyz because we named the binding to this name
   {
      if(!showpos[player.ID]) //player will have it false when it enters the game
      {
         showpos[player.ID] = true; //Means player has the position system on
         MessagePlayer("Showing Coordinates",player);
      }
      else
      {
         showpos[player.ID]= false; //If the positioning system was on and the key was press again it will disable
         
      }
     
   }
}

--- End code ---

Timer

--- Code: ---function PlayerPos()
{
foreach (val in posofplr)
{
local plr = val.Player;

if(plr)
{

if(showpos[plr.ID])
{
if (val.x != null) val.x.Delete();
if (val.y != null) val.y.Delete();
if (val.z != null) val.z.Delete();
if (val.angle != null) val.angle.Delete();
if (val.district != null) val.district.Delete();

val.x = CreateTextdraw("X: " + val.Player.Pos.x, 0, 300, 0xFFB0B0B0);
val.y = CreateTextdraw("Y: " + val.Player.Pos.y, 0, 315, 0xFFB0B0B0);
val.z = CreateTextdraw("Z: " + val.Player.Pos.z, 0, 330, 0xFFB0B0B0);
val.angle = CreateTextdraw("Angle: " + val.Player.Angle, 0, 345, 0xFFB0B0B0);
val.district = CreateTextdraw("District: " + GetDistrictName( val.Player.Pos.x, val.Player.Pos.y ), 0, 360, 0xFFB0B0B0);

if (val.x != null) val.x.ShowForPlayer(val.Player);
if (val.y != null) val.y.ShowForPlayer(val.Player);
if (val.z != null) val.z.ShowForPlayer(val.Player);
if (val.angle != null) val.angle.ShowForPlayer(val.Player);
if (val.district != null) val.district.ShowForPlayer(val.Player);
}
}
else
{
if (val.x != null){ val.x.Delete();
val.x = null;}

if (val.y != null){ val.y.Delete();
val.y = null;}

if (val.z != null){ val.z.Delete();
val.z = null;}

if (val.angle != null){ val.angle.Delete();
val.angle = null;}

if (val.district != null){ val.district.Delete();
val.district = null;}
}
}
}

--- End code ---

This is it for the Positioning system

Example Script: https://www.mediafire.com/?a6k18yne5m35ket

Special Thanks to : S.L.C for teaching me how to use the .push thingy.

Mariu22S:
Very nice :)

sseebbyy:
It looks good, but isn't it overlat on chat ? :/

[AoD]NC:
Mana :D.

Flockshot:

--- Quote from: sseebbyy on September 27, 2014, 11:54:52 pm ---It looks good, but isn't it overlat on chat ? :/

--- End quote ---
Yeah i know so i changed it position to much lower

now its fine



--- Quote from: [AoD]NC on September 28, 2014, 02:00:12 am ---Mana :D.

--- End quote ---
Thats just another thing.

Navigation

[0] Message Index

[#] Next page

Go to full version