Scripting/Squirrel/Client Events/GUI::ElementClick: 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) No edit summary |
m (Fixed style!) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 12: | Line 12: | ||
== Example == | == Example == | ||
< | <source lang=squirrel>function Script::ScriptLoad() | ||
function Script::ScriptLoad() | |||
{ | { | ||
::Hello <- GUIButton(VectorScreen(400,380), VectorScreen(200, 22), Colour(75,75,75), "Press Here", GUI_FLAG_BORDER | GUI_FLAG_VISIBLE); | ::Hello <- GUIButton(VectorScreen(400,380), VectorScreen(200, 22), Colour(75,75,75), "Press Here", GUI_FLAG_BORDER | GUI_FLAG_VISIBLE); | ||
Line 21: | Line 20: | ||
{ | { | ||
if (element == Hello) | if (element == Hello) | ||
{ | { | ||
Console.Print("Hello. welcome to VCMP") | Console.Print("Hello. welcome to VCMP") | ||
} | |||
} | } | ||
</source> | |||
</ | |||
=== Notes === | === Notes === | ||
The event [http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Events/GUI::ElementClick Script::ScriptLoad] and function [http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Functions/Console::Print Console::Print] were used in in this example. More info about them in the corresponding pages. | The event [http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Events/GUI::ElementClick Script::ScriptLoad] and function [http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Functions/Console::Print Console::Print] were used in in this example. More info about them in the corresponding pages. |
Latest revision as of 09:12, 4 April 2017
.
Syntax
player - The instance.
Arguments
- player
- GUIButton
Example
function Script::ScriptLoad()
{
::Hello <- GUIButton(VectorScreen(400,380), VectorScreen(200, 22), Colour(75,75,75), "Press Here", GUI_FLAG_BORDER | GUI_FLAG_VISIBLE);
}
function GUI::ElementClick(element, mouseX, mouseY)
{
if (element == Hello)
{
Console.Print("Hello. welcome to VCMP")
}
}
Notes
The event Script::ScriptLoad and function Console::Print were used in in this example. More info about them in the corresponding pages.