Ir para conteúdo

Featured Replies

Postado

galerinha to usando um script de addon para adicionar no char via storage só que ta ocorrendo seguinte erro

 

1/5/2015 9:36:9] [Error - CreatureScript Interface] 
[1/5/2015 9:36:9] data/creaturescripts/scripts/addonmount.lua:onLogin
[1/5/2015 9:36:9] Description: 
[1/5/2015 9:36:9] data/creaturescripts/scripts/addonmount.lua:46: attempt to index global 'player' (a nil value)
[1/5/2015 9:36:9] stack traceback:
[1/5/2015 9:36:9]  data/creaturescripts/scripts/addonmount.lua:46: in function <data/creaturescripts/scripts/addonmount.lua:1>

script 

 

function onLogin(cid)

 
 
local player = Player(cid)
local addons ={
 --[storage] = {outfit_male, outfit_female},
[28416] = {143, 147}, -- barbarian
[28417] = {134, 142}, -- warrior
[28418] = {152, 156}, -- assassins
[28419] = {465, 466}, -- Insectoid 
[28420] = {133, 141},  -- summoner
[28421] = {472, 471}, -- Entrepreneur 
[28422] = {144, 148}, -- duid
[28423] = {278, 279}, -- brotherhood
[28424] = {577, 578}, -- Dream Warden
[28425] = {610, 618}, -- Glooth Engineer
[28426] = {130, 138}, -- mage
[28427] = {634, 635}, -- Conjurer 
[28428] = {128, 136}, -- Citizen
[28429] = {129, 137}, -- Hunter
[28430] = {131, 139}, -- Kinghit
[28431] = {132, 140}, -- Noblewoman
[28432] = {145, 149}, -- Wizard
[28433] = {146, 150}, -- Oriental
[28434] = {151, 155}, -- Pirate
[28435] = {153, 157}, -- Beggar
[28436] = {154, 158}, -- Shaman
[28437] = {251, 252}, -- Norsewoman
[28438] = {268, 269}, -- Nightmare
[28439] = {273, 270}, -- jester
[28441] = {289, 288}, -- demonhunter
[28442] = {325, 324}, -- yalaharian
[28444] = {335, 336}, -- warnaster
[28445] = {327, 366}, -- wayfarer
[28446] = {430, 431}, -- afflicted
[28447] = {432, 433}, -- elementalist
[28448] = {463, 464}, -- deepling
[28449] = {512, 513}, -- crystal warlord
[28450] = {516, 514}, -- soil guardian
[28451] = {541, 542}, -- demon
[28452] = {574, 575}, -- cave explorer
[28453] = {619, 620}, -- jersey
[28454] = {637, 636}, -- beastmaster
[28455] = {632, 633} -- champion
}
 
for storage, addon in pairs(addons) do
if player:getStorageValue(storage) > 0 then
player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
player:addOutfitAddon(addon[1], 3)
player:addOutfitAddon(addon[2], 3)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Seu Addon full foi adicionado!")
player:setStorageValue(storage, 0)
end
end
return true

end

Editado por loreal (veja o histórico de edições)

  • Respostas 9
  • Visualizações 439
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • kkk dessa vez coloquei um 'end'. ps: coloquei para quando ele estiver com 0 de storage ele conseguir usar e setar a storage para ele não usar denovo.

Postado

Não testei ainda, vou ver se uso um dos meus editores lua para testar só um momento...

