Author Topic: Graphical User Interface help  (Read 978 times)

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.

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.

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.
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.

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: [Select]
function serverCmdGetScore(%client)
{
    commandToClient('setScore', %client.score);
}

client.cs:
Code: [Select]
function clientCmdSetScore(%score)
{
    YourGUIScoreDisplay.text = %score;
}

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.

@Uristqwerty
GUI.text = "Blah"; is glitchy.
do .setText();
Anyway, isn't there a command that the NewPlayerlistGUI uses to set its score?

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: [Select]
function serverCmdGetScore(%client)
{
    commandToClient('setScore', %client.score);
}

client.cs:
Code: [Select]
function clientCmdSetScore(%score)
{
    YourGUIScoreDisplay.text = %score;
}

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.
So, Really, you need a "Commandtoclient" before you can receive the data?

So, I tried the client cmd thing, (You know, put the first script into server.cs and modded it, same with the client.cs) and it didn't work, as in it was still "0" And im sure my score was at least one.
« Last Edit: December 03, 2010, 04:46:19 PM by computermix »

Spelling out Graphical User Interface like that makes you sound nub-ish.

But, it did get me to view your topic, so I guess it served its purpose, then.

Spelling out Graphical User Interface like that makes you sound nub-ish.

But, it did get me to view your topic, so I guess it served its purpose, then.
So, why do you say this? Its off topic, and useless.

So, why do you say this? Its off topic, and useless.
Felt like it. :U

Why bother replying to just tell me how stupid I'm being?

Well, i do not completely get this gui value thing, can someone explain it a little better?