Squirrel/Server/Functions/Utils/IsNum
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This function returns whether the string is a number == Syntax == <code>bool IsNum( string text )</code> == Arguments == * '''text''' - This is the string to check == Exampl...) |
|||
Line 27: | Line 27: | ||
=== Notes === | === Notes === | ||
− | The call [[Squirrel/Events/Player/OnPlayerCommand|OnPlayerCommand]] | + | The function [[Squirrel/Functions/Misc/MessagePlayer|MessagePlayer]] and call [[Squirrel/Events/Player/OnPlayerCommand|OnPlayerCommand]] were used in in this example. More info about them in corresponding pages. |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Functions/Misc}} | {{Squirrel/Functions/Misc}} |
Revision as of 15:53, 17 October 2008
This function returns whether the string is a number
Syntax
bool IsNum( string text )
Arguments
- text - This is the string to check
Example
This example tells the player if their input is a number when they type '/numbertest 123'
function OnPlayerCommand( id, cmd, text ) { if ( cmd == "numbertest" ) { if ( IsNum( text ) ) MessagePlayer( text + " is a number!", id ); else MessagePlayer( text + " is NOT a number!", id ); } }
Notes
The function MessagePlayer and call OnPlayerCommand were used in in this example. More info about them in corresponding pages.