Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Kenneth Law
1
Support / Re: Question about player's marker
« on November 27th, 2020, 04:36 AM »
Alright hopefully developers could give some solution to this in the next update. Meanwhile I found some bugs in SetShowOnlyTeamMarkers(). I will post it on Bugs Report Board later.
2
Support / Re: Question about player's marker
« on November 27th, 2020, 12:55 AM »
Quote from Spiller on November 26th, 2020, 11:15 AM
This is not much of a solution but you can do something like this. (but at what cost?)


https://youtu.be/Gzskg2PrZT0

Code
Code: [Select]
SetShowOnRadar(false);
enum MARKER_CONFIG
{
RADIUS = 50, // Radius in which markers will be visible
UPDATE_TIME = 1000 // Markers are updated at this rate (ms)
};

PlayerIDs <- [];
MarkerData <- array(GetMaxPlayers(), null);

class MarkerClass
{
playerID = 0;
Marker = null;

Markers = null;
HasMarker = null;

constructor(pID)
{
this.playerID = pID;

Markers = [];
HasMarker = [];
}

function HasMarkerFor(pID)
{
if(this.HasMarker.find(pID) == null)
return false;

return true;
}

function CreateMarkerFor(pID)
{
local player = ::FindPlayer(this.playerID), target = ::FindPlayer(pID);
if(!player || !target) return 1;

local NewMarker = ::CreateMarker(player.UniqueWorld, target.Pos, 3, target.Colour, 0);
this.Markers.append(NewMarker);
this.HasMarker.append(pID);
}

function RemoveMarkerFor(pID)
{
local Position = this.HasMarker.find(pID);
if(Position == null) return 1;

::DestroyMarker(this.Markers[Position]);
this.Markers.remove(Position);
this.HasMarker.remove(Position);
}

function Destroy()
{
foreach(val in this.Markers)
::DestroyMarker(val);

this = null;
}
}

function MarkerHandler()
{
foreach(i, Entity in PlayerIDs)
{
local player = FindPlayer(Entity);
if(player)
{
foreach(Entity_ in PlayerIDs)
{
if(Entity_ == Entity)
continue;

if(CheckRadius(Entity, Entity_))
{
if(!MarkerData[Entity].HasMarkerFor(Entity_))
MarkerData[Entity].CreateMarkerFor(Entity_);
}
else
{
if(MarkerData[Entity].HasMarkerFor(Entity_))
MarkerData[Entity].RemoveMarkerFor(Entity_);
}
}

foreach(i, Marker in MarkerData[Entity].Markers)
{
DestroyMarker(Marker);

local target = FindPlayer(MarkerData[Entity].HasMarker[i]);
if(!target) return 1;

CreateMarker(player.UniqueWorld, target.Pos, 3, target.Colour, 0);
}
}
}
}
NewTimer("MarkerHandler", MARKER_CONFIG.UPDATE_TIME, 0);

function CheckRadius(Entity, Entity_)
{
local p1 = FindPlayer(Entity),
p2 = FindPlayer(Entity_);

if(p1 && p2)
{
if(!p1.IsSpawned || !p2.IsSpawned) return false;

if(sqrt(((p1.Pos.x - p2.Pos.x)*(p1.Pos.x - p2.Pos.x)) + ((p1.Pos.y - p2.Pos.y)*(p1.Pos.y - p2.Pos.y))) < MARKER_CONFIG.RADIUS)
return true;
}

return false;
}

onPlayerJoin
Code: [Select]
function onPlayerJoin( player )
{
PlayerIDs.append(player.ID);
MarkerData[player.ID] = MarkerClass(player.ID);
}

onPlayerPart
Code: [Select]
function onPlayerPart( player, reason )
{
PlayerIDs.remove(PlayerIDs.find(player.ID));
MarkerData[player.ID].Destroy();
}

Hastebin, if the formatting in above code appears messed up.