function onLogin(cid)
if isPlayer(cid) then
local player = Player(cid)
local addons ={
 --[storage] = {outfit_male, outfit_female},
[28416] = {143, 147}, -- barbarian
[28417] = {134, 142}, -- warrior
[28418] = {152, 156}, -- assassins
[28419] = {465, 466}, -- Insectoid 
[28420] = {133, 141},  -- summoner
[28421] = {472, 471}, -- Entrepreneur 
[28422] = {144, 148}, -- duid
[28423] = {278, 279}, -- brotherhood
[28424] = {577, 578}, -- Dream Warden
[28425] = {610, 618}, -- Glooth Engineer
[28426] = {130, 138}, -- mage
[28427] = {634, 635}, -- Conjurer 
[28428] = {128, 136}, -- Citizen
[28429] = {129, 137}, -- Hunter
[28430] = {131, 139}, -- Kinghit
[28431] = {132, 140}, -- Noblewoman
[28432] = {145, 149}, -- Wizard
[28433] = {146, 150}, -- Oriental
[28434] = {151, 155}, -- Pirate
[28435] = {153, 157}, -- Beggar
[28436] = {154, 158}, -- Shaman
[28437] = {251, 252}, -- Norsewoman
[28438] = {268, 269}, -- Nightmare
[28439] = {273, 270}, -- jester
[28441] = {289, 288}, -- demonhunter
[28442] = {325, 324}, -- yalaharian
[28444] = {335, 336}, -- warnaster
[28445] = {327, 366}, -- wayfarer
[28446] = {430, 431}, -- afflicted
[28447] = {432, 433}, -- elementalist
[28448] = {463, 464}, -- deepling
[28449] = {512, 513}, -- crystal warlord
[28450] = {516, 514}, -- soil guardian
[28451] = {541, 542}, -- demon
[28452] = {574, 575}, -- cave explorer
[28453] = {619, 620}, -- jersey
[28454] = {637, 636}, -- beastmaster
[28455] = {632, 633} -- champion
}
 
for storage, addon in pairs(addons) do
if player:getStorageValue(storage) > 0 then
player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
player:addOutfitAddon(addon[1], 3)
player:addOutfitAddon(addon[2], 3)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Seu Addon full foi adicionado!")
player:setStorageValue(storage, 0)
end
end
return true
end

Postado
  • Autor

Não testei ainda, vou ver se uso um dos meus editores lua para testar só um momento...

function onLogin(cid)
if isPlayer(cid) then
local player = Player(cid)
local addons ={
 --[storage] = {outfit_male, outfit_female},
[28416] = {143, 147}, -- barbarian
[28417] = {134, 142}, -- warrior
[28418] = {152, 156}, -- assassins
[28419] = {465, 466}, -- Insectoid 
[28420] = {133, 141},  -- summoner
[28421] = {472, 471}, -- Entrepreneur 
[28422] = {144, 148}, -- duid
[28423] = {278, 279}, -- brotherhood
[28424] = {577, 578}, -- Dream Warden
[28425] = {610, 618}, -- Glooth Engineer
[28426] = {130, 138}, -- mage
[28427] = {634, 635}, -- Conjurer 
[28428] = {128, 136}, -- Citizen
[28429] = {129, 137}, -- Hunter
[28430] = {131, 139}, -- Kinghit
[28431] = {132, 140}, -- Noblewoman
[28432] = {145, 149}, -- Wizard
[28433] = {146, 150}, -- Oriental
[28434] = {151, 155}, -- Pirate
[28435] = {153, 157}, -- Beggar
[28436] = {154, 158}, -- Shaman
[28437] = {251, 252}, -- Norsewoman
[28438] = {268, 269}, -- Nightmare
[28439] = {273, 270}, -- jester
[28441] = {289, 288}, -- demonhunter
[28442] = {325, 324}, -- yalaharian
[28444] = {335, 336}, -- warnaster
[28445] = {327, 366}, -- wayfarer
[28446] = {430, 431}, -- afflicted
[28447] = {432, 433}, -- elementalist
[28448] = {463, 464}, -- deepling
[28449] = {512, 513}, -- crystal warlord
[28450] = {516, 514}, -- soil guardian
[28451] = {541, 542}, -- demon
[28452] = {574, 575}, -- cave explorer
[28453] = {619, 620}, -- jersey
[28454] = {637, 636}, -- beastmaster
[28455] = {632, 633} -- champion
}
 
