Ir para conteúdo

Featured Replies

Postado

Galera acabei de criar 1 script aqui e estou querendo saber se está faltando algo !! é porque sou novo nisso...

 

o script é 1 seguinte:
1 item que faz com que você teleporte para outro lugar ! porem tem que possuir lvl 1000 e pagar 50hd (2160)

 

Spoiler

function onUse(cid, item, fromPosition, itemEx, toPosition)
local level = 1000
local price = 50
toPos = {x=359, y=1667, z=7},
               if getPlayerLevel(cid) >= level and price >= 50 then
            doRemoveItem(2160, 50)
            doTeleportThing(cid, toPos)
            doPlayerSendTextMessage(cid, "Você foi teleportado !")
                else
            doPlayerSendTextMessage(cid, "Você não possui level " .. level .. " e não tem " .. price .. " HD!!!")  
                end
end return true

 

 

Por favor se estiver errado me avise, pois estou aqui para aprender e não para querer ser melhor que ninguém !!
:D 

Postado

Mude

toPos = {x=359, y=1667, z=7},

Para

toPos = {x=359, y=1667, z=7}


Mude
 

end return true

Para
 

	return true
end

Mude

doPlayerSendTextMessage(cid, "Você foi teleportado !")
                else
            doPlayerSendTextMessage(cid, "Você não possui level " .. level .. " e não tem " .. price .. " HD!!!")  

Para

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você foi teleportado !")
                else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui level " .. level .. " e não tem " .. price .. " HD!!!")  


A syntax estará correta após essas alterações, vendo as funções teve só erro no return e doPlayerSendTextMessage.
Teste e me avise aqui no tópico.

ichigo.gif
https://github.com/Cjaker/

  , _ ,
 ( o o )
/'` ' `'\                     ESTOU TE OBSERVANDO O_O
|'''''''|
|\\'''//|
   """

 

Postado

@ES Ichigo Percebi que você deixou passar isso:
 

 if getPlayerLevel(cid) >= level and price >= 50 then
doRemoveItem(2160, 50)

rsrs

if getPlayerLevel(cid) >= level and getPlayerItemCount(cid, 2160) >= price then
doPlayerRemoveItem(cid, 2160, 50)


 

Reformulando todo script, eu faria assim:
 

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local level = 1000
	local price = 50
	toPos = { x = 359 , y = 1667 , z = 7 }
	if getPlayerLevel(cid) >= level and getPlayerItemCount(cid, 2160) >= price then
		doPlayerRemoveItem(cid, 2160, price)
		doTeleportThing(cid, toPos)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você foi teleportado!")
	else
		if getPlayerLevel(cid) < level and getPlayerItemCount(cid, 2160) < price then
			str = "Você não possui level ".. level .." e não tem ".. price .." HD!!!"
		elseif getPlayerLevel(cid) < level and getPlayerItemCount(cid, 2160) >= price then
			str = "Você não possui level ".. level .."!"
		elseif getPlayerItemCount(cid, 2160) < price and getPlayerLevel(cid) >= level then
			str = "Você não possui ".. price .." HD!"
		end
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str) 
	end
	return true
end

Tem uma forma melhor, eu sei disso, porém eu me perco se botar muito if em cima de if kkk

Editado por luangop
erro meu (veja o histórico de edições)

Te ajudei? Clique em  Gostei ! 

²²²d¬¬b²²²

 

 

"She's got a smile that it seems to me...."  ♪♪

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