Ir para conteúdo
  • Cadastre-se

Posts Recomendados

  • 3 weeks later...
  • 2 years later...
Em 14/07/2014 ás 11:03, ScreMMo disse:

Opa galera blz? hoje vou trazer um sistema para vocês de jail, então vamos la !

 

Algumas Funções !

 

Funções:

 

*Exemplo, GM quer prender um player que ta fazeno algu de errado, ai ele fala !jail ,4(no exemplo ele ficara 4 minutos preso), éo nome do fulano, !jail 4,fulano ,!jail 15,fulano ou !jail 30,fulano.

 

* Verificação jogador o tempo de prisão (mostra data unjail) 

* auto unjail jogadores 
* Kick todos os jogadores da prisão depois de acidente / restart [teletransporte para jogador templo] 

 

Primeiramente vá em \data\talkactions e abra o talkactions.xml é lá adicione:


<talkaction words="!jail" script="jailsystem.lua"/> 
<talkaction words="!unjail" script="jailsystem.lua"/> 
<talkaction words="/jail" script="jailsystem.lua"/> 
<talkaction words="/unjail" script="jailsystem.lua"/>

Agora vá em \data\talkactions\scripts é crie um arquivo chamado jailsystem.lua é la adicione :


-- Default jail time in seconds -- 
default_jail = 30 
-- The permission you need to jail someone -- 
grouprequired = 4
-- StorageValue that the player gets -- 
jailedstoragevalue_time = 1338 
jailedstoragevalue_bool = 1339 
-- Set the position of the jail: -- 
jailpos = { x = 1037, y = 1004, z =7 } 
-- Set the position once unjailed: -- 
unjailpos = { x = 1029, y = 1005, z =7 } 
-- auto kicker, dont edit 
jail_list = {} 
jail_list_work = 0 

function checkJailList(param) 
    addEvent(checkJailList, 1000, {}) 
    for targetID,player in ipairs(jail_list) do 
        if isPlayer(player) == TRUE then 
            if getPlayerStorageValue(player, jailedstoragevalue_time) < os.time() then 
                doTeleportThing(player, unjailpos, TRUE) 
                setPlayerStorageValue(player, jailedstoragevalue_time, 0) 
                setPlayerStorageValue(player, jailedstoragevalue_bool, 0) 
                table.remove(jail_list,targetID) 
                doPlayerSendTextMessage(player,MESSAGE_STATUS_CONSOLE_ORANGE,'You were kicked from jail! See you later :)') 
            end 
        else 
            table.remove(jail_list,targetID) 
        end 
    end 
end 

