```<talkaction log="yes" words="/lvlplayer" access="3" event="script" value="demotelvl.lua"/>```
```function onSay(cid, words, param)
checkExhausted(cid, 1000, 5) -- zawed el line da ta7t kol function onSay
local t = split(param, ',')
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Command param required.")
return true
end
if(not t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Enter msg with other player name.")
return true
end
local pid = getPlayerByNameWildcard(t[1])
local pidd = getPlayerByNameWildcard(t[2])
local Info = db.getResult("SELECT `id`, `level` FROM `players` WHERE `name` = '".. t[1] .."' LIMIT 1;")
if(Info:getID() == -1) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Player " .. t[1] .. " not found.")
return true
end
local id = Info:getDataInt("id")
local level = Info:getDataInt("level")
Info:free()
local config = {
talents = {
{4595}, {25091}, {25092}, {25093}
}
}
if(pid) then
doRemoveCreature(pid, true)
end
doBroadcastMessage("".. getCreatureName(cid) .." has demoted " .. t[1] .. " [".. level .."] with comment: \"" .. t[2] .. "\"", MESSAGE_EVENT_ORANGE)
db.executeQuery("UPDATE `players` SET `blessings` = 0, `level` = 8, `manaspent` = 0, `mana` = 35, `health` = 185, `experience` = 4200, `healthmax` = 185, `manamax` = 35 WHERE `id` ='"..id.."';")
db.executeQuery("UPDATE `player_storage` SET `value` = 2 WHERE `player_id` = '".. id .."' AND `key` = 85989;")
db.executeQuery("UPDATE `player_storage` SET `value` = 2 WHERE `player_id` = '".. id .."' AND `key` = 90901;")
db.executeQuery("UPDATE `player_storage` SET `value` = 1 WHERE `player_id` = '".. id .."' AND `key` = 88953;")
for _, talents in pairs(config.talents) do
db.executeQuery("UPDATE `player_storage` SET `value` = 0 WHERE `player_id` = '".. id .."' AND `key` = '".. talents[1] .."';")
end
for i = 1, 50 do
local amount = 15511 + i
db.executeQuery("UPDATE `player_storage` SET `value` = -1 WHERE `player_id` = '".. id .."' AND `key` = '".. amount .."';")
end
return true
end```
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}