Ir para conteúdo
  • 0

[Resolvido] [Pedido] Evento só com no minimo 10 players online


Mdcrf

Pergunta

Então pessoal, eu tenho um ot de war e ele tem aquele evento de pegar a bandeira..... CTF

 

só que meu ot tá começando agr e queria que esse evento só acionasse com no minimo 10 players online... quem puder me ajudar ficaria muito grato

 

 

CTF.lua

 

local function doPlayerAddPercentLevel(cid, percent)

local player_lv, player_lv_1 = getExperienceForLevel(getPlayerLevel(cid)), getExperienceForLevel(getPlayerLevel(cid)+2)
local percent_lv = ((player_lv_1 - player_lv) / 200) * percent
doPlayerAddExperience(cid, percent_lv)
end
local global_bandeiras = {
time1 = 17779,
time2 = 17778,
}
local times = {
[1] = {30},
}
local timess = {
[2] = {30},
}
local TeamRed = 6666
local TeamBlue = 6667
function repeatFlagOnPlayer(cid)
if isPlayer(cid) then
local timeA = times[getPlayerStorageValue(cid,TeamRed)]
local timeB = timess[getPlayerStorageValue(cid,TeamBlue)]
if getPlayerStorageValue(cid,TeamRed) == 1 then -------- verifica o time 1
if getGlobalStorageValue(global_bandeiras.time1) <= 0 or getPlayerStorageValue(cid,global_bandeiras.time1) <= 0 then
return true
end
doSendMagicEffect(getCreaturePosition(cid),times[1])
doSendAnimatedText(getCreaturePosition(cid),"Flag!",math.random(1,255))
if getCreatureSpeed(cid) < 130 or getCreatureSpeed(cid) > 130 then
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid,-getCreatureSpeed(cid) + 130)
end
end
if getPlayerStorageValue(cid,TeamBlue) == 1 then -------- verifica o time 2
if getGlobalStorageValue(global_bandeiras.time2) <= 0 or getPlayerStorageValue(cid,global_bandeiras.time2) <= 0 then
return true
end
if getCreatureSpeed(cid) < 130 or getCreatureSpeed(cid) > 130 then
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid,-getCreatureSpeed(cid) + 130)
end
doSendMagicEffect(getCreaturePosition(cid),timess[2])
doSendAnimatedText(getCreaturePosition(cid),"Flag!",math.random(1,255))
end
return addEvent(repeatFlagOnPlayer, 1000, cid)
end
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local Red = 6666
local Blue = 6667
doTeleportThing(cid,lastPosition,false)
if getItemAttribute(item.uid,"aid") == 17779 then --- bandeira do time 1
if getPlayerStorageValue(cid,TeamBlue) == 1 then -- time 2 roubando a bandeira do time 1
if getGlobalStorageValue(17778) == 1 then
return doPlayerSendTextMessage(cid,19,"Alguem ja robou a bandeira desse time!")
end
setPlayerStorageValue(cid,17778,1)
setGlobalStorageValue(17778,1)
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid, -getCreatureSpeed(cid) + 130)
doBroadcastMessage("o jogador "..getCreatureName(cid).. " do time azul robou a bandeira peguem-o!!",22)
repeatFlagOnPlayer(cid)
end
if getPlayerStorageValue(cid,TeamRed) == 1 then
if getPlayerStorageValue(cid,17779) == 1 then
setGlobalStorageValue(18888,getGlobalStorageValue(18888) + 1)
doBroadcastMessage("Red ".. (getGlobalStorageValue(18888)).." X "..(getGlobalStorageValue(18889)).. " Blue",22)
doBroadcastMessage("o jogador "..getCreatureName(cid).. " do time Vermelho entregou a bandeira e o time inteiro ganhou 20% de EXP!",22)
doPlayerAddItem(cid,2152,1)
doPlayerAddItem(cid,2157,1)
for _, cid in ipairs(getPlayersOnline()) do
if getPlayerStorageValue(cid,Red) == 1 then
doPlayerAddItem(cid,2152,5 )
doPlayerAddPercentLevel(cid,20)
doSendMagicEffect(getPlayerPosition(cid), 31)
end
end
doPlayerAddPercentLevel(cid,100)
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))
setPlayerStorageValue(cid,17779,0)
setGlobalStorageValue(17779,0)
end
end
elseif getItemAttribute(item.uid,"aid") == 17778 then --- bandeira do time 2
if getPlayerStorageValue(cid,TeamRed) == 1 then -- time 1 roubando a bandeira do time 2
if getGlobalStorageValue(17779) == 1 then
return doPlayerSendTextMessage(cid,19,"Alguem ja robou a bandeira desse time!")
end
setPlayerStorageValue(cid,17779,1)
setGlobalStorageValue(17779,1)
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid, -getCreatureSpeed(cid) + 130)
doBroadcastMessage("o jogador "..getCreatureName(cid).. " do time Vermelho robou a bandeira peguem-o!!",22)
repeatFlagOnPlayer(cid)
end
if getPlayerStorageValue(cid,TeamBlue) == 1 then
if getPlayerStorageValue(cid,17778) == 1 then
setGlobalStorageValue(18889,getGlobalStorageValue(18889) + 1)
doRemoveCondition(cid,CONDITION_HASTE)
doBroadcastMessage("Red ".. (getGlobalStorageValue(18888)).." X "..(getGlobalStorageValue(18889)).. " Blue",22)
doBroadcastMessage("o jogador "..getCreatureName(cid).. " do time Azul entregou a bandeira e o time inteiro ganhou 20% de EXP!!",22)
doPlayerAddItem(cid,2152,1)
doPlayerAddItem(cid,2157,1)
for _, cid in ipairs(getPlayersOnline()) do
if getPlayerStorageValue(cid,Blue) == 1 then
doPlayerAddItem(cid,2152,5)
doPlayerAddPercentLevel(cid,20)
doSendMagicEffect(getPlayerPosition(cid), 35)
end
end
doPlayerAddPercentLevel(cid,100)
doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))
setPlayerStorageValue(cid,17778,0)
setGlobalStorageValue(17778,0)
end
end
end
return true
end

