• 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!

Change name - use item

szajker123

New Member
Joined
May 12, 2012
Messages
195
Reaction score
0
Siema ziomki , mam problem a mianowicie jak zrobic by po wpisaniu komendy trza miec item ? inaczej nie bedzie dzialac (/namelock nick,new nick) i gdy nie bd mieli danego itemu to bedzie nam pisac you no have item czy cos podobnego , pomoze ktos ? ReP+++
 
pewnie cos takiego, podaj skrypt na te change name...
Lua:
if getPlayerItemCount(cid, itemid) == 0 then
    return doPlayerSendCancel(cid, "you no have item czy cos podobnego")
end

wkelj to przed tym gdzie skrypt sprawdza np czy juz istnieje taka nazwa gracz...
 
local itemId, count, maxTextLenght, delay = 1111, 1, 15, 2 * 1000
local blacklistParam = {"god", "cm", "gm", "tutor", "tester"}

function onSay(cid, words, param, channel)
local text, continue = "You will be kicked in 2 seconds.", true
local stringSpaceStart, stringSpaceEnd = string.find(param, "[%s]*")
if(db.getResult("SELECT `name` FROM `players` WHERE `name` = " .. db.escapeString(param) .. ";"):getID() ~= -1) then
text, continue = "That name is already in use.", false
elseif(getPlayerItemCount(cid, itemId) < count) then
text, continue = "You do not have enough premium points.", false
elseif(not getTilePzInfo(getCreaturePosition(cid))) then
text, continue = "You must be inside a protection zone to use this command.", false
elseif(not tostring(param)) then
text, continue = "Invalid parameter.", false
elseif((stringSpaceEnd - stringSpaceStart) > 1) then
text, continue = "Parameter contains too much spaces.", false
elseif(string.len(tostring(param)) > maxTextLenght) then
text, continue = "You can use a maximum of " .. maxTextLenght .. " characters.", false
elseif(string.find(param:lower(), "[^%l%s]") ~= nil) then
text, continue = "You can not use symbols.", false
else
for blacklist = 1, table.maxn(blacklistParam) do
if(string.find(param:lower(), blacklistParam[blacklist]) ~= nil) then
text, continue = "Invalid name entry.", false
break
end
end
end

if(continue == false) then
doPlayerSendCancel(cid, text)
return true
end

db.executeQuery("UPDATE `players` SET `name` = " .. db.escapeString(param) .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
doPlayerRemoveItem(cid, itemId, count)
doPlayerSendTextMessage(cid, 25, text)
addEvent(function(cid, forceLogout)
if(isPlayer(cid)) then
doRemoveCreature(cid, forceLogout)
end
end, delay, cid, false)
return true
end

To ten skrypt / ale gdzie mam wpisac id itemu ? bo mi chodzi o to ze bez itemu nie zmienisz nicku
 
w tamtym skrypcie nie dziala ale mam nowy
function sugested() --GName generator
local cons = {'b','c','d','f','g','h','i','j','k','l','m','n',' p','q','r','s','t','v','x','y','z'}
local vog = {"a",'e','i','o','u'}
local sibalas = {}
for i=1,#cons do
for e=1,#vog do
table.insert(sibalas,1,cons..vog[e])
end
end
local total = ""
for i=1,math.random(1,2) do
local nam = ""
for i=1,math.random(2,4) do
nam = nam..sibalas[math.random(1,#sibalas)]
end
if math.random(1,2) == 1 then
nam = nam..vog[math.random(1,#vog)]
elseif math.random(1,2) == 2 then
nam = nam..cons[math.random(1,#vog)]
end
total = total..(i == 2 and ' ' or '')..nam:sub(1,1):upper()..nam:sub(2,-1)
end
return total
end
function onSay(cid, words, param, channel)
if getPlayerItemCount(cid, 8305) == 0 then

return doPlayerSendCancel(cid, "you no have item czy cos podobnego")
end
if param == 'gen' then
doCreatureSay(cid,'Suggested name: '..sugested(),1)
return true
end
local param1,param2 = param:match('(.-)[;:,.]%s*(.+)')
param = param1 or param
param2 = param2 or sugested()
if not param then
doPlayerSendTextMessage(cid,25,'Use like this: /namelock Old name, New name')
return true
end
if param2:len() <= 2 or param2:len() > 20 then
doPlayerSendTextMessage(cid,25,'Please 3-20 characters.')
return true
end
if param2:match('[%a%d%s%u%l]+') ~= param2 then
doPlayerSendTextMessage(cid,25,'Please only A-Z 0-9')
return true
end
param2 = param2:sub(1,1):upper()..param2:sub(2,-1)

local p2 = getPlayerByName(param)
if p2 and isPlayer(p2) then
local id = getPlayerGUID(p2)
doPlayerPopupFYI(p2,'Changing your name. Please login again on your character list.')
addEvent(doRemoveCreature,2000,p2)
addEvent(function(id,param2)
db.executeQuery("UPDATE `players` SET `name` = '"..param2.."' WHERE `id` ="..id)
end,2100,id,param2)
else
doPlayerSendTextMessage(cid,25,'Player '..param..' not found.')
return true
end
doRemoveItem(item.uid,1)
return TRUE
end


W tym skrypcie wszystko dziala ale zedytuje mi ktos ten skrypt tak by sie nie dalo dawac w nicku cyfr np Jacek1 lub cos z liczba /?
 
no nie wierzę, ty do niczego nie dojdziesz jak będziesz tak robił -.- nie ma, że nie działa to zmieniasz na gotowy skrypt, bierzesz i sam edytujesz
 
NO HIDE jakbym nie probowal ... tylko niewiem gdzie to mam wpisac te liczby
local param1,param2 = param:match('(.-)[;:,.]%s*(.+)')
tu wpisywalem i niedalo sie juz wgl zmienic nicku na zaden poniewaz nie wykrywalo aktualnego nicku
local cons = {'b','c','d','f','g','h','i','j','k','l','m','n',' p','q','r','s','t','v','x','y','z'}
local vog = {"a",'e','i','o','u'}
local sibalas = {}
tu tez cos probowalem
wiec mi cos doradz
 
Back
Top