JDB
OtLand Veteran
- Joined
- Jun 1, 2009
- Messages
- 4,145
- Solutions
- 2
- Reaction score
- 115
The Forgotten Server 0.3.6pl1
This is not really that special, but it is very helpful to have. I thought it might save people some time instead of accessing their databases.
Features:
Examples:
data/talkactions/talkactions.xml
data/talkactions/scripts/account.lua
This is not really that special, but it is very helpful to have. I thought it might save people some time instead of accessing their databases.
Features:
- Checks if the new name already exists or not.
- Checks if the new account number already exists or not.
- While changing the players name, it will check if he is name locked or not.
Examples:
Code:
/pass <player_name_here>, <new_password_here>
/acc <player_name_here>, <new_account_here>
/name <player_name_here>, <new_name_here>
data/talkactions/talkactions.xml
PHP:
<talkaction log="yes" words="/pass;/acc;/name" access="5" event="script" value="account.lua"/>
data/talkactions/scripts/account.lua
Code:
function onSay(cid, words, param, channel)
local p = string.explode(param, ',')
if(param == "") then
doPlayerSendCancel(cid, "Command requires param.")
return true
end
if(words == "/pass") then
if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then
return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.")
end
return db.executeQuery("UPDATE `accounts` SET `password` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s account password to " .. p[2] .. ".")
end
if(words == "/acc") then
if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then
return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.")
elseif(db.getResult("SELECT `id` FROM `accounts` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then
return doPlayerSendCancel(cid, "Sorry, but account [" .. p[2] .. "] already exists.")
end
return db.executeQuery("UPDATE `accounts` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s account number to " .. p[2] .. ".")
end
if(words == "/name") then
if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then
return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.")
elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then
return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.")
elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then
return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.")
end
return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".")
end
end