Ir para conteúdo
  • 0
Entre para seguir isso  
N0mad

Scripting Colocar tempo para msg ser enviada

Pergunta

N0mad    1
N0mad

Boa noite meus amigos tudo certo?
Preciso de ajuda para colocar meio que um tempo para uma msg ser enviada:

doPlayerSendTextMessage(cid, 27, (ballsw[getPlayerLanguage(cid)][1])..(str)..(ballsw[getPlayerLanguage(cid)][2]))


Aqui esta o script caso precise de alguma coisa:

local texts = {
	[PORTUGUESE] = {"Parabéns, você capturou um pokémon!", "Você já está carregando seis pokemons, seu novo pokemon será enviado ao Centro Pokémon em sua cidade natal!", "Desculpe, mas sua pokebola quebrou!", "A captura de pokémons não é permitida neste local.", "Este objeto não pode ser capturado.", "Você não derrotou este pokémon.", "Por favor, apenas utilize as Saffari Balls dentro da Saffari Zone.", "Este pokémon não pode ser capturado.", "Desculpe, não é possível."},
	[ENGLISH] = {"Congratulations, you catch a pokémon!", "You are holding six pokemons, your new pokemon will be sent to the Pokemon Center of your hometown!", "Sorry, your pokeball broke.", "Catching pokemons is not allowed inside this place.", "This thing is uncatchable.", "You did not defeat this pokémon.", "Please, only use Saffari Balls inside the Saffari Zone.", "This pokémon is uncatchable.", "Sorry, not possible."},
}
local ballsw = {
[PORTUGUESE] = {"Voce gastou ", "para capturar esse pokemon."},
[ENGLISH] = {"You used ", "to catch it."}
}
local ea = {
[PORTUGUESE] = "e ",
[ENGLISH] = "and ",
}
-- 2001 é abra | 2304 é Wanted Farfetch'd.
-- A cada pokemon novo, adicionar o próximo numero.

local time = 4
local pokeballs = {
	[9271] = {multiplier=1, failEffect=23, successEffect=24, shootEffect=17}, -- STARTER'S PB
	[2149] = {multiplier=1, failEffect=23, successEffect=24, shootEffect=17}, -- PB
	[2147] = {multiplier=2, failEffect=197, successEffect=198, shootEffect=19}, -- GB
	[2150] = {multiplier=3, failEffect=201, successEffect=202, shootEffect=20}, -- SB
	[2146] = {multiplier=4, failEffect=199, successEffect=200, shootEffect=27}, -- UB
    [4758] = {multiplier=4, failEffect=199, successEffect=200, shootEffect=27}, -- starter ball UB
	[2151] = {multiplier=1, failEffect=203, successEffect=204, shootEffect=36}, -- Saffari Ball
}
catchRate = 1

local function onCapturePokemon(cid, name, params, ballid)
	local txt = texts[getPlayerLanguage(cid)]
	if isCreature(cid) then
		doPlayerAddSoul(cid, 1)
		doPlayerSendTextMessage(cid, 27, txt[1].." ("..name..").")
		if #getPlayerPokeballs(cid) >= 6 then
			local pokeball = doCreatePokeball(name, params.pokeball-1)
			doItemSetAttribute(pokeball, "pokemon_sex", params.sex)
			doPlayerSendMailByName(getCreatureName(cid), pokeball)
			local creature = getPlayerPokemon(cid) == false and cid or getPlayerPokemon(cid)
			doSendMagicEffect(getCreaturePosition(creature), 173)
			--[[local file = io.open('data/logs/catchlog.txt','a')
			file:write(os.date().."  "..getCreatureName(cid).." caught a "..name.." with "..getItemNameById(params.pokeball).." at pos {X="..getCreaturePosition(cid).x.." Y="..getCreaturePosition(cid).y.." Z="..getCreaturePosition(cid).z..".\n")
			file:close() ]]
			doPlayerSave(cid)
			doPlayerSendTextMessage(cid, 27, txt[2])
			
		else
			local pokeball = doCreatePokeball(name, params.pokeball)
			doItemSetAttribute(pokeball, "pokemon_sex", params.sex)
			doPlayerAddItemEx(cid, pokeball)
		end
	end
end

local function onFailCapturePokemon(cid)
	local txt = texts[getPlayerLanguage(cid)]
	if isCreature(cid) then
		local creature = cid
		local creature = getPlayerPokemon(cid) == false and cid or getPlayerPokemon(cid)
		doSendMagicEffect(getCreaturePosition(creature), 166)
		doPlayerSendTextMessage(cid, 27, txt[3])
	end
