World ID all Players Client-Side

Started by Luis_Labarca, Mar 22, 2017, 04:27 AM

Previous topic - Next topic

Luis_Labarca

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
My server RP
IP: 51.222.28.159:8194

KAKAN

I see nothing wrong. What you want to say :D?
You said it didn't work, then maybe give us some error details?
oh no

vito

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.

Luis_Labarca

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
My server RP
IP: 51.222.28.159:8194

Luis_Labarca

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
My server RP
IP: 51.222.28.159:8194