function onSay(cid, words, param) 
    if jail_list_work == 0 then 
        jail_list_work = addEvent(checkJailList, 1000, {}) 
    end 
    if param == '' and (words == '!unjail' or words == '/unjail') then 
        if getPlayerStorageValue(cid, jailedstoragevalue_time) > os.time() then 
            doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You are jailed until ' .. os.date("%H:%M:%S", getPlayerStorageValue(cid, jailedstoragevalue_time)) .. ' (now is: ' .. os.date("%H:%M:%S", os.time()) .. ').')  
        else 
            if getPlayerStorageValue(cid, jailedstoragevalue_bool) == 1 then 
                table.insert(jail_list,cid) 
                doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You will be kicked from jail in one second.') 
            else 
                doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You are not jailed.') 
            end 
        end 
        return TRUE 
    end 
    local jail_time = -1 
    for word in string.gmatch(tostring(param), "(%w+)") do 
        if tostring(tonumber(word)) == word then 
            jail_time = tonumber(word) 
        end 
    end 
    local isplayer = getPlayerByName(param) 
    if isPlayer(isplayer) ~= TRUE then 
        isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+1)) 
        if isPlayer(isplayer) ~= TRUE then 
            isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+2)) 
            if isPlayer(isplayer) ~= TRUE then 
                isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+3)) 
            end 
        end 
    end 
    if jail_time ~= -1 then 
        jail_time = jail_time * 60 
    else 
        jail_time = default_jail 
    end 
    if words == '!jail' or words == '/jail' then 
        if getPlayerGroupId ( cid ) >= grouprequired then 
            if isPlayer(isplayer) == TRUE then 
                doTeleportThing(isplayer, jailpos, TRUE) 
                setPlayerStorageValue(isplayer, jailedstoragevalue_time, os.time()+jail_time) 
                setPlayerStorageValue(isplayer, jailedstoragevalue_bool, 1) 
                table.insert(jail_list,isplayer) 
                doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You jailed '.. getCreatureName(isplayer) ..' until ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (now is: ' .. os.date("%H:%M:%S", os.time()) .. ').')  
                doPlayerSendTextMessage ( isplayer, MESSAGE_INFO_DESCR, 'You have been jailed by '.. getCreatureName(cid) ..' until ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (now is: ' .. os.date("%H:%M:%S", os.time()) .. ').')  
                return TRUE 
            else 
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player with this name doesn\'t exist or is offline.") 
                return FALSE 
            end 
        else 
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have access to unjail other players.") 
            return FALSE 
        end 
    elseif words == '!unjail' or words == '/unjail' then 
        if getPlayerGroupId ( cid ) >= grouprequired then 
            if isPlayer(isplayer) == TRUE then 
                doTeleportThing(isplayer, unjailpos, TRUE) 
                setPlayerStorageValue(isplayer, jailedstoragevalue_time, 0) 
                setPlayerStorageValue(isplayer, jailedstoragevalue_bool, 0) 
                table.remove(jail_list,targetID) 
                doPlayerSendTextMessage(isplayer,MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(cid) .. ' let you go out from jail! See you later :)') 
                doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You unjailed '.. getCreatureName(isplayer) ..'.') 
            else 
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player with this name doesn\'t exist or is offline.") 
                return FALSE 
            end 
        else 
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have access to unjail other players.") 
            return FALSE 
        end 
    end 
    return FALSE 
end

Algumas configurações

 

grouprequired = 4 -- aki séra até o grupo que poderar usar no caso group 4 pra baixo.

jailpos = { x = 1037, y = 1004, z =7 } -- aki séra a posição para aonde o player irar quando for preso.

unjailpos = { x = 1029, y = 1005, z =7 }- -aki séra para aonde ele for quando ele n tiver mais preso, no caso unjail.


Creditos:
Gesior.pl
EU.
 

Lembre-se eu testei em tibia 8.54 é 8.60 é funcionou perfeitamente !

 

 

 

 

 

 

 

 

Consegue criar um NPC para pagar a fiança? o char fica preso, ai você vai lá e paga um valor e ele é liberado.

Link para o post
Compartilhar em outros sites
  • 6 months later...

@Necamanuel não é da minha conta, mas você viu que os players saem automatico quando da o tempo ? nao sei que a pessoa iria ficar esperando 2 horas pra ir la e falar o comando ;)

       112674.gif

 

 

 

Link para o post
Compartilhar em outros sites

 

3 horas atrás, Zzyzx disse:

@Necamanuel não é da minha conta, mas você viu que os players saem automatico quando da o tempo ? nao sei que a pessoa iria ficar esperando 2 horas pra ir la e falar o comando ;)

@Zzyzx ss, er fui burro nessa parte, mais foi pq eu n achei onde botar o tempo de prisao tlgd vc sabe onde er?