end

function onUse(cid, item, frompos, item2, topos)
	local txt = texts[getPlayerLanguage(cid)]
	if isPlayerInsideMewtwoQuest(cid) or isInsideGhostPlagueQuest(cid) then
		doPlayerSendCancel(cid, txt[4])
		return true
	end
	if item2.uid == 0 then
		return false
	end
	
	local corpses = {}
	local it = getTileInfo(topos)
	if not it or it.things == 0 then return false end
	for i=1, it.things do
		local item = getTileThingByPos({x=topos.x, y=topos.y, z=topos.z, stackpos=i})
		if item.uid ~= 0 and isCorpse(item.uid) and getItemAttribute(item.uid, "corpseowner") == cid then
			item2 = item
			break
		end
	end
	
	if item2.uid == 0 or not isCorpse(item2.uid) then
		doPlayerSendCancel(cid, txt[5])
		return true
	end
	
	if getItemAttribute(item2.uid, "corpseowner") ~= cid then
		doPlayerSendCancel(cid, txt[6])
		return true
	end
	
	if getPlayerStorageValue(cid, Saffari.storage) > 0 and item.itemid ~= Saffari.pokeballId then
		doPlayerSendCancel(cid, txt[7])
		return true
	end
	
	for i, x in pairs(pokes) do
		if item2.itemid == x.c then
			local chances = (x.chance) * pokeballs[item.itemid].multiplier * catchRate
			if chances == 0 then
				doPlayerSendCancel(cid, txt[8])
				return TRUE
			end
			
			if math.random(1, 940) <= chances then
				doSendDistanceShoot(frompos, topos, pokeballs[item.itemid].shootEffect)
				doSendMagicEffect(topos, pokeballs[item.itemid].successEffect)
				doAddBrokeCount(cid, item.itemid, i)
				doEndCount(cid, item.itemid, i)
				addEvent(onCapturePokemon, time*1000, cid, i, {pokeball = getPokeballIn(item.itemid), sex = getItemAttribute(item2.uid, "corpsesex") }, item.itemid)
			else
				doSendDistanceShoot(frompos, topos, pokeballs[item.itemid].shootEffect)
				doSendMagicEffect(topos, pokeballs[item.itemid].failEffect)
				addEvent(onFailCapturePokemon, time*1000, cid)
				if getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 6 then
				doAddBrokeCount(cid, item.itemid, i)
				end
			end
			
			doRemoveItem(item.uid, 1)
			doRemoveItem(item2.uid, 1)
			
			return TRUE
		end
	end
	
	doPlayerSendCancel(cid, txt[9])
	return TRUE
end

function doAddBrokeCount(cid, ballid, pokemon)
local pbb = {9271, 2149}
local gbb = {2147}
local sbb = {2150}
local ubb = {2146, 4758}
local sfbb = {2151}
local sto = pokes[pokemon].sto
local toset = "nb = 0, gb = 0, sb = 0, sfb = 0, ub = 0;"
local toget = "nb = (.-), gb = (.-), sb = (.-), sfb = (.-), ub = (.-);"
if getPlayerStorageValue(cid, sto) == -1 then
setPlayerStorageValue(cid, sto, toset)
end
local b = string.gmatch(getPlayerStorageValue(cid, sto), toget)
local nc = ""
for nb, gb, sb, sfb, ub in (b) do
if isInArray(pbb, ballid) then
nc = "nb = "..(tonumber(nb)+1)..", gb = "..gb..", sb = "..sb..", sfb = "..sfb..", ub = "..ub..";"
break
elseif isInArray(gbb, ballid) then
nc = "nb = "..nb..", gb = "..(tonumber(gb) + 1)..", sb = "..sb..", sfb = "..sfb..", ub = "..ub..";"
break
elseif isInArray(sbb, ballid) then
nc = "nb = "..nb..", gb = "..gb..", sb = "..(tonumber(sb) + 1)..", sfb = "..sfb..", ub = "..ub..";"
break
elseif isInArray(ubb, ballid) then
nc = "nb = "..nb..", gb = "..gb..", sb = "..sb..", sfb = "..sfb..", ub = "..(tonumber(ub) + 1)..";"
break
elseif isInArray(sfbb, ballid) then
nc = "nb = "..nb..", gb = "..gb..", sb = "..sb..", sfb = "..(tonumber(sfb) + 1)..", ub = "..ub..";"
break
end
end
setPlayerStorageValue(cid, sto, nc)
return true
end

