- Fórum
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- Sistema de Twitter no próprio jogo
LA
action
Sistema de Twitter no próprio jogo
Por larissaots, 30 de mai. de 2015 em Actions e Talkactions
otserv
tibia
script
1
825
Por larissaots, 30 de mai. de 2015 em Actions e Talkactions
info
Grupo: Banidos
Registrado: 07/04/13
Posts: 648
Reputação: +163
Créditos à Demonbholder.
Objetivo
É tipo um twitter. Você fala !tweet blablabla e é adicionada ao seu Twitter no servidor, ai para ver os tweets dos outros, basta usar !follow player e ver seus tweets. É um Twitter no servidor, não tem nada a ver com o site.
Testado em: 8.60.
Tutorial
talkactions.xml:
talkactions/scripts, crie arquivo com nome twittersystem.lua e bote isso dentro:
function onSay(cid, words, param) if words == "!tweet" then if getGlobalStorageValue(30070) == -1 then db.executeQuery("ALTER TABLE `players` ADD tweets TEXT NOT NULL DEFAULT twitter;") setGlobalStorageValue(30070, 1) end if param == "" then doPlayerSendCancel(cid, "Param required.") doSendMagicEffect(getCreaturePosition(cid), 2) else local datas = db.getResult("SELECT `tweets` FROM `players` WHERE `id` = ".. getPlayerGUID(cid) .. ";") local sentense = datas:getDataString("tweets") .. "\n" .. tostring(param) .. " " .. os.date("%c") db.executeQuery("UPDATE `players` SET `tweets` = '".. sentense .. "' WHERE `id` = ".. getPlayerGUID(cid) .. ";") return TRUE end end if words == "!follow" then if param == "" then doPlayerSendCancel(cid, "Param required.") doSendMagicEffect(getCreaturePosition(cid), 2) else local id = playerExists(tostring(param)) and getPlayerGUIDByName(tostring(param)) or getPlayerGUID(cid) local datas = db.getResult("SELECT `tweets` FROM `players` WHERE `id` = ".. id .. ";") local name = id == getPlayerGUID(cid) and getCreatureName(cid) or param doShowTextDialog(cid, 2160, name .. " " .. datas:getDataString("tweets")) end end return TRUE end