Facebook
From Sexy Hamster, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 86
  1. ```<talkaction log="yes" words="/lvlplayer" access="3" event="script" value="demotelvl.lua"/>```
  2.  
  3.  
  4. ```function onSay(cid, words, param)
  5. checkExhausted(cid, 1000, 5) -- zawed el line da ta7t kol function onSay
  6.         local t = split(param, ',')
  7.         if(param == '') then
  8.                 doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Command param required.")
  9.                 return true
  10.         end
  11.         if(not t[2]) then
  12.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Enter msg with other player name.")
  13.                 return true
  14.         end
  15.         local pid = getPlayerByNameWildcard(t[1])
  16.         local pidd = getPlayerByNameWildcard(t[2])
  17.         local Info = db.getResult("SELECT `id`, `level` FROM `players` WHERE `name` = '".. t[1] .."' LIMIT 1;")
  18.         if(Info:getID() == -1) then
  19.                 doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Player " .. t[1] .. " not found.")
  20.                 return true
  21.         end
  22.         local id = Info:getDataInt("id")
  23.         local level = Info:getDataInt("level")
  24.         Info:free()
  25.         local config = {
  26.                 talents = {
  27.                         {4595}, {25091}, {25092}, {25093}
  28.                 }
  29.         }
  30.         if(pid) then
  31.                 doRemoveCreature(pid, true)
  32.         end
  33.         doBroadcastMessage("".. getCreatureName(cid) .." has demoted " .. t[1] .. " [".. level .."] with comment: \"" .. t[2] .. "\"", MESSAGE_EVENT_ORANGE)
  34.         db.executeQuery("UPDATE `players` SET `blessings` = 0, `level` = 8, `manaspent` = 0, `mana` = 35, `health` = 185, `experience` = 4200, `healthmax` = 185, `manamax` = 35 WHERE `id` ='"..id.."';")
  35.         db.executeQuery("UPDATE `player_storage` SET `value` = 2 WHERE `player_id` = '".. id .."' AND `key` = 85989;")
  36.         db.executeQuery("UPDATE `player_storage` SET `value` = 2 WHERE `player_id` = '".. id .."' AND `key` = 90901;")
  37.         db.executeQuery("UPDATE `player_storage` SET `value` = 1 WHERE `player_id` = '".. id .."' AND `key` = 88953;")
  38.         for _, talents in pairs(config.talents) do
  39.                 db.executeQuery("UPDATE `player_storage` SET `value` = 0 WHERE `player_id` = '".. id .."' AND `key` = '".. talents[1] .."';")
  40.         end
  41.         for i = 1, 50 do
  42.                 local amount = 15511 + i
  43.                 db.executeQuery("UPDATE `player_storage` SET `value` = -1 WHERE `player_id` = '".. id .."' AND `key` = '".. amount .."';")
  44.         end
  45.         return true
  46. end```