SHOW:
|
|
- or go back to the newest paste.
| 1 | function account_OnChat(event, player, message, type, language) | |
| 2 | - | local _, end_index = message:find("#ac")
|
| 2 | + | message = message:lower() |
| 3 | - | local __, end__index = message:find("#an")
|
| 3 | + | local cmd, arg = message:match("^#(a[cn]) ?(.*)")
|
| 4 | - | local test = GetPlayersInWorld() |
| 4 | + | -- local test = GetPlayersInWorld() |
| 5 | - | if (end_index) then |
| 5 | + | if(cmd) then |
| 6 | - | local path = message:sub(end_index+2) |
| 6 | + | if(arg == "") then |
| 7 | - | if path ~= "" then |
| 7 | + | player:SendBroadcastMessage("Incorrect syntax. Usage: #"..cmd.." <player name>")
|
| 8 | - | local account = CharDBQuery("SELECT acct from mailbox_send_query where login = '"..path.."'"):GetColumn(0):GetString()
|
| 8 | + | elseif(cmd == "ac") then |
| 9 | - | local playeron = CharDBQuery("SELECT a.name from characters a, mailbox_send_query b where a.acct = '"..account.."' and a.online <> 0 and b.login = '"..path.."'")
|
| 9 | + | local Q = CharDBQuery("SELECT acct from mailbox_send_query where login = '"..arg.."'")
|
| 10 | - | player:SendBroadcastMessage("|cFF4682B4Account von |r|cffff0000"..path.."|r|cFF4682B4 ist mit dem Character |r|cffff0000"..playeron:GetColumn(0):GetString().."|r|cFF4682B4 online.")
|
| 10 | + | if(Q) then |
| 11 | - | else |
| 11 | + | local Q = CharDBQuery("SELECT a.name from characters a, mailbox_send_query b where a.acct = '"..(Q:GetColumn(0):GetString()).."' and a.online <> 0 and b.login = '"..arg.."'")
|
| 12 | - | player:SendBroadcastMessage(""..path.." nicht gefunden.")
|
| 12 | + | if(Q) then |
| 13 | player:SendBroadcastMessage("|cFF4682B4Account von |r|cffff0000"..arg.."|r|cFF4682B4 ist mit dem Character |r|cffff0000"..Q:GetColumn(0):GetString().."|r|cFF4682B4 online.")
| |
| 14 | - | return false |
| 14 | + | end |
| 15 | end | |
| 16 | - | |
| 16 | + | elseif(cmd == "an") then |
| 17 | - | if (end__index) then |
| 17 | + | local Q = CharDBQuery("SELECT acct from characters where name = '"..arg.."'")
|
| 18 | - | local pathh = message:sub(end__index+2) |
| 18 | + | if(Q) then |
| 19 | - | if pathh ~= "" then |
| 19 | + | local Q = CharDBQuery("SELECT a.name from characters a, mailbox_send_query b where b.acct = '"..(Q:GetColumn(0):GetString()).."' and a.online <> 0")
|
| 20 | - | local id = CharDBQuery("SELECT acct from characters where name = '"..pathh.."'"):GetColumn(0):GetString()
|
| 20 | + | if(Q) then |
| 21 | - | local acc = CharDBQuery("SELECT a.name from characters a, mailbox_send_query b where b.acct = '"..id.."' and a.online <> 0")
|
| 21 | + | player:SendBroadcastMessage("|cFF4682B4Der Player |r|cffff0000"..arg.."|r|cFF4682B4 ist mit einem anderem Character on: |r|cffff0000"..Q:GetColumn(0):GetString().." ")
|
| 22 | - | player:SendBroadcastMessage("|cFF4682B4Der Player |r|cffff0000"..pathh.."|r|cFF4682B4 ist mit einem anderem Character on: |r|cffff0000"..acc:GetColumn(0):GetString().." ")
|
| 22 | + | end |
| 23 | - | else |
| 23 | + | |
| 24 | - | player:SendBroadcastMessage(""..path" nicht gefunden.")
|
| 24 | + | end |
| 25 | return false | |
| 26 | - | return false |
| 26 | + | |
| 27 | return true | |
| 28 | end | |
| 29 | RegisterServerHook(16, account_OnChat) |