Author Topic: Get Client Points?  (Read 1379 times)

almost nothing is instant
so, what's your frame of instant? one second? 33 miliseconds? just make a loop to query the server based on your time frame of instant
How?

almost nothing is instant
so, what's your frame of instant? one second? 33 miliseconds? just make a loop to query the server based on your time frame of instant
dear god you're taking "instant" wayyyy too literally.

He meant, a function that is called when a client on the server's score changes, in other words an event function.

How?
you make a loop to check based on your time frame of instant :I
Code: [Select]
function loopidyloop()
{
    cancel($loopidyloop);
    query code here
    $loopidyloop = schedule(time, 0, loopidyloop);
}

dear god you're taking "instant" wayyyy too literally.

He meant, a function that is called when a client on the server's score changes, in other words an event function.

Re-read the topic.

Unfortunately, I can't make the GUI pop / close every second :(
« Last Edit: June 24, 2012, 06:26:58 PM by Jeep »

Unfortunately, I can't make the GUI pop / close every second :(

You don't need to, just open, close it when you need the info. I'm sure you don't need the info every second. Also if the client is sending something to the server, maybe you don't even need to open the gui, just find out what server command is being called when the gui opens.

just find out what server command is being called when the gui opens.
HOLD ON I GOT THIS BE RIGHT BACK


serverCmdOpenPlayerList(%this);
\/\/\/\/\/\/
commandToServer('openPlayerList'); <<<<
commandToServer('closePlayerList'); <<<<
^^^^^^^

do that when you need to update the stuff
« Last Edit: June 24, 2012, 07:01:54 PM by Lugnut »

HOLD ON I GOT THIS BE RIGHT BACK


serverCmdOpenPlayerList(%this);
\/\/\/\/\/\/
commandToServer('openPlayerList'); <<<<
commandToServer('closePlayerList'); <<<<
^^^^^^^

do that when you need to update the stuff
Thank you Lug!!! You are so awesome!!!

Only one problem. Whenever I use the function the console now and then spams this:

ERROR: NewPlayerListGui::UpdateTrust() - score update recieved for non-existant client (SomeNumbers)
BackTrace: ->secureClientCmd_ClientScoreCh anged->[ShowScore]NewPlayerListGui::updateScore->NewPlayerListGui::updateScore
« Last Edit: June 30, 2012, 02:08:18 PM by jes00 »

Only one problem. Whenever I use the function the console now and then spams this:

ERROR: NewPlayerListGui::UpdateTrust() - score update recieved for non-existant client (3751392)
BackTrace: ->secureClientCmd_ClientScoreCh anged->[ShowScore]NewPlayerListGui::updateScore->NewPlayerListGui::updateScore

Post your code.

You know what's frustrating? When you walk into a topic that you know the answer of and then you scroll through and see that it took 2 pages of problem solving to discover what you could have said right when you stepped foot into the topic. I'm not saying I'm an almighty scripter or whatever but at least I could have helped the poor person without 2 pages of people going uhhhhhhhh maybe try this?


anyway, COMPLETELY off topic, who are you elm? You seem to be decent at coding but I just saw your name pop up not too long ago and I've never seen an "elm" in game.

You know what's frustrating? When you walk into a topic that you know the answer of and then you scroll through and see that it took 2 pages of problem solving to discover what you could have said right when you stepped foot into the topic. I'm not saying I'm an almighty scripter or whatever but at least I could have helped the poor person without 2 pages of people going uhhhhhhhh maybe try this?


anyway, COMPLETELY off topic, who are you elm? You seem to be decent at coding but I just saw your name pop up not too long ago and I've never seen an "elm" in game.

Hi, I am elm, you are a friend of Trigun right? Anyways I'm usually just working on my server (passworded) so nobody really knows me.