Link para o comentário
Compartilhar em outros sites

10 respostass a esta questão

Posts Recomendados

  • 0

 

 

local function doPlayerAddPercentLevel(cid, percent)

local player_lv, player_lv_1 = getExperienceForLevel(getPlayerLevel(cid)), getExperienceForLevel(getPlayerLevel(cid)+2)
local percent_lv = ((player_lv_1 - player_lv) / 200) * percent
doPlayerAddExperience(cid, percent_lv)
end
local global_bandeiras = {
time1 = 17779,
time2 = 17778,
}
local times = {
[1] = {5},
}
local timess = {
[2] = {5},
}
local TeamRed = 6666
local TeamBlue = 6667
function repeatFlagOnPlayer(cid)
if isPlayer(cid) then
local timeA = times[getPlayerStorageValue(cid,TeamRed)]
local timeB = timess[getPlayerStorageValue(cid,TeamBlue)]
if getPlayerStorageValue(cid,TeamRed) == 1 then -------- verifica o time 1
if getGlobalStorageValue(global_bandeiras.time1) <= 0 or getPlayerStorageValue(cid,global_bandeiras.time1) <= 0 then
return true
end
doSendMagicEffect(getCreaturePosition(cid),times[1])
doSendAnimatedText(getCreaturePosition(cid),"Flag!",math.random(1,255))
if getCreatureSpeed(cid) < 130 or getCreatureSpeed(cid) > 130 then
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid,-getCreatureSpeed(cid) + 130)
end
end
if getPlayerStorageValue(cid,TeamBlue) == 1 then -------- verifica o time 2
if getGlobalStorageValue(global_bandeiras.time2) <= 0 or getPlayerStorageValue(cid,global_bandeiras.time2) <= 0 then
return true
end
if getCreatureSpeed(cid) < 130 or getCreatureSpeed(cid) > 130 then
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid,-getCreatureSpeed(cid) + 130)
end
doSendMagicEffect(getCreaturePosition(cid),timess[2])
doSendAnimatedText(getCreaturePosition(cid),"Flag!",math.random(1,255))
end
return addEvent(repeatFlagOnPlayer, 1000, cid)
end
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local Red = 6666
local Blue = 6667
doTeleportThing(cid,lastPosition,false)
if getItemAttribute(item.uid,"aid") == 17779 then --- bandeira do time 1
if getPlayerStorageValue(cid,TeamBlue) == 1 then -- time 2 roubando a bandeira do time 1
if getGlobalStorageValue(17778) == 1 then
return doPlayerSendTextMessage(cid,19,"Alguem ja robou a bandeira desse time!")
end
setPlayerStorageValue(cid,17778,1)
setGlobalStorageValue(17778,1)
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid, -getCreatureSpeed(cid) + 130)
doBroadcastMessage("o jogador "..getCreatureName(cid).. " do time azul robou a bandeira peguem-o!!",22)
repeatFlagOnPlayer(cid)
end
if getPlayerStorageValue(cid,TeamRed) == 1 then
if getPlayerStorageValue(cid,17779) == 1 then
setGlobalStorageValue(18888,getGlobalStorageValue(18888) + 1)
doBroadcastMessage("Red ".. (getGlobalStorageValue(18888)).." X "..(getGlobalStorageValue(18889)).. " Blue",22)
doBroadcastMessage("o jogador "..getCreatureName(cid).. " do time Vermelho entregou a bandeira e o time inteiro ganhou 20% de EXP!",22)
doPlayerAddItem(cid,2152,1)
doPlayerAddItem(cid,2157,1)
for _, cid in ipairs(getPlayersOnline()) do
if getPlayerStorageValue(cid,Red) == 1 then
doPlayerAddItem(cid,2152,5 )
doPlayerAddPercentLevel(cid,20)
doSendMagicEffect(getPlayerPosition(cid), 31)
end
end
doPlayerAddPercentLevel(cid,100)
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))
setPlayerStorageValue(cid,17779,0)
setGlobalStorageValue(17779,0)
end
end
elseif getItemAttribute(item.uid,"aid") == 17778 then --- bandeira do time 2
if getPlayerStorageValue(cid,TeamRed) == 1 then -- time 1 roubando a bandeira do time 2
if getGlobalStorageValue(17779) == 1 then
return doPlayerSendTextMessage(cid,19,"Alguem ja robou a bandeira desse time!")
end
setPlayerStorageValue(cid,17779,1)
setGlobalStorageValue(17779,1)
doRemoveCondition(cid,CONDITION_HASTE)
doChangeSpeed(cid, -getCreatureSpeed(cid) + 130)
doBroadcastMessage("o jogador "..getCreatureName(cid).. " do time Vermelho robou a bandeira peguem-o!!",22)
repeatFlagOnPlayer(cid)
end
if getPlayerStorageValue(cid,TeamBlue) == 1 then
if getPlayerStorageValue(cid,17778) == 1 then
setGlobalStorageValue(18889,getGlobalStorageValue(18889) + 1)
doRemoveCondition(cid,CONDITION_HASTE)
doBroadcastMessage("Red ".. (getGlobalStorageValue(18888)).." X "..(getGlobalStorageValue(18889)).. " Blue",22)
doBroadcastMessage("o jogador "..getCreatureName(cid).. " do time Azul entregou a bandeira e o time inteiro ganhou 20% de EXP!!",22)
doPlayerAddItem(cid,2152,1)
doPlayerAddItem(cid,2157,1)
for _, cid in ipairs(getPlayersOnline()) do
if getPlayerStorageValue(cid,Blue) == 1 then
doPlayerAddItem(cid,2152,5)
doPlayerAddPercentLevel(cid,20)
doSendMagicEffect(getPlayerPosition(cid), 35)
end
end
doPlayerAddPercentLevel(cid,100)
doChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))
setPlayerStorageValue(cid,17778,0)
setGlobalStorageValue(17778,0)
end
end
end
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

