Postado Fevereiro 21, 2013 12 anos Então galera eu queria uma ajuda no meu script de trocar de nome... Teria como por ele pra em vez de ter que ter 10k ter que ter 10 dias de premium? local config = { text = "Your name has been changed successfully.", item = { Id = 2168, -- Crystal Coin count = 1 -- How many }, maxTextLenght = 15, -- Maximum Text Length blacklistParam = {"character", "account manager", "god", "cm", "gm", "tutor", "tester", "testing", "target dummy"}, -- Black listed content minWordLenght = 3, -- Minimum of 3 letters per word newMethod = false, -- TRUE only if you are using new 0.3.7+ delay = 2 -- Delay to get kicked } function onSay(cid, words, param, channel) local textCancel = config.text if(param == '') then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") elseif(getPlayerGUIDByName(param) ~= nil) then textCancel = "That name is already in use." elseif(getPlayerItemCount(cid, config.item.Id) < config.item.count) then textCancel = "You do not have enough premium points." elseif(not getTilePzInfo(getCreaturePosition(cid))) then textCancel = "You must be inside a protection zone to use this command." elseif(string.len(tostring(param)) >= config.maxTextLenght) then textCancel = "You can only use a maximum of " .. config.maxTextLenght .. " characters." elseif(string.find(param:lower(), "[^%l%s]") ~= nil) then textCancel = "You cannot use symbols." else for blacklist = 1, table.maxn(config.blacklistParam) do if(string.find(param:lower(), config.blacklistParam[blacklist]) ~= nil) then textCancel = "Invalid name entry." break end end end if(config.text ~= textCancel) then doPlayerSendCancel(cid, textCancel) return true end local paramTemp, space, oldName = '', '', getCreatureName(cid) for word in string.gmatch(param, "%a+") do if(string.len(word) < config.minWordLenght) then doPlayerSendCancel(cid, "Each word must have a minimum of " .. config.minWordLenght .. " characters.") return true end paramTemp, space = "" .. paramTemp .. "" .. space .. "" .. word .. "", " " end local guid = getPlayerGUID(cid) param = paramTemp doPlayerRemoveItem(cid, config.item.Id, config.item.count) if(config.newMethod == true) then doPlayerChangeName(guid, oldName, param) else db.executeQuery("UPDATE `players` SET `name` = " .. db.escapeString(param) .. " WHERE `id` = " .. guid .. ";") end doPlayerSendTextMessage(cid, 25, "" .. config.text .. " You will be kicked in " .. config.delay .. " seconds.") addEvent(function(cid, forceLogout) if(isPlayer(cid)) then doRemoveCreature(cid, forceLogout) end end, config.delay * 1000, cid, false) return true end
Postado Fevereiro 21, 2013 12 anos ve se funciona ae!! doPlayerRemovePremiumDays(cid, days) local config = { text = "Your name has been changed successfully.", item = { Id = 2168, -- Crystal Coin count = 1 -- How many }, maxTextLenght = 15, -- Maximum Text Length blacklistParam = {"character", "account manager", "god", "cm", "gm", "tutor", "tester", "testing", "target dummy"}, -- Black listed content minWordLenght = 3, -- Minimum of 3 letters per word newMethod = false, -- TRUE only if you are using new 0.3.7+ delay = 2 -- Delay to get kicked } function onSay(cid, words, param, channel) local textCancel = config.text if(param == '') then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") elseif(getPlayerGUIDByName(param) ~= nil) then textCancel = "That name is already in use." elseif(getPlayerPremiumDays(cid) < 10) then textCancel = "You do not have enough premium days." elseif(not getTilePzInfo(getCreaturePosition(cid))) then textCancel = "You must be inside a protection zone to use this command." elseif(string.len(tostring(param)) >= config.maxTextLenght) then textCancel = "You can only use a maximum of " .. config.maxTextLenght .. " characters." elseif(string.find(param:lower(), "[^%l%s]") ~= nil) then textCancel = "You cannot use symbols." else for blacklist = 1, table.maxn(config.blacklistParam) do if(string.find(param:lower(), config.blacklistParam[blacklist]) ~= nil) then textCancel = "Invalid name entry." break end end end if(config.text ~= textCancel) then doPlayerSendCancel(cid, textCancel) eturn true end local paramTemp, space, oldName = '', '', getCreatureName(cid) for word in string.gmatch(param, "%a+") do if(string.len(word) < config.minWordLenght) then doPlayerSendCancel(cid, "Each word must have a minimum of " .. config.minWordLenght .. " characters.") return true end paramTemp, space = "" .. paramTemp .. "" .. space .. "" .. word .. "", " " end local guid = getPlayerGUID(cid) param = paramTemp --doPlayerRemoveItem(cid, config.item.Id, config.item.count) doPlayerRemovePremiumDays(cid, 10) if(config.newMethod == true) then doPlayerChangeName(guid, oldName, param) else db.executeQuery("UPDATE `players` SET `name` = " .. db.escapeString(param) .. " WHERE `id` = " .. guid .. ";") end doPlayerSendTextMessage(cid, 25, "" .. config.text .. " You will be kicked in " .. config.delay .. " seconds.") addEvent(function(cid, forceLogout) if(isPlayer(cid)) then doRemoveCreature(cid, forceLogout) end end, config.delay * 1000, cid, false) return true end Editado Fevereiro 21, 2013 12 anos por Carinhah (veja o histórico de edições)
Postado Fevereiro 21, 2013 12 anos Autor ve se funciona ae!! doPlayerRemovePremiumDays(cid, days) local config = { text = "Your name has been changed successfully.", item = { Id = 2168, -- Crystal Coin count = 1 -- How many }, maxTextLenght = 15, -- Maximum Text Length blacklistParam = {"character", "account manager", "god", "cm", "gm", "tutor", "tester", "testing", "target dummy"}, -- Black listed content minWordLenght = 3, -- Minimum of 3 letters per word newMethod = false, -- TRUE only if you are using new 0.3.7+ delay = 2 -- Delay to get kicked } function onSay(cid, words, param, channel) local textCancel = config.text if(param == '') then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") elseif(getPlayerGUIDByName(param) ~= nil) then textCancel = "That name is already in use." elseif(getPlayerPremiumDays(cid) < 10) then textCancel = "You do not have enough premium days." elseif(not getTilePzInfo(getCreaturePosition(cid))) then textCancel = "You must be inside a protection zone to use this command." elseif(string.len(tostring(param)) >= config.maxTextLenght) then textCancel = "You can only use a maximum of " .. config.maxTextLenght .. " characters." elseif(string.find(param:lower(), "[^%l%s]") ~= nil) then textCancel = "You cannot use symbols." else for blacklist = 1, table.maxn(config.blacklistParam) do if(string.find(param:lower(), config.blacklistParam[blacklist]) ~= nil) then textCancel = "Invalid name entry." break end end end if(config.text ~= textCancel) then doPlayerSendCancel(cid, textCancel) eturn true end local paramTemp, space, oldName = '', '', getCreatureName(cid) for word in string.gmatch(param, "%a+") do if(string.len(word) < config.minWordLenght) then doPlayerSendCancel(cid, "Each word must have a minimum of " .. config.minWordLenght .. " characters.") return true end paramTemp, space = "" .. paramTemp .. "" .. space .. "" .. word .. "", " " end local guid = getPlayerGUID(cid) param = paramTemp --doPlayerRemoveItem(cid, config.item.Id, config.item.count) doPlayerRemovePremiumDays(cid, 10) if(config.newMethod == true) then doPlayerChangeName(guid, oldName, param) else db.executeQuery("UPDATE `players` SET `name` = " .. db.escapeString(param) .. " WHERE `id` = " .. guid .. ";") end doPlayerSendTextMessage(cid, 25, "" .. config.text .. " You will be kicked in " .. config.delay .. " seconds.") addEvent(function(cid, forceLogout) if(isPlayer(cid)) then doRemoveCreature(cid, forceLogout) end end, config.delay * 1000, cid, false) return true end Não funcionou bem...
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.