Post your code.
Burp.
Code: [Select]
//=========================================================================
// GUI Modification
//=========================================================================
if(!$Client::ShowScore::Haloveecuted)
{
new GuiSwatchCtrl(ShowScore_Parent)
{
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "750 350";
extent = "125 50";
minExtent = "8 2";
visible = "0";
color = "0 0 0 0";

new GuiMLTextCtrl(ShowScore_Text)
{
profile = "GuiMLTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "25 16";
extent = "106 24";
minExtent = "8 2";
visible = "1";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
text = "";
maxBitmapHeight = "-1";
selectable = "1";
};
};

PlayGui.add(ShowScore_Parent);

$Client::ShowScore::Haloveecuted = true;
}
//=========================================================================
// Key Bind
//=========================================================================
function ShowScore_addBind()
{
if(!$Client::ShowScore::Bind)
{
$Client::ShowScore::Bind = 1;

for(%i = 0; %i < $remapCount; %i++)
{
if($remapDivision[%i] $= "View")
{
%foundDiv = 1;

continue;
}

if(%foundDiv && ($remapDivision[%i] !$= ""))
{
%position = %i;

break;
}
}

if(!%foundDiv)
{
error("Division not found: View");

return;
}

if(!%position)
{
$remapName[$remapCount] = "View";
$remapCmd[$remapCount] = "Toggle ShowScore";
$remapCount++;

return;
}

for(%i = $remapCount; %i > %position; %i--)
{
$remapDivision[%i] = $remapDivision[%i - 1];
$remapName[%i] = $remapName[%i - 1];
$remapCmd[%i] = $remapCmd[%i - 1];
}

$remapDivision[%position] = "";
$remapName[%position] = "Toggle ShowScore";
$remapCmd[%position] = "Toggle_ShowSCore";
$remapCount++;
}
}

ShowScore_addBind();

function Toggle_ShowScore(%b)
{
if(!%b)
{
if(!ShowScore_Parent.isVisible())
{
ShowScore_UpdateScore();

ShowScore_Parent.setVisible(1);
}

else
{
cancel($Client::ShowScore::Schedule);

ShowScore_Parent.setVisible(0);
}
}
}
//=========================================================================
// Package
//=========================================================================
package ShowScore
{
function ShowScore_Parent::onWake()
{
if(!$Client:ShowScore::HasPositioned)
{
ShowScore_Parent.position = (getWord(PlayGui.extent, 0) + 110) SPC (getWord(PlayGui.extent, 1) - 30);

$Client:ShowScore::HasPositioned = true;
}
}

function newPlayerListGUI::update(%this, %cl, %name, %BL_ID, %trust, %admin, %score)
{
parent::update(%this, %cl, %name, %BL_ID, %trust, %admin, %score);

if(%name $= $Pref::Player::NetName)
{
$MyClient = %cl;

ShowScore_Text.setText("<font:impact:23><color:FFFF00>Score:<color:ffffff>" SPC %score);
}
}

function newPlayerListGUI::updateScore(%this, %client, %score)
{
if(%client == $MyClient)
{
ShowScore_Text.setText("<font:impact:23><color:FFFF00>Score:<color:ffffff>" SPC %score);
}

parent::updateScore(%this, %client, %score);
}
};
activatePackage(ShowScore);

function ShowScore_UpdateScore()
{
if(isObject(serverConnection))
{
if(ServerConnection.getControlObject().getClassName() $= "Player" || (ServerConnection.getControlObject().getClassName() $= "Camera"))
{
cancel($Client::ShowScore::Schedule);

$Client::ShowScore::Schedule = schedule(100, 0, ShowScore_UpdateScore);

commandToServer('openPlayerList');
schedule(50, commandToServer, closePlayerList);
}
}
}

anyway, COMPLETELY off topic, who are you elm? You seem to be decent at coding but I just saw your name pop up not too long ago and I've never seen an "elm" in game.
Elm is an alt that randomly popped out of the ground and is much nicer and more helpful than certain other alts running around..
Edit: I don't mean you slick.

Anyone know anything about the console messages?