Em 02/08/2020 em 19:19, LeoPetryScript disse:Estou testando essa sctipt, mas ela não está funcionando alguém poderia modifica-lo para quando o monstro morrer, todos os players que estiverem na area determinada ganham pontos a mais de storage? ex: setPlayerStorageValue(cid, 29111, (getplayerstoragevalue(cid, 29111)) + 10) ::
function onDeath(cid) local name = "Ferumbras" local Storage = 29111 local Sto = getPlayerStorageValue(cid, 29111) local pontos = 15 local from = {x= 1092, y= 1073, z= 6} local to = {x= 1093, y= 1075, z= 6} local tp = name[getCreatureName(cid)] if tp then if isInArea(getThingPos(cid), from, to) then if isPlayer(cid) then setPlayerStorageValue(cid, Storage, Sto + pontos) end end end return TRUE end(ta tudo errado provavelmente)
Não está correto seu script e essa linha não faz sentido
local tp = name[getCreatureName(cid)]
Vamos lá! Substitua seu código por esse:
local monster_name = "Ferumbras" -- NOME DO MONSTRO (TEM QUE SER IGUAL O NOME QUE ESTÁ NO ARQUIVO XML) local storage = 29111 -- STORAGE local storage_points_increment = 15 -- VALOR QUE SERÁ INCREMENTADO NA STORAGE (PONTOS) -- COORDENADAS DA ÁREA -- local position_area = { start_position = {x= 1092, y= 1073, z= 6}, end_position = {x= 1093, y= 1075, z= 6} } local message = true -- SE FOR EXIBIR MENSAGEM PARA OS PLAYERS QUE GANHAREM PONTOS SE ESTIVER DENTRO DA ÁREA DEIXE TRUE, CASO NÃO QUEIRA, MUDE PARA FALSE ------------------------------------------------- CÓDIGO ------------------------------------------------- function onDeath(cid) local check_position = {} for i = position_area.start_position.x, position_area.end_position.x do for j = position_area.start_position.y, position_area.end_position.y do for k = position_area.start_position.z, position_area.end_position.z do check_position[#check_position + 1] = {x= i, y= j, z= k, stackpos = 253} end end end if (isMonster(cid)) and (getCreatureName(cid) == monster_name) then for i = 1, #check_position do local player = getTileThingByPos(check_position[i]) if isInArea(check_position[i], position_area.start_position, position_area.end_position) then if isPlayer(player.uid) then setPlayerStorageValue(player.uid, storage, storage + storage_points_increment) doSendAnimatedText(getThingPos(player.uid), storage_points_increment.. " points", math.random(1, 255), player.uid) if message then doPlayerSendTextMessage(player.uid, MESSAGE_STATUS_CONSOLE_BLUE, "You gained " ..storage_points_increment.. " points for killing " ..monster_name.. ".") end return true end end end else return true end end
Lembrando que o nome do monstro na variável monster_name tem que ser igual a nomenclatura do monstro no arquivo xml, se não vai dar erro. E deixei para exibir mensagem para o player, caso não queira, mude a variável message para false.
Teste e veja se dá algum erro.


info
Grupo: Campones
Registrado: 14/03/20
Posts: 25
Reputação: 0
Estou testando essa sctipt, mas ela não está funcionando alguém poderia modifica-lo para quando o monstro morrer, todos os players que estiverem na area determinada ganham pontos a mais de storage? ex: setPlayerStorageValue(cid, 29111, (getplayerstoragevalue(cid, 29111)) + 10) ::
(ta tudo errado provavelmente)