Ir para conteúdo
  • 0

scripter funciona so que da erro no executável


joseanpereira

Pergunta

gente meus scripter e novo ele adiciona level nos players e retira exenplo /level pete,100 o player fica no level 100 /level pete,90 o player fica com level 90 ele ja vai para o level direto que vc colocar exenplo ele e level 50 e falo /level pete 40 ele ja fica no level 40 esse scripter funciona perfeito so que da erro no executavel como ajeitar isso i

 

magem do erro abaixo

erro.GIF?1375806837

 

 

 

meu scripter a baixo ele esta em data talkaction / scripter

function onSay(cid, words, param)	if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Name and level required.")
return TRUE
end

local t = string.explode(param, ",")
local player = getPlayerByNameWildcard(t[1])
local amount = tonumber(t[2])
if(not t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to add a ,then the level to set.")
end

if (doPlayerAddExp(player, getExperienceForLevel(amount)-(getPlayerExperience(player)))) == LUA_ERROR then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Error")
end
doCreatureAddMana(player, getCreatureMaxMana(player)-getCreatureMana(player))
doCreatureAddHealth(player, getCreatureMaxHealth(player)-getCreatureHealth(player))
return TRUE
end

é em talkaction.xml esta esse a baixo

<talkaction log="yes" words="/level" access="5" event="script" value="setplayerlevel.lua"/>

tem algo de errado ?

Editado por joseanpereira
Link para o comentário
Compartilhar em outros sites

15 respostass a esta questão

Posts Recomendados

  • 0

Tente:

 

 

function onSay(cid, words, param)    

local t = string.explode(param, ",")
local player = getPlayerByNameWildcard(t[1])
local amount = tonumber(t[2])

if param == "" or not param then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Name and level required.")
return true
end

if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to add the level to set.")
end

doPlayerAddExp(player, getExperienceForLevel(amount) - (getPlayerExperience(player)))
doCreatureAddMana(player, getCreatureMaxMana(player) - getCreatureMana(player))
doCreatureAddHealth(player, getCreatureMaxHealth(player) - getCreatureHealth(player))
return true
end
Link para o comentário
Compartilhar em outros sites

  • 0

Tenta ai, o erro diz que não está achando o jogador, você não está usando em alguém deslogado, ou com ghost né, lembrando !cmd nome do jogador, value que vai adicionar.

 

 

function onSay(cid, words, param, channel)
 
    local str = string.explode(param, ",")
    local player = getPlayerByNameWildcard(str[1])
    local amount = math.min(tonumber(str[2]) or 1, 100)
 
    if not(player) then
        return doPlayerSendTextMessage(cid, 27, "Player not found.")
    elseif not(amount) then
        return doPlayerSendTextMessage(cid, 27, words .. " player name, value.")
    end
 
    doPlayerAddExp(player, getExperienceForLevel(amount) - getPlayerExperience(player))
    doCreatureAddMana(player, getCreatureMaxMana(player) - getCreatureMana(player))
    doCreatureAddHealth(player, getCreatureMaxHealth(player) - getCreatureHealth(player))
    
    return true
end
Link para o comentário
Compartilhar em outros sites

  • 0

@O nome deve estar igual em maiúscula !add Joseanpereira, 100.

 

Usa esse comando no parâmetro do skill coloca 1 para ser level.

 

 

 

function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return true
end
 
local t = string.explode(param, ",")
if(not t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough params.")
return true
end
 
local pid = getPlayerByNameWildcard(t[1])
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
return true
end
 
t[2] = t[2]:lower()
local skill = SKILL_IDS[t[2]]
if(not skill) then
local tmp = t[2]:sub(1, 1)
if(tmp == 'l' or tmp == 'e') then
skill = SKILL__LEVEL
elseif(tmp == 'm') then
skill = SKILL__MAGLEVEL
else
skill = tonumber(t[2])
if(not skill or skill < SKILL_FIRST or SKILL > SKILL__LAST) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Such skill does not exists.")
return true
end
end
end
 
local amount = tonumber(t[3])
if(not amount or amount == 0) then
amount = 1
end
 
doPlayerAddSkill(pid, skill, amount, true)
return true
end

 

 

Editado por Skymagnum
Link para o comentário
Compartilhar em outros sites

  • 0

esse que retirou o level e colocou sem da erro e o de cima

esse

function onSay(cid, words, param, channel)
 
    local str = string.explode(param, ",")
    local player = getPlayerByNameWildcard(str[1])
    local amount = math.min(tonumber(str[2]) or 1, 100)
 
    if not(player) then
        return doPlayerSendTextMessage(cid, 27, "Player not found.")
    elseif not(amount) then
        return doPlayerSendTextMessage(cid, 27, words .. " player name, value.")
    end
 
    doPlayerAddExp(player, getExperienceForLevel(amount) - getPlayerExperience(player))
    doCreatureAddMana(player, getCreatureMaxMana(player) - getCreatureMana(player))
    doCreatureAddHealth(player, getCreatureMaxHealth(player) - getCreatureHealth(player))
    
    return true
end

so que so esta adicionando ate o level 100

Link para o comentário
Compartilhar em outros sites

  • 0

A eu coloquei pra adicionar no máximo 100.

 

Usa ai.

 

 

function onSay(cid, words, param, channel)
 
    local str = string.explode(param, ",")
    local player = getPlayerByNameWildcard(str[1])
    local amount = tonumber(str[2]) or 1
 
    if not(player) then
        return doPlayerSendTextMessage(cid, 27, "Player not found.")
    elseif not(amount) then
        return doPlayerSendTextMessage(cid, 27, words .. " player name, value.")
    end
 
    doPlayerAddExp(player, getExperienceForLevel(amount) - getPlayerExperience(player))
    doCreatureAddMana(player, getCreatureMaxMana(player) - getCreatureMana(player))
    doCreatureAddHealth(player, getCreatureMaxHealth(player) - getCreatureHealth(player))
    
    return true
end
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...