• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Problem with my script!

Seumion

★ Spell Maker & Mapper ★
Joined
Feb 24, 2015
Messages
172
Reaction score
2
hello otland i have this demote script demote player from his level to level 8 but i want when i demote player all server see message
Seumion has demoted old zozo [500] with comment: "Healing Bot"

here is my script
PHP:
function onSay(cid, words, param)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Command param required.")
        return true
    end

    local pid = getPlayerByNameWildcard(param)
    if(not pid) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
        return true
    end
    local id = getPlayerGUID(pid)
if getCreatureStorage(pid, 90901) == -1 then
    db.query("UPDATE `players` SET `blessings` = 0, `level` = 8, `mana` = 35, `health` = 185, `experience` = 4200, `healthmax` = 185, `manamax` = 35 WHERE `id` ='"..id.."';")
    doPlayerAddExperience(pid, -getPlayerExperience(pid)+4200)
    setCreatureMaxHealth(pid, 185)
    setCreatureMaxMana(pid, 35)
    setPlayerStorageValue(pid, 85989, 0)
    setPlayerStorageValue(pid, 90901, getCreatureStorage(pid, 90901) + 2)
    setPlayerStorageValue(pid, 88953, 1)
    doCreatureAddMana(pid, -getCreatureMana(pid))
    doCreatureAddHealth(pid, -getCreatureHealth(pid))
    doCreatureSetDropLoot(pid, false)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Player " .. param .. " has been demoted.")
elseif getCreatureStorage(pid, 90901) >= 1 then
     doBroadcastMessage("player " .. param .. " got demot from level " ..  getPlayerLevel(pid) .. " to level 7!", MESSAGE_STATUS_CONSOLE_ORANGE)
    db.query("UPDATE `players` SET `blessings` = 0, `level` = 8, `mana` = 35, `health` = 185, `experience` = 4200, `healthmax` = 185, `manamax` = 35 WHERE `id` ='"..id.."';")
    doPlayerAddExperience(pid, -getPlayerExperience(pid)+4200)
    setCreatureMaxHealth(pid, 185)
    setCreatureMaxMana(pid, 35)
    setPlayerStorageValue(pid, 85989, 0)
    setPlayerStorageValue(pid, 90901, getCreatureStorage(pid, 90901) + 1)
    setPlayerStorageValue(pid, 88953, 1)
    doCreatureAddMana(pid, -getCreatureMana(pid))
    doCreatureAddHealth(pid, -getCreatureHealth(pid))
    doCreatureSetDropLoot(pid, false)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Player " .. param .. " has been demoted.")
    end
    return true
end
 
Delete this I guess, but it dosen't match with what you said but it's the only broadcast function.
Code:
doBroadcastMessage("player " .. param .. " got demot from level " .. getPlayerLevel(pid) .. " to level 7!", MESSAGE_STATUS_CONSOLE_ORANGE)
 
Delete this I guess, but it dosen't match with what you said but it's the only broadcast function.
Code:
doBroadcastMessage("player " .. param .. " got demot from level " .. getPlayerLevel(pid) .. " to level 7!", MESSAGE_STATUS_CONSOLE_ORANGE)
okay but i want when i demote a player i need broadcast message say
Admin has demoted old zozo [500] with comment: "Healing Bot"
 
Then just change it, you see exaclly what you need to do and should not be any problems.
If you don't know how to do it then you should actually leave otland for a while and study on lua.
 
hahahha this my script "right" and its work all u need to do change brodcast msg but u even don't know how to change it u need copy and past only u need to copy 100% from evo.se
 
hahahha this my script "right" and its work all u need to do change brodcast msg but u even don't know how to change it u need copy and past only u need to copy 100% from evo.se
it's not your business to copy or not you here for help if you don't need help as u like but don'r reply for my post
 
You can use something like this to separate the param string into sections by using a comma (,) in your command.

Code:
local p = string.explode(param, ",")

Then p[#] to get which param you want.

An example would be /comand seumion, healing bot, testing, 8, dog

p[1] = seumion
p[2] = healing bot
p[3] = testing
p[4] = 8
p[5] = dog

Hope that makes sense :)
 
You can use something like this to separate the param string into sections by using a comma (,) in your command.

Code:
local p = string.explode(param, ",")

Then p[#] to get which param you want.

An example would be /comand seumion, healing bot, testing, 8, dog

p[1] = seumion
p[2] = healing bot
p[3] = testing
p[4] = 8
p[5] = dog

Hope that makes sense :)
can u add this in the script?
but if not seumion who demote the player
 
Last edited:
Back
Top