Here are a few Lua scripts I have come upon during my journeys across Google. :P
Thought I would share them here for those that might be interested in them. I did not make these.
Global Chat System
With Rock Paper Scissors game!
Worldchat: This script will allow players to typ #chat msg. Everyone in the world will see that msg. If the player is an admin he will get [Admin] for his name. Same for GM and vip. You can ban players from the chat, and players can block the chat, so they dont see it.
Game script: This script will allow player to typ #game plrname. Then a msg will be send to that player to choose paper, stone or scissors. If he doesnt choose anything before 20 sec. It will mean he did not accept it. You can block players from challanging you to a game. Also everytime you play a game, it will get logged into a database. Same for the games you won and the games you lost. Players can use #gameinfo plrname to see the players blockstatus, how many games he played, and how many he won and lost.
Commands:
#chat - #chat msg, will broadcast a msg that every player can see unless they are banned or blocked the chat.
#blockchat - Blocks the chat.
#unblockchat - Unblocks the chat.
#banchatplr - #banchatplr plrname. Player will be banned from chat, you can use this while player is offline.
#unbanchatplr - Same as above but then for unban.
#game - #game plrname, will challange a player by name
#stone - You can only use this while playing a game, will make you choose stone
#scissors - Same as above but for scissors.
#paper - Same as above but for paper.
#blockgame - Blocks the game
#unblockgame - Unblocks the game
#gameinfo - #gameinfo plrname, shows if the player have blocked the game settings, how many games he played, and how many he won and lost.
#commands - Shows a command list ingame.
There are some DB Queries that need to be ran in order to use this. I have just put them in code boxes so you don't need to download anything:
Code:
DROP TABLE IF EXISTS `chat`;
CREATE TABLE `chat` (
`Player` varchar(21) collate latin1_general_ci default NULL,
`Banned` tinyint(3) default NULL,
`Block` tinyint(3) default NULL,
`Game` varchar(21) collate latin1_general_ci default NULL,
`Gphase` tinyint(3) default NULL,
`Played` tinyint(3) default NULL,
`Won` tinyint(3) default NULL,
`Lost` tinyint(3) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
As well, if your configuration files do not already have this LuaHypArc variable, make sure to add it to the end somewhere:
Code:
<LuaHypArc AllowCharDBQueries="1">
VIEW SCRIPT: Lua pastebin - collaborative debugging tool
---
Custom City Dismounting
If you've built a custom city, either with game objects or model editing, for your server, often you don't want people either gunning around on their mounts or flying over things that are supposed to be walls.
This little script will help you!
Just edit the values in RED :
RED = The zone ID of your custom city.
LIME = The Z (height) coordinates of where you want anti-mounting to be.
You can also add new X or Y coordinates to customize this even further, to make just a specific part in a zone (for example, one part of a city, or one field in the barrens or something.)
Code:
--[[
Dismounting Script
]]
print "City Dismount Script loaded."
function Plr_OnZoneEnter (Event, player, zoneId)
if (zoneId == XXXX) then
if (player:IsMounted() == true) and (player:HasAura(58600) == false) then
if (player:GetZ() <= XXX) and (player:GetZ() >= XXX) then
player:SendAreaTriggerMessage("You have entered a no-mount zone and are about to be dismounted!")
player:CastSpell(58600)
RegisterTimedEvent("Player_Dismount", 9900, 1)
end
end
end
end
function Plr_OnZoneEnterK (Event, player, zoneId)
if (zoneId == XXXX) and (player:HasAura(58600) == true) then
player:RemoveAura(58600)
end
end
function Player_Dismount (pUnit, Event, player)
if (player:HasAura(58600) == true) then
player:Dismount()
player:CastSpell(50085) -- Slow fall.
end
end
RegisterServerHook(12, "Plr_OnZoneEnter")
RegisterServerHook(12, "Plr_OnZoneEnterK")