Vice City: Multiplayer

VC:MP Discussion => General Discussion => Topic started by: Luis_Labarca on Mar 22, 2017, 04:27 AM

Title: World ID all Players Client-Side
Post by: Luis_Labarca on Mar 22, 2017, 04:27 AM
Hi there is some way to see how many players there are in a worldID from the Client-Side


Is there any way to do it from the client-side or not?

I did some testing and it did not work

test #1
function Script::ScriptLoad()
{
::GUI.SetMouseEnabled(true);
::Test <- GUILabel( VectorScreen(40,70), Colour( 255, 255, 255 ), "Players[0]");
::Test.FontSize = 15;
}
function Script::ScriptProcess()
{
if(::Test)
{
local PlayerInWorldID1=0;
for (local PlayerID=0; PlayerID<100; PlayerID++)
{
local P = World.FindPlayer( PlayerID );
if(P.World == 1)
{
PlayerInWorldID1++;
}
}
::Test.Text= "Players["+PlayerInWorldID1+"]";
}
}
test #2


function Script::ScriptLoad()
{
::GUI.SetMouseEnabled(true);
::Test <- GUILabel( VectorScreen(40,70), Colour( 255, 255, 255 ), "Players[0]");
::Test.FontSize = 15;
}
function Script::ScriptProcess()
{
if(::Test)
{
local PlayerInWorldID1=0;
for (local PlayerID=0; PlayerID<100; PlayerID++)
{
local P = World.FindPlayer( PlayerID );
if(P)
{
if(P.World == 1)
{
PlayerInWorldID1++;
}
}
}
::Test.Text= "Players["+PlayerInWorldID1+"]";
}
}

Could you help me thanks :D
Title: Re: World ID all Players Client-Side
Post by: KAKAN on Mar 22, 2017, 05:11 AM
I see nothing wrong. What you want to say :D?
You said it didn't work, then maybe give us some error details?
Title: Re: World ID all Players Client-Side
Post by: vito on Mar 22, 2017, 09:23 AM
Please read this page before client side coding: http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Functions

QuotePlayer
Property Type (read-only)
Type: int
The type of this entity, always OBJ_PLAYER.
Property ID (read-only)
Type: int
Property Local (read-only)
Type: bool
Whether this is the local player.
Property Name (read-only)
Type: string
Property Health (read-only)
Type: float
Property Armour (read-only)
Type: float
Property Position (bound)
Type: Vector
As you can see, no 'World' listed here. So you need to get it from server.
Title: Re: World ID all Players Client-Side
Post by: Luis_Labarca on Mar 22, 2017, 01:13 PM
Quote from: KAKAN on Mar 22, 2017, 05:11 AMI see nothing wrong. What you want to say :D?
You said it didn't work, then maybe give us some error details?

That example # 1 does not work in this example because WorldID does not give
And example # 2 does not work because World does not exist
Title: Re: World ID all Players Client-Side
Post by: Luis_Labarca on Mar 22, 2017, 01:14 PM
Quote from: vito on Mar 22, 2017, 09:23 AMPlease read this page before client side coding: http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Functions

QuotePlayer
Property Type (read-only)
Type: int
The type of this entity, always OBJ_PLAYER.
Property ID (read-only)
Type: int
Property Local (read-only)
Type: bool
Whether this is the local player.
Property Name (read-only)
Type: string
Property Health (read-only)
Type: float
Property Armour (read-only)
Type: float
Property Position (bound)
Type: Vector
As you can see, no 'World' listed here. So you need to get it from server.
ok