This is what we do on Vesporia:
PHP Code:
join( "functions_gui" );
//#CLIENTSIDE
function onCreated()
{
showMenu();
}
function showMenu()
{
profile = "vspWindow";
width = 300;
height = 300;
center();
setVars();
text = "hehe window";
}
The functions basically look like this:
PHP Code:
//#CLIENTSIDE
function center()
{
// how to center
}
Think of a class as a set of functions added onto the script.
If I have a class that does this:
PHP Code:
function foo()
{
return true;
}
and a script that does this:
PHP Code:
join( "myclass" );
function onCreated()
{
echo( foo() );
}
Then you can think of it like this:
PHP Code:
function onCreated()
{
echo( foo() );
}
function foo()
{
return true;
}
You can use this. to work with the object whether it is joined to a player or an NPC.
PHP Code:
//#CLIENTSIDE
function onCreated()
{
this.chat = "hi";
}
That will work whether joining to an NPC or a player.