Editado por Necamanuel (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
1 hora atrás, Necamanuel disse:

 

@Zzyzx ss, er fui burro nessa parte, mais foi pq eu n achei onde botar o tempo de prisao tlgd vc sabe onde er?

 

@Necamanuel

Usa esse aqui que eu tenho, ele ta em portugues.

 

\data\talkactions\scripts

cria um arquivo chamado.

Cadeia.lua

-- Sistema adaptado por FreaksOT --
-- Tempo em segundos que alguém ficará na prisão --
default_jail = 1000
-- O group ID da permissão para alguém manda o outro para a cadeia. --
grouprequired = 5
-- StorageValue that the player gets --
jailedstoragevalue_time = 1338
jailedstoragevalue_bool = 1339
-- POSICAO DA CADEIA: --
jailpos = { x = 114, y = 56, z =7 }
-- POSICAO DO LUGAR QUE ELE VOLTARÁ (RECOMENDADO TEMPO): --
unjailpos = { x = 159, y = 52, z =7 }
-- auto kicker, dont edit
jail_list = {}
jail_list_work = 0

function checkJailList(param)
addEvent(checkJailList, 1000, {})
for targetID,player in ipairs(jail_list) do
if isPlayer(player) == TRUE then
if getPlayerStorageValue(player, jailedstoragevalue_time) < os.time() then
doTeleportThing(player, unjailpos, TRUE)
setPlayerStorageValue(player, jailedstoragevalue_time, 0)
setPlayerStorageValue(player, jailedstoragevalue_bool, 0)
table.remove(jail_list,targetID)
doPlayerSendTextMessage(player,MESSAGE_STATUS_CONSOLE_ORANGE,'Você foi chutado da prisão! Até logo')
end
else
table.remove(jail_list,targetID)
end
end
end

function onSay(cid, words, param)
if jail_list_work == 0 then
jail_list_work = addEvent(checkJailList, 1000, {})
end
if param == '' and (words == '!unjail' or words == '/unjail') then
if getPlayerStorageValue(cid, jailedstoragevalue_time) > os.time() then
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'Você está preso até ' .. os.date("%H:%M:%S", getPlayerStorageValue(cid, jailedstoragevalue_time)) .. ' (Agora são: ' .. os.date("%H:%M:%S", os.time()) .. ').')
else
if getPlayerStorageValue(cid, jailedstoragevalue_bool) == 1 then
table.insert(jail_list,cid)
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'Você vai ser expulso da prisão em um segundo.')
else
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'Você não está preso.')
end
end
return TRUE
end
local jail_time = -1
for word in string.gmatch(tostring(param), "(%w+)") do
if tostring(tonumber(word)) == word then
jail_time = tonumber(word)
end
end
local isplayer = getPlayerByName(param)
if isPlayer(isplayer) ~= TRUE then
isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+1))
if isPlayer(isplayer) ~= TRUE then
isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+2))
if isPlayer(isplayer) ~= TRUE then
isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+3))
end
end
end
if jail_time ~= -1 then
jail_time = jail_time * 60
else
jail_time = default_jail
end
if words == '!jail' or words == '/jail' then
if getPlayerGroupId ( cid ) >= grouprequired then
if isPlayer(isplayer) == TRUE then
doTeleportThing(isplayer, jailpos, TRUE)
setPlayerStorageValue(isplayer, jailedstoragevalue_time, os.time()+jail_time)
setPlayerStorageValue(isplayer, jailedstoragevalue_bool, 1)
table.insert(jail_list,isplayer)
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'Você está preso '.. getCreatureName(isplayer) ..' até ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (Agora são: ' .. os.date("%H:%M:%S", os.time()) .. ').')
doPlayerSendTextMessage ( isplayer, MESSAGE_INFO_DESCR, 'Você foi preso por '.. getCreatureName(cid) ..' até ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (Agora sao: ' .. os.date("%H:%M:%S", os.time()) .. ').')
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "O player com este nome não existe ou está offline.")
return FALSE
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não pode libertar outros jogadores.")
return FALSE
end
elseif words == '!unjail' or words == '/unjail' then
if getPlayerGroupId ( cid ) >= grouprequired then
if isPlayer(isplayer) == TRUE then
doTeleportThing(isplayer, unjailpos, TRUE)
setPlayerStorageValue(isplayer, jailedstoragevalue_time, 0)
setPlayerStorageValue(isplayer, jailedstoragevalue_bool, 0)
table.remove(jail_list,targetID)
doPlayerSendTextMessage(isplayer,MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(cid) .. 'vou deixar você sair da prisão!')
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'Voce está solto '.. getCreatureName(isplayer) ..'.')
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "O player com este nome não existe ou está offline.")
return FALSE
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não pode libertar outros jogadores.")
return FALSE
end
end
return FALSE
end 

default_jail = 1000 AQUI VOCÊ MUDA O TEMPO, EM SEGUNDOS.

 

60 = 1 MINUTO

 

Em talkactions.xml você poem.

 

<talkaction words="!jail" script="Cadeia.lua"/>
<talkaction words="!unjail" script="Cadeia.lua"/>
<talkaction words="/jail" script="Cadeia.lua"/>
<talkaction words="/unjail" script="Cadeia.lua"/>

 

Editado por Zzyzx (veja o histórico de edições)

       112674.gif

 

 

 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo