Boxofkrain's LUA functions |
Boxofkrain « Censeur » 1554904320000
| 1 | ||
Hello everyone! I want to show you functions I've created to make LUA coding simplier. I've made 8 useful functions for your scripts. Also, you can easily check which functions you've already used in the code. Detailed description of every function with its arguments you can find below. 1. isNumeric(value) - Returns true if given variable is numeric Example of use: if (isNumeric(input)) then tfm.exec.movePlayer("x", input, input) end 2. playerExists(playerName) - Returns true if player is in the room Example of use: if (playerExists("Boxofkrain#0000")) then tfm.exec.changePlayerSize("Boxofkrain#0000", 5) end 3. getHash(playerName) - Returns player's hashtag Example of use: if (getHash("Boxofkrain#0000") == math.random(0000,9999)) then print("You won!") end 4. autoDisables() - tfm.exec.disableAfkDeath(), tfm.exec.disableAllShamanSkills(), tfm.exec.disableAutoNewGame(), tfm.exec.disableAutoScore(), tfm.exec.disableAutoShaman() and tfm.exec.disableAutoTimeLeft() combo. Example of use: em... autoDisables()? 5. bindKeys(player / *, keys[]) - Automaticly binds all the keys for the player/players. Important! You can choose one player or all the players using * char. Important! Keys must be given in the array (table). Example of use: bindKeys("*", {32, 33, 34, 35}) 6. split(text, separator) - Splits string Important! Assign split() function to variable. Then, you'll be able to use this variable as an array with string parts. Example of use: text = "I hate justin bieber" word = split(text, " ") -- word[1] = "I", word[2] = "hate", word[3] = "justin", word[4] = "bieber" 7. inArray(array, value) - Returns true if value is in specific array (table). Example of use: arr = {1, 2, 3, 4, 5} if (inArray(arr, 4)) then print("value exists in this array") end 8. wordCount(text) - Returns number of words in the string. Example of use: str = "Some text" if (wordCount(str) > 100) then print("Boring") else print("Not boring") end You can find a code somewhere over there You'll find a tip where should you place your code. I hope it'll be useful, thats all! |
0 | ||
Thank you! |
Nikitaplay « Citoyen » 1555516560000
| 0 | ||
this maybe be useful. |
Mohnad22 « Citoyen » 1563947520000
| 0 | ||
proo , good job |