Ir para conteúdo
  • 0
Otfun

Scripting Erro Script Broadcast Player

Pergunta

Otfun    0
Otfun

Desktop_20-04-2016_20-47-22-777.png?1461

 

local cash = 500 -- Dinero que se nesecita para hacer el broadcast (en gps)
local levelneeded = 8 -- Level necesario para hacer el broadcast
local lenght = 100 -- Maximo de caracteres del mensaje
local messagesort = MESSAGE_STATUS_WARNING -- can be "MESSAGE_STATUS_WARNING" or "TALKTYPE_ORANGE_1" check your global.lua for more...
local exhaustTime = 2 * 60 * 1000 -- tiempo de exausted entre cada mensaje (para cambiar mas minutos cambia el 4 por x cantidad de minutos)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, exhaustTime)


function onSay(cid, words, param)
if (getPlayerStorageValue(cid, 85258) - os.time()) <= 0  then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Só Donates podem usar esse comando!")
return true
end
if getCreatureCondition(cid, CONDITION_EXHAUST) then
doPlayerSendCancel(cid, "Lo siento, nesecitas esperas 2 minutos para mansar otro mensaje")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
local name = getPlayerName(cid)
local level = getPlayerLevel(cid)
if not isCreature(cid) then
doPlayerSendCancel(cid, 'You haven\'t a target!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
if param == nil then
doPlayerSendCancel(cid, 'Nesecitas escribir algo!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
if string.len(param) > lenght then
doPlayerSendCancel(cid, 'No mas de ' .. lenght .. ' caracteres. ')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
if level < levelneeded then
doPlayerSendCancel(cid, 'Tu nesecitas ser level '..levelneeded..' para hacer un broadcast!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end 
if doPlayerRemoveMoney(cid, cash) then
broadcastMessage( ''..name..' ['..level..'] dice: ' .. param .. '', messagesort)
exhaustion.set(cid, storageValue,exhaustTime)
doAddCondition(cid, exhaust)
else
doPlayerSendCancel(cid, 'Tu nesecitas '..cash..' gps para hacer un broadcast!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return true
end

Compartilhar este post


Link para o post
Compartilhar em outros sites

5 respostass a esta questão

Recommended Posts

  • 0
Elwyn    106
Elwyn

deu o mesmo erro só q número 50 o anterior foi numero 43...

Erro meu, onde está assim:

 

        setStorageValue(cid, 85258, exhaustTime + os.time())

 

Troca por:

 

        setPlayerStorageValue(cid, 85258, exhaustTime + os.time())

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Zirun    11
Zirun

Os parâmetros da função set são 

set = function (cid, storage, time)

Você está chamando ela assim

exhaustion.set(cid, storageValue,exhaustTime)

Porem a variável storageValue não existe no seu código

Se o seu storage for 85258, como no código, então substitua o storageValue por 85258, ficando assim

exhaustion.set(cid, 85258, exhaustTime)

Deve funcionar  :peace:

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Elwyn    106
Elwyn

Os parâmetros da função set são 

set = function (cid, storage, time)

Você está chamando ela assim

exhaustion.set(cid, storageValue,exhaustTime)

Porem a variável storageValue não existe no seu código

Se o seu storage for 85258, como no código, então substitua o storageValue por 85258, ficando assim

exhaustion.set(cid, 85258, exhaustTime)

Deve funcionar  :peace:

Apesar que storageValule realmente não existe, o erro é porque "exhaustion" (é nil) por sí só também não existe.

 

 

attemp to index global 'exhaustion' <a nil value>

 

A correção pode ser feita trocando exhaustion.set por um setStorageValue, lembrando de setar como exhaustTime + os.time

 

 

 

 

local cash = 500 -- Dinero que se nesecita para hacer el broadcast (en gps)
local levelneeded = 8 -- Level necesario para hacer el broadcast
local lenght = 100 -- Maximo de caracteres del mensaje
local messagesort = MESSAGE_STATUS_WARNING -- can be "MESSAGE_STATUS_WARNING" or "TALKTYPE_ORANGE_1" check your global.lua for more...
local exhaustTime = 2 * 60 * 1000 -- tiempo de exausted entre cada mensaje (para cambiar mas minutos cambia el 4 por x cantidad de minutos)
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, exhaustTime)


function onSay(cid, words, param)
    if (getPlayerStorageValue(cid, 85258) - os.time()) <= 0  then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Só Donates podem usar esse comando!")
        return true
    end
    
    if getCreatureCondition(cid, CONDITION_EXHAUST) then
        doPlayerSendCancel(cid, "Lo siento, nesecitas esperas 2 minutos para mansar otro mensaje")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return true
    end
    
    local name = getPlayerName(cid)
    local level = getPlayerLevel(cid)
    if not isCreature(cid) then
        doPlayerSendCancel(cid, 'You haven\'t a target!')
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return true
    end
    
    if param == nil then
        doPlayerSendCancel(cid, 'Nesecitas escribir algo!')
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return true
    end
    
    if string.len(param) > lenght then
        doPlayerSendCancel(cid, 'No mas de ' .. lenght .. ' caracteres. ')
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return true
    end
    
    if level < levelneeded then
        doPlayerSendCancel(cid, 'Tu nesecitas ser level '..levelneeded..' para hacer un broadcast!')
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return true
    end
    
    if doPlayerRemoveMoney(cid, cash) then
        broadcastMessage( ''..name..' ['..level..'] dice: ' .. param .. '', messagesort)
        setStorageValue(cid, 85258, exhaustTime + os.time())
        doAddCondition(cid, exhaust)
    else
        doPlayerSendCancel(cid, 'Tu nesecitas '..cash..' gps para hacer un broadcast!')
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
    return true
end

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Otfun    0
Otfun

deu o mesmo erro só q número 50 o anterior foi numero 43...

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Otfun    0
Otfun

obrigado funciono, certinho....

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×