Blockland Forums > Modification Help
Graphical User Interface help
(1/3) > >>
computermix:
Everyone here knows GUI stands for Graphical User Interface, right? Well, that was to get you straight.

So, I'm making a GUI that shows your score on the server. For all I know, its a window that has a text that says "0" on it, and I want it to show my score, but I do not know how to get the value from the server. For example, if I made a CityRP Gui, I would want it to show my cash/dems/whatever stuff there is. But, again, I don't know how to get the values.

If someone could show me how to get the values, and I'll do the rest, You know, 'Showing' them on the GUI.

Thanks if you can help.
SPooK:
I see that you are trying to do this to test your skills with the GUI creation. But doesn't the player list already have a score counter? As far as I'm concerned, ever type of minigame, even a cityrp, keeps score in the player list already.
computermix:

--- Quote from: SPooK on December 01, 2010, 08:29:10 PM ---I see that you are trying to do this to test your skills with the GUI creation. But doesn't the player list already have a score counter? As far as I'm concerned, ever type of minigame, even a cityrp, keeps score in the player list already.

--- End quote ---
Yes, but.. well, it hard to explain what I'm going to do with it. Besides, the score stuff in the F2 button is locked away in the dso files.
Uristqwerty:
The best (only?) way to get the score from the server is to have the server send you the score, usually through a commandToClient. One method would be to send the data any time it changes, while another way is to send it in response to a commandToServer.

Since you are mainly working on the GUI, you could use something like this:

server.cs:

--- Code: ---function serverCmdGetScore(%client)
{
    commandToClient('setScore', %client.score);
}

--- End code ---

client.cs:

--- Code: ---function clientCmdSetScore(%score)
{
    YourGUIScoreDisplay.text = %score;
}

--- End code ---

You would have to change score to something else in the serverCmd, clientCmd, commandToServer, and commandToClient, because it's probably already in use, and the display text name will probably need to be changed, too, but that code would be good enough for testing.
Pah1023:
@Uristqwerty
GUI.text = "Blah"; is glitchy.
do .setText();
Anyway, isn't there a command that the NewPlayerlistGUI uses to set its score?
Navigation
Message Index
Next page

Go to full version