P.S. Didn't test much.
I've tried the way similar to the codes you gave, but there is still another problem which is the limitation of number of markers you can create in VCMP server. It has a restriction of 100. Give the example that 10 players are in server, in which I might have to create 9 markers for each player. That's totally 90 markers already. It could be insufficient for me to use.
3
Support / Question about player's marker
« on November 25th, 2020, 04:45 AM »
How to make the marker of a specific player visible for just part of players? Note that NEITHER FOR NONE OF PLAYERS NOR FOR ALL PLAYERS. Something like
Code: [Select]
player.RemoveMarker()
or
Code: [Select]
player.IsOnRadar = false
can only hide the marker for all which is not what I want. I know changing their world helps but I want them to be in one world.
Also, I am not talking about the function
Code: [Select]
SetShowOnlyTeamMarkers(true)
. Let's just talk about the situation that players are grouped into two teams which are separately A and B, and I want to make A visible for B while B invisible for A.
4
Bump, the same question as I want to ask.
5
Scripting and Server Management / Re: Radar mark
« on November 24th, 2020, 02:41 PM »
Bump, the same question as I want to ask.
6
General Discussion / Re: VCMP wiki is down
« on February 29th, 2020, 01:08 AM »
When will wiki be up again?
7
Bugs and Crashes / [BUG] Re: GUI label invisible!!
« on February 15th, 2020, 01:54 PM »
I was using the empty GUILabel() as he said in the topic however the problem still exists
8
Bugs and Crashes / [BUG] GUI label invisible!!
« on February 15th, 2020, 02:40 AM »
Description
Some labels with certain text and font sizes do not show up.
For instance:
Code: [Select]
label = GUILabel();
label.Pos = VectorScreen(300, 200);
label.TextColour = Colour(255, 255, 255);
label.Text = "test";
label.FontSize = 14;
But if I change the text to "testtesttest" or set the font size to 18, it becomes visible again.

Reproducible
always

What you were doing when the bug happened
Not doing anything

What you think caused the bug
I don't know. It's very strange.
9
Bugs and Crashes / [Bug] Re: Questions about two-dimensional array
« on February 15th, 2020, 02:20 AM »
Thx a lot.
Now problem has been solved.
I am not sure whether you are right but I did it like this
Code: [Select]
arr <- array(2, null);
arr[0] = [0, 0];
arr[1] = [0, 0];
and it works.
10
Bugs and Crashes / [Bug] Questions about two-dimensional array
« on January 28th, 2020, 10:25 AM »
Description
Let's just start with an example.
At first I defined an array
Code: [Select]
Array<-array(2,array(2,0));
And while I changed the value of Array[1][1] to 3, the value of Array[2][1] was also automatically changed to 3, which is not reasonable.
I have tested a lot of times and it was proved that the value of Array[2][1] always equals to that of Array[1][1] no matter how I try to make them two different elements.
Here is the code which I used for test
Code: [Select]
function onScriptLoad()
{
Array<-array(2,array(2,0));
}
function onPlayerCommand( player, cmd, text )
{
if(cmd=="change")
{
if(text&&IsNum(text))
{
Array[1][1]=text.tointeger();
}
}
else if(cmd=="check")
{
MessagePlayer("Array[2][1]: "+Array[2][1],player);
}
}

Reproducible
Always

What you were doing when the bug happened

Not doing anything

What you think caused the bug
Maybe squirrel language doesn't allow the existence of two-dimensional array?
11
Bugs and Crashes / Bugs of function AddChild
« on September 24th, 2019, 10:18 AM »


Description
Once an element was added as a child of another one, its alpha will always follow its parent's one. And also, this only occurs when I re-change the parent's alpha.
Like there are two labels whose names are A and B. I made label A a child of label B. Now if I reset the alpha of label B to a different value, the alpha of label A will also be changed automatically to the same value as that of label B.

Reproducible
Always

What you were doing when the bug happened
I was changing the alpha of parent's element.

What you think caused the bug
One element being a child of another one
12
Script and Content Requests / Re: How to lock a bike?
« on September 12th, 2019, 12:49 AM »
oh oh ok
13
General Discussion / Re: New feature request
« on September 11th, 2019, 07:43 AM »
Quote from Doom_Kill3R on September 11th, 2019, 07:37 AM
Its not implemented yet
Alright...Any idea when it will be on?
14
General Discussion / Re: New feature request
« on September 11th, 2019, 07:16 AM »
Quote from Doom_Kill3R on September 11th, 2019, 05:53 AM
Quote from Kenneth Law on September 11th, 2019, 01:48 AM
How? Can a player decide whichever weather he wants via Client-Side?
Nah you can just set a player's weather client side if his world is different, this will change the weather only for that player and not the whole server.
Sounds not bad. Could you tell me how to edit? What's the code for it?
15
General Discussion / Re: New feature request
« on September 11th, 2019, 01:48 AM »
Quote from Athanatos on September 10th, 2019, 07:52 PM
Client-side weather settings should be enough.
How? Can a player decide whichever weather he wants via Client-Side?