GetTok

From Liberty Unleashed Wiki
Revision as of 11:36, 26 August 2014 by XMerkel 2 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function get one word from the string provided (e.g: Hi, i'm a string)

Syntax

  1. GetTok ( parameter szParams, string ToJump, int Number )

Example

This example tells the player the toks "Hi," and "string!"

  1.  
  2. function onPlayerCommand ( pPlayer, szCommand, szParams ) {
  3.  
  4. switch ( szCommand ) {
  5.  
  6. case "toks": {
  7.  
  8. local String = "Hi, i'ma a string! :D";
  9.  
  10. local One = GetTok ( String, " ", 1 ); // Get "Hi,"
  11. local Two = GetTok ( String, " ", 4 ); // Get "string!"
  12.  
  13. MessagePlayer ( One + Two, pPlayer );
  14. }
  15. }
  16. }
  17.  

Notes

The function MessagePlayer and call onPlayerCommand were used in this example. More info about them in corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox