DU
action

Mudar nome do Player. ( /rn Name, NewName, time )

Por DuuhCarvalho, 17 de abr. de 2014 em Actions e Talkactions

mudar
nome
player
/rn
renomear
rename
duuh
carvalho
script
10
2.3k
17 de abril de 2014 às 22:16

[talkactions]

Bom, o titulo já diz tudo, você muda o nome de um certo player.

/rn Nome do Player, Novo Nome, tempo para o player ser kickado(em segundos).

Exemplo :

/rn Duuh, Duuh Carvalho, 5

Simples, porem útil.

Vá em data / talkactions / scripts.

cria um arquivo lua e cola isso dentro :

 

 

function onSay(cid, words, param)

if(param == '') then
doPlayerSendCancel(cid, "Command param required.")
return true
end

local t = string.explode(param, ",")

newName = tostring(t[2])
time = tonumber(t[3])

    local target = getPlayerByNameWildcard(t[1])
    if(not target) then
        target = getCreatureByName(t[1])
        if(not target) then
            doPlayerSendCancel(cid, "Creature not found.")
            return true
        end
    end

    if(isPlayerGhost(t[1]) and getPlayerGhostAccess(t[1]) > getPlayerGhostAccess(cid)) then
        doPlayerSendCancel(cid, "Creature not found.")
        return true
    end

if (not t[2]) then
 return doPlayerSendCancel(cid, "New name not found")
end

if (not t[3]) then
 return doPlayerSendCancel(cid, "Time not found")
end
 
          function removePlayer()
             if isPlayer(target) then
               doRemoveCreature(target)
             end
          end

if isPlayer(target) then
  if getCreatureCondition(target, CONDITION_INFIGHT) == FALSE then
    db.executeQuery("UPDATE `players` SET `name` = '"..newName.."' WHERE `id` = "..getPlayerGUID(target)..";")
       addEvent(removePlayer, time*1000)
         doPlayerSendTextMessage(target, 25, "Você será kickado em "..time.." segundo(s) para que seu nome seja alterado.")
        doSendMagicEffect(getCreaturePosition(target), 35)
       doSendMagicEffect(getCreaturePosition(cid), 27)
      doPlayerSendTextMessage(cid, 25, "O nome do Player foi alterado com sucesso.")
   else
      doPlayerSendCancel(cid, "O player está com Battle.")
     doSendMagicEffect(getCreaturePosition(cid), 2)
   end
else
 doPlayerSendCancel(cid, "Você só pode mudar o nome de Player's.")
  doSendMagicEffect(getCreaturePosition(cid), 2)
end

return true
end

 

 

 

Coloque a tag em data / talkactions / talkactions.xml :

<talkaction log="yes" words="/rn" access="4" event="script" value="NomeDoArquivo.lua"/>

Simples :D

Editado Abril 18 por Killua

SkyFallS
17 de abril de 2014 às 22:27

1-Porque o prefixo ta action ?

 

2-Funciona em versão 10+?

Junior001J
17 de abril de 2014 às 22:30

Muito bom o script :) isso vai me ajudar :)

17 de abril de 2014 às 22:33

1-Porque o prefixo ta action ?

 

2-Funciona em versão 10+?

 

1 - algum bug, não estava aparecendo a opção de escolher ..

ficou actions por padrão.

 

2 - Creio que sim , testa ae ><

 

 

Muito bom o script :) isso vai me ajudar :)

 

Que bom :) , brigado .

 

Abraços :D

xXMythuszXxX
17 de abril de 2014 às 22:45

Boa duuh, vou usar.

17 de abril de 2014 às 23:38

Boa duuh, vou usar.

Obrigado :D

MaenilseM
18 de abril de 2014 às 11:51

da pra diminuir o codigo.

 

enfim, parece estar funfando.

18 de abril de 2014 às 15:50

da pra diminuir o codigo.

 

enfim, parece estar funfando.

 

Sim, mais não é preciso : D

erenking123E
18 de abril de 2014 às 16:17

Ótimo Código estarei utilizando ;D

18 de abril de 2014 às 20:54

Ótimo Código estarei utilizando ;D

 

Obrigado, é muito útil coloquei no meu server também .