Scripting/Squirrel/Client Events/GUI::InputReturn
This wiki is using an old backup from 2020
Some information may be old/missing
Syntax
player - The instance.
Arguments
- player
Example
Testing<-
{
Box = null
}
function Script::ScriptLoad()
{
Testing.Box = GUIEditbox( );
Testing.Box.Pos = VectorScreen( sX*0.080, sY*0.200 );
Testing.Box.Size = VectorScreen( sX * 0.25, sY * 0.05 );
Testing.Box.Alpha = 210;
Testing.Box.AddFlags( GUI_FLAG_ANIMATION | GUI_FLAG_INHERIT_ALPHA | GUI_FLAG_BORDER);
Testing.Box.SendToTop();
}
function GUI::InputReturn(editbox)
{
switch( editbox )
{
case Testing.Box:
if( Testing.Box.Text.len() > 3 )
{
local Data = Stream();
Data.WriteString(Testing.Box.Text);
Data.WriteInt(1);
Server.SendData(Data);
}
break;
}
}
//----------------------- S E R V E R S I D E --------------------------//
function onClientScriptData(player)
{
local string = Stream.ReadString(), int = Stream.ReadInt();
switch( int )
{
case 1:
if( string.len() > 2 )
{
Message(player.Name+": "+string)
}
}
}
Notes
When you type the text in the Box then press the "ENTER" key it is send a string next to the server side. The text is received as "+ string +"