Ir para conteúdo

Featured Replies

Postado

Fala trutas! Firmeza total!

 

Então, deixo aqui pra vocês um script que eu uso e acho muito útil para todos gms, cms e gods.

 

Essa talkaction é usada para dar um item ao jogador ou remover o item dele; você não vai precisar mais ir até o player, criar o item e entregá -lo.

 

Vamos ao código:

 

Em Talkaction/scripts/

Crie um arquivo chamado "dip_rip" com extensão "lua", ficando assim:

Citar

dip_rip.lua

 

Agora, adicione esse código dentro dele:

 

Citar

--[[( Marcryzius )]]-- 
local MSCB = MESSAGE_STATUS_CONSOLE_BLUE 

 

function dip (cid,item,quant) 
local uid = doCreateItemEx(item,quant) 
local get = getThing(uid) 
   if(get.type > 0)then 
      if(doPlayerAddItemEx(cid,uid) == false)then 
         return false,'The player can not receive the item {'..getItemNameById(item)..'} because not have space.' 
      end 
   elseif(uid and getItemNameById(item))then 
      for _= 1,quant do 
         if(doPlayerAddItem(cid,item,1,false) == false)then 
            return false 
         end 
      end 
   else 
      return false,'Item not found!' 
   end 
   return true 
end 

function rip (cid,item,quant) 
   if(doPlayerRemoveItem(cid,item,quant) == false)then 
      return false 
   end 
   return true 
end 

 

function onSay(cid, words, param) 
if(param == "") then return true,doPlayerSendTextMessage(cid,MSCB, "Command param required.")end 
local C,t = {},string.explode(param, ",") 
C.ret = RETURNVALUE_NOERROR 
C.tmp = getCreaturePosition(cid) 
C.amount = (t[3] == nil) and 1 or tonumber (t[3]) 
C.nameitem = (tonumber(t[2]) == nil) and t[2] or getItemNameById(t[2]) 
C.id = (tonumber(t[2]) == nil) and getItemIdByName(t[2]) or tonumber(t[2]) 
C.pid = getPlayerByNameWildcard(t[1]) 

if(C.id == LUA_ERROR)then return true,doPlayerSendTextMessage(cid,MSCB, "Item wich such name or id does not exists.")end 
if(C.pid == 0 or (isPlayerGhost(C.pid) == true and getPlayerAccess(C.pid) > getPlayerAccess(cid))) then 
   return true,doPlayerSendTextMessage(cid,MSCB, "Player " .. param .. " is not currently online.") 
end 
   if(words == '/rip')then 
      if(rip(C.pid,C.id,C.amount) == false)then 
         doPlayerSendTextMessage(cid,MSCB, "the player ("..getCreatureName(C.pid)..") does not have that item ("..C.nameitem..") or the quantity of them ("..C.amount..").") 
      else 
         doPlayerSendTextMessage(cid,MSCB,"was removed from the player ("..getCreatureName(C.pid)..") of the item name ("..C.nameitem..") and Item Id ("..C.id..") in the amount of "..C.amount..".") 
      end 
   else 
   local bool,msg = dip(C.pid,C.id,C.amount) 
      if(bool == false)then 
         doPlayerSendTextMessage(cid,MSCB,msg) 
      else 
         doPlayerSendTextMessage(cid,MSCB, "The player ("..getCreatureName(C.pid)..") received the item, ("..C.nameitem..") and Id ("..C.id..") in the amount of ("..C.amount..").") 
         doPlayerSendTextMessage(C.pid,MSCB, "You have received the item, ("..C.nameitem..") in the amount of ("..C.amount..") to the ("..getPlayerGroupName(cid)..") ("..getCreatureName(cid)..").") 
      end 
   end 
   return true 
end 

 

 

Agora em talkaction/talkactions.xml

Adicione essa tag:

 

Citar

<talkaction log="yes" words="/dip;/rip" access="3" event="script" value="dip_rip.lua"/>

 

 

É isso ae galera, espero que vocês curtam o sistema.

 

  • 4 months later...

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo