Scripting/Squirrel/Client Events/GUI::InputReturn: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
Kennedyarz (talk | contribs) (Created page with " == Syntax == <pre>player - The instance.</pre> == Arguments == * player == Example == <source lang=squirrel> Testing<- { Box = null } function Script::ScriptLoad()...") |
Kennedyarz (talk | contribs) No edit summary |
||
Line 24: | Line 24: | ||
Testing.Box.AddFlags( GUI_FLAG_ANIMATION | GUI_FLAG_INHERIT_ALPHA | GUI_FLAG_BORDER); | Testing.Box.AddFlags( GUI_FLAG_ANIMATION | GUI_FLAG_INHERIT_ALPHA | GUI_FLAG_BORDER); | ||
Testing.Box.SendToTop(); | Testing.Box.SendToTop(); | ||
Testing.window.AddChild( | Testing.window.AddChild(Testing.Box); | ||
} | } | ||
Revision as of 11:08, 17 June 2017
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();
Testing.window.AddChild(Testing.Box);
}
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 +"