Valeu cara funcionou!!!!! agora sem querer abusar tem como se me ajudar com uma outra script?

 

Os players aqui do server de war, começam com skill X, ai eles morrem e perdem skill...... algumas vezes os caras morrem umas 5x e os skills caem muito, eles resolvem criar outro char e começar com esse que é mais "lucrativo"

 

então, eu queria uma script que o skill minimo fosse o inicial, ai quando eles morressem nao diminuir mais do que quando o char é criado

no caso

 

sorc/druid

ML: 58 | shielding: 23

 

paladin

ML: 17 | dist: 71 | shielding: 41

 

kinas

sword/axe: 71 | shielding: 61

 

eu n sei se pode pedir aqui nesse mesmo topico, se n poder me avisem

Link para o comentário
Compartilhar em outros sites

  • 0

Vai no creaturescripts -> scripts -> crie um arquivo chamado startskills.lua e adicione:

 

 

function onLogin(cid)
local playerVoc = getPlayerVocation(cid)
local reqTries = getPlayerRequiredSkillTries
local skillStor = 56364
local gotSkills = getPlayerStorageValue(cid, 56364)


if playerVoc == 5 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,58)))
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 6 and gotSkills == -1 then
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,58)))
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 7 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_DISTANCE, reqTries(cid, SKILL_DISTANCE, 71))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 41))
doPlayerAddSpentMana(cid, (getPlayerRequiredMana(cid,17)))
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 8 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_AXE, reqTries(cid, SKILL_AXE, 71))
doPlayerAddSkillTry(cid, SKILL_SWORD, reqTries(cid, SKILL_SWORD, 71))
doPlayerAddSkillTry(cid, SKILL_CLUB, reqTries(cid, SKILL_CLUB, 71))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 61))
doPlayerAddMagLevel(cid, 8)
setPlayerStorageValue(cid, skillStor, 1)

end
return TRUE
end

 

 

Depois vai no creaturescripts.xml e adicione isso:

 

<event type="login" name="StartSkills" event="script" value="startskills.lua"/>
Editado por ThiagoBji
Link para o comentário
Compartilhar em outros sites

  • 0

começa lvl 80.......... o server tem site e os jogadores começam de acordo com os Samples... sorc,kina,pala sample........... tfs 0.4

Link para o comentário
Compartilhar em outros sites

  • 0

creaturescripts -> scripts -> protect.lua:

 

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
local level = 80
if isPlayer(cid) and getPlayerLevel(cid) < level then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
doCreatureAddMana(cid, getCreatureMaxMana(cid))
doRemoveConditions(cid, false)
return false
end
return true
end

 

creaturescripts -> creaturescripts.xml:

 

<event type="preparedeath" name="ProtectLevel" event="script" value="levelprotection.lua"/>

 

creaturescripts -> scripts -> login.lua:

 

registerCreatureEvent(cid, "ProtectLevel")
Link para o comentário
Compartilhar em outros sites

  • 0
  • Administrador
A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...