Change Name In Game 3.0

JuniorPavani
em Actions e Talkactions

JuniorPavani

Exilado
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 09/02/14Posts: 20

Como o Nome Diz, Ele Serve Para Mudar Seu
Nome Dentro Do Jogo.

Vá Em data/talkactions/scripts, Copie Um Arquivo,
Renomeie-o Para changename.lua, e Cole Isso Nele -

local config = {

item = {

Id = 1111,

count = 0,

},

maxTextLenght = 15,

blacklistParam = {"account manager", "god", "cm", "gm", "tutor", "tester"},

minWordLenght = 3,

delay = 2

}



function onSay(cid, words, param, channel)

local textCancel, t = config.text, string.explode(param, ",")

if(param == '') then

return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")

elseif((getPlayerGUIDByName(t[1]) ~= nil) and (not getBooleanFromString(t[2]))) then

textCancel = "That name is already in use."

elseif(getPlayerItemCount(cid, config.item.Id) < config.item.count) then

textCancel = "You do not fulfill the requirements."

elseif(not getTilePzInfo(getCreaturePosition(cid))) then

textCancel = "You must be inside a protection zone to use this command."

elseif(string.len(tostring(t[1])) >= config.maxTextLenght) then

textCancel = "You can only use a maximum of " .. config.maxTextLenght .. " characters."

elseif(string.find(t[1]:lower(), "[^%l%s]") ~= nil) then

textCancel = "You cannot use symbols."

else

for blacklist = 1, table.maxn(config.blacklistParam) do

if(string.find(t[1]: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(t[1], "%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 = "" .. paramTemp .. "" .. space .. "" .. word .. ""

if(space == '') then

space = " "

end

end



local guid = getPlayerGUID(cid)

t[1] = paramTemp

doPlayerRemoveItem(cid, config.item.Id, config.item.count)

if(pcall(doPlayerChangeName, guid, oldName, t[1]) == false) then

db.executeQuery("INSERT INTO `player_namelocks` (`player_id`, `name`, `new_name`, `date`) VALUES (" .. guid .. ", " .. db.escapeString(oldName) .. ", " .. db.escapeString(t[1]) .. ", " .. os.time() .. ");")

db.executeQuery("UPDATE `players` SET `name` = " .. db.escapeString(t[1]) .. " WHERE `id` = " .. guid .. " LIMIT 1;")

end



doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your name has been changed successfully. 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

Em talkactions.xml Adicione Essa Tag -

<talkaction words="!changename;/changename;!namechange;/namechange" script="changename.lua" />

Créditos - Ratser

Te ajudei?? REP + e ficamos quites...  happyy.png

Atenciosamente,

 

Junior.
 

 

 

gifs-tumblr-01.gif      

 

Veja meus trabalhos

 

Change name in Game 3.0

!Rank Personalizado

Fishing System PXG

[Tutorial] Básico sobre Lua

[Tutorial] Básico sobre CreatureScripts

Callbacks

 

 

UntFrc

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/02/16Posts: 95Gênero: Outro

Eu tentei usar no meu server, mas não funciona. Ele não troca o nome.

Aparece esse erro na distro: OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: near "LIMIT": syntax error (UPDATE "players" SET "name" = 'Wellpos' WHERE "id" = 16 LIMIT 1;)

Yan Liima

Scripter,Programador,WebMaster.
avatar
Diretor
Diretor

INFOS

Grupo: DiretorRegistrado: 12/05/12Posts: 818Gênero: MasculinoChar no Tibia: [ADM] Night

Eu tentei usar no meu server, mas não funciona. Ele não troca o nome.

Aparece esse erro na distro: OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: near "LIMIT": syntax error (UPDATE "players" SET "name" = 'Wellpos' WHERE "id" = 16 LIMIT 1;)

 

É porque você usa SQLITE amigo essa script é só pra quem usa mysql.

════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═══╗

ALGUNS DOS MEUS TRABALHOS:

Spoiler

WODBOHS[DOWNLOAD]

Newstory dbo+nto+bleach[DOWNLOAD]

 

>> Mais infos <<

- Projetos lançados também feitos por mim {

DBO SKY

POKE SKY

WODBOWARS

Tic-tac-War

Dbo Universe(em desenvolvimento)

}

universe.thumb.png.6840320998d0fc1a4652b3db81a585c0.png

Separador.PNG

Te Ajudei? Rep + e ficamos Quits

imageproxy.png.84dce08dd18d31663a72aa1ce37b858a.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

UntFrc

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/02/16Posts: 95Gênero: Outro

 

É porque você usa SQLITE amigo essa script é só pra quem usa mysql.

 

Ta explicado. Obrigado :)

domvinicius

Horu$
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 15/06/16Posts: 31Gênero: MasculinoChar no Tibia: Horus

Nao intendi muito bem esse script troca o nome pelo item ou eu que so burro msm ??

 

vi isso akie e deduzi isso

 

item = {Id = 1111,count = 0,

 

 

PS > Cheguei no forum a uns dias atras to aprendendo :(

Poke X Ice

avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 16/11/16Posts: 215Gênero: Masculino

@domvinicius

 

item = {

Id = 1111, -- id do item quer vai precisar exemplo:2160

count = 0, -- quantidade quer vai precisar do item

domvinicius

Horu$
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 15/06/16Posts: 31Gênero: MasculinoChar no Tibia: Horus
1 hora atrás, Poke X Ice disse:

@domvinicius

 

item = {

Id = 1111, -- id do item quer vai precisar exemplo:2160

count = 0, -- quantidade quer vai precisar do item

continuo sem intender '=' e que tipo ele e um item action ou um talkition de shop ?