(PEDIDO) Ao logar mandar mensagem

LeoPetryScript
em Scripts

LeoPetryScript

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 14/03/20Posts: 25

Eu tentei montar um script onde quando o player logar e as storages estiverem menores que os.time enviar uma mensagem e se tiver maior que os.time mandar outra... alguém poderia arruma-lá pra mim?

local storage = 77000
local storage2 = 77001
local storage3 = 77002
local storage4 = 77003
local tempo = os.time()

function onLogin(cid)

local a = getPlayerStorageValue(cid, Storage) 
local b = getPlayerStorageValue(cid, Storage2)
local c = getPlayerStorageValue(cid, Storage3)
local d = getPlayerStorageValue(cid, Storage4)


if a and b and c and d < tempo  then
	SendEffect(cid)
end
if a and b and c and d > tempo then
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sob o Efeito de Gemas.")
end
return true
end
	
function SendEffect(cid)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sem o Efeito de Gemas.")
return TRUE
end

Marshmello

Alone ~ [✖‿✖]
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/04/16Posts: 831Gênero: Masculino

Tenta ai cara



function SendEffect(cid)
  doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sem o Efeito de Gemas.")
  return TRUE
end

local storages = {77000,77001,77002,77003}
local time = os.time()
function onLogin(cid)


  for i = 1, #storages do

    if getPlayerStorageValue(cid, storage[i]) - time < 1 then
      SendEffect(cid)
    end
  end

  doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sob o Efeito de Gemas.")

  return true
end

 

placa1.png.90a184502351cebe72cd7b69751e551d.png

Meu Facebook

INFOS:

Citar

CIDADE: Rio de janeiro

Idade: 22 anos
SOU: {"Scripter(lua)", "WebMaster", "ProgramadorC++"}
 

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}
if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

 

 

LeoPetryScript

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 14/03/20Posts: 25
4 horas atrás, Marshmello disse:

Tenta ai cara



function SendEffect(cid)
  doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sem o Efeito de Gemas.")
  return TRUE
end

local storages = {77000,77001,77002,77003}
local time = os.time()
function onLogin(cid)


  for i = 1, #storages do

    if getPlayerStorageValue(cid, storage[i]) - time < 1 then
      SendEffect(cid)
    end
  end

  doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sob o Efeito de Gemas.")

  return true
end

 

então man, funcionou, mas da 1 mensagem por storage, queria que fosse uma só mensagem sacas? se tiver sob efeito de alguma delas aparece uma msg q ta sob efeito, se n tiver sob efeito de nenhuma, aparece só uma msg q n está

Marshmello

Alone ~ [✖‿✖]
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/04/16Posts: 831Gênero: Masculino
function SendEffect(cid)
  doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sem o Efeito de Gemas.")
  return TRUE
end

local storages = {77000,77001,77002,77003}
local time = os.time()
function onLogin(cid)


  for i = 1, #storages do

    if getPlayerStorageValue(cid, storage[i]) - time < 1 then
      return false and SendEffect(cid)
    end
  end

  doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sob o Efeito de Gemas.")

  return true
end

 

placa1.png.90a184502351cebe72cd7b69751e551d.png

Meu Facebook

INFOS:

Citar

CIDADE: Rio de janeiro

Idade: 22 anos
SOU: {"Scripter(lua)", "WebMaster", "ProgramadorC++"}
 

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}
if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

 

 

LeoPetryScript

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 14/03/20Posts: 25

REP++ Então Marshmello, tive que fazer apenas algumas modificações razas pra funcionar perfeitamente =D créditos a você pela script, mas ai vai a funcional:: 

function SendEffect(cid)
  doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sem o Efeito de Gemas.")
  return TRUE
end

local storages = {77000,77001,77002,77003}
local time = os.time()
function onLogin(cid)

local e = 1 and 2 and 3 and 4
  for i = e, #storages do

	if getPlayerStorageValue(cid, 77000) - time > 1 then
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sob o Efeito da Task Gem.")
	elseif getPlayerStorageValue(cid, 77001) - time > 1 then
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sob o Efeito da Ring Gem.")
	elseif getPlayerStorageValue(cid, 77002) - time > 1 then
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sob o Efeito da Fishing Gem.")
	elseif getPlayerStorageValue(cid, 77003) - time > 1 then
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sob o Efeito da Mining Gem.")
	elseif getPlayerStorageValue(cid, storages[i]) - time < 1 then
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "Você está sem Efeito de Gemas.")
    end
  end

  return true
end

Muito obrigado por seu tempo, pode mover o topico para resolvido