for storage, addon in pairs(addons) do
if player:getStorageValue(storage) > 0 then
player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
player:addOutfitAddon(addon[1], 3)
player:addOutfitAddon(addon[2], 3)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Seu Addon full foi adicionado!")
player:setStorageValue(storage, 0)
end
end
return true
end

primeiro deu um erro pq faltou um end dps coloquei end mais continuou dando mesmo erro 

 

[1/5/2015 9:58:35] [Error - CreatureScript Interface] 
[1/5/2015 9:58:35] data/creaturescripts/scripts/addonmount.lua:onLogin
[1/5/2015 9:58:35] Description: 
[1/5/2015 9:58:35] data/creaturescripts/scripts/addonmount.lua:3: attempt to call global 'Player' (a nil value)
[1/5/2015 9:58:35] stack traceback:
[1/5/2015 9:58:35] data/creaturescripts/scripts/addonmount.lua:3: in function <data/creaturescripts/scripts/addonmount.lua:1>
Postado

Tente assim.

function onLogin(cid) 
local player = if isPlayer(cid) then
local addons ={
 --[storage] = {outfit_male, outfit_female},
[28416] = {143, 147}, -- barbarian
[28417] = {134, 142}, -- warrior
[28418] = {152, 156}, -- assassins
[28419] = {465, 466}, -- Insectoid 
[28420] = {133, 141},  -- summoner
[28421] = {472, 471}, -- Entrepreneur 
[28422] = {144, 148}, -- duid
[28423] = {278, 279}, -- brotherhood
[28424] = {577, 578}, -- Dream Warden
[28425] = {610, 618}, -- Glooth Engineer
[28426] = {130, 138}, -- mage
[28427] = {634, 635}, -- Conjurer 
[28428] = {128, 136}, -- Citizen
[28429] = {129, 137}, -- Hunter
[28430] = {131, 139}, -- Kinghit
[28431] = {132, 140}, -- Noblewoman
[28432] = {145, 149}, -- Wizard
[28433] = {146, 150}, -- Oriental
[28434] = {151, 155}, -- Pirate
[28435] = {153, 157}, -- Beggar
[28436] = {154, 158}, -- Shaman
[28437] = {251, 252}, -- Norsewoman
[28438] = {268, 269}, -- Nightmare
[28439] = {273, 270}, -- jester
[28441] = {289, 288}, -- demonhunter
[28442] = {325, 324}, -- yalaharian
[28444] = {335, 336}, -- warnaster
[28445] = {327, 366}, -- wayfarer
[28446] = {430, 431}, -- afflicted
[28447] = {432, 433}, -- elementalist
[28448] = {463, 464}, -- deepling
[28449] = {512, 513}, -- crystal warlord
[28450] = {516, 514}, -- soil guardian
[28451] = {541, 542}, -- demon
[28452] = {574, 575}, -- cave explorer
[28453] = {619, 620}, -- jersey
[28454] = {637, 636}, -- beastmaster
[28455] = {632, 633} -- champion
}
 
for storage, addon in pairs(addons) do
if player:getStorageValue(storage) > 0 then
player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
player:addOutfitAddon(addon[1], 3)
player:addOutfitAddon(addon[2], 3)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Seu Addon full foi adicionado!")
player:setStorageValue(storage, 0)
end
end
return true
end

To com um probleminha pra baixar um editor aqui mais já já resolvo.

Postado
  • Autor

agora deu seguinte erro

[1/5/2015 10:4:43] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/addonmount.lua:2: unexpected symbol near 'if'
[1/5/2015 10:4:43] [Error - Event::checkScript] Cannot load script (data/creaturescripts/scripts/addonmount.lua)
[1/5/2015 10:4:43] data/creaturescripts/scripts/addonmount.lua:2: unexpected symbol near 'if'

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.6k

Informação Importante

Confirmação de Termo