function doEndCount(cid, ballid, name)
local sto = pokes[name].sto
	local toget = "nb = (.-), gb = (.-), sb = (.-), sfb = (.-), ub = (.-);"
	local str = ""
	local b = getPlayerStorageValue(cid, sto)
	if b == -1 or b == -2 or not b then doAddBrokeCount(cid, ballid,name) end
local wast = {
nbs = 0,
gbs = 0,
sbs = 0,
ubs = 0,
sfbs = 0,
}
local str = ""
for nb, gb, sb, sfb, ub in (b:gmatch(toget)) do
wast.nbs = (tonumber(nb) > 0 and (tonumber(nb) == 1 and tonumber(nb).." poke ball " or tonumber(nb).." poke balls ")) or ""
wast.gbs = (tonumber(gb) > 0 and (tonumber(nb) == 1 and tonumber(gb).." great ball " or tonumber(gb).." great balls ")) or ""
wast.sbs = (tonumber(sb) > 0 and (tonumber(sb) == 1 and tonumber(sb).." super ball " or tonumber(sb).." super balls ")) or ""
wast.ubs = (tonumber(ub) > 0 and (tonumber(ub) == 1 and tonumber(ub).." ultra ball " or tonumber(ub).." ultra balls ")) or ""
wast.sfbs = (tonumber(sfb) > 0 and (tonumber(sfb) == 1 and tonumber(sfb).." saffari ball " or tonumber(sfb).." saffari balls ")) or ""
local aand = (wast.nbs ~= "" or wast.gbs~="" or wast.sfbs ~="" or wast.sbs~="" or wast.sbs~= "") and wast.ubs ~= ""
local sfbv = (wast.nbs ~= "" or wast.gbs~="") and wast.sfbs ~= ""
local sbv = (wast.nbs ~= "" or wast.gbs~="" or wast.sfbs ~= "") and wast.sbs ~= ""
local gbv = (wast.nbs ~= "") and wast.gbs ~= ""
str = ((wast.nbs)..(gbv and 	wast.gbs~="" and ", " or "")..(wast.gbs)..(sfbv and wast.sfbs~="" and ", " or "")..(wast.sfbs)..(sbv and wast.sbs~="" and ", " or "")..(wast.sbs)..(aand and ea[getPlayerLanguage(cid)] or "")..(wast.ubs))
end
doPlayerSendTextMessage(cid, 27, (ballsw[getPlayerLanguage(cid)][1])..(str)..(ballsw[getPlayerLanguage(cid)][2]))
setPlayerStorageValue(cid, sto, -1)
return true
end

Compartilhar este post


Link para o post
Compartilhar em outros sites

3 respostass a esta questão

Recommended Posts

  • 0
Majesty    1755
Majesty

 

addEvent(doPlayerSendTextMessage, 1000, cid, 27, (ballsw[getPlayerLanguage(cid)][1])..(str)..(ballsw[getPlayerLanguage(cid)][2]))

ou:

addEvent(doPlayerSendTextMessage, time*1000, cid, 27, (ballsw[getPlayerLanguage(cid)][1])..(str)..(ballsw[getPlayerLanguage(cid)][2]))

1000 = 1 segundo.

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
N0mad    1
N0mad
2 minutos atrás, Majesty disse:

 


addEvent(doPlayerSendTextMessage, 1000, cid, 27, (ballsw[getPlayerLanguage(cid)][1])..(str)..(ballsw[getPlayerLanguage(cid)][2]))

ou:


addEvent(doPlayerSendTextMessage, time*1000, cid, 27, (ballsw[getPlayerLanguage(cid)][1])..(str)..(ballsw[getPlayerLanguage(cid)][2]))

1000 = 1 segundo.

Muito obrigado, utilizei este método:

addEvent(doPlayerSendTextMessage, time*1000, cid, 27, (ballsw[getPlayerLanguage(cid)][1])..(str)..(ballsw[getPlayerLanguage(cid)][2]))

@Majesty

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Majesty    1755
Majesty

A questão neste tópico de suporte foi respondida e o autor do tópico resolveu a questão. Este tópico está fechado agora. Se você tiver outras perguntas, crie um novo tópico.

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×