Save in Server=blue]RD12
Atualizado 27/07 - atualize a scene title e o script principalDescrição: Com esse script as contas serão salvas direto no servidor, permitindo ser acessada de qualquer computador, e evitando que o jogador trapaceie, já que tem a conta no computador dele.
A conta fica salva na pasta jogadores do server, em um arquivo de texto.
Características:
Salva todas informações necessárias do jogador.
Salva switches, variaveis, itens, skills e equipamentos equipados...
Salva o jogo a cada x segundos(escolhido por você) e ao fechar o jogo.
Sem bugs(até agora)
[size=17]Tutorial + Script
Para fazer esse sistema, tive que criar um script, e modificar outros scripts no client, também foi necessário um script em lua no servidor.
Eu peço de todo coração, que siga os passos com calma, para não vim postar erro e eu me matar para tentar descobrir o que é, e foi você que fez errado.
Vamos começar com o script principal, crie um novo script acima do Main, e cole o código:
- Código:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#|Autor: RD12| Save in Server
#|Vers: 1.0 | aldeiarpgbr.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
module Conf_SiS
#Número de variáveis salvas, do ID[1] até o definido
Vars_max = 500
#Número de Switches salvas, do ID[1] até o definido
Swit_max = 500
#Tempo em tempo que irá salvar o jogo, em segundos
Autosave = 20 #segundos (o jogo também é salvo ao fechar)
end
class SiS
#=============================================================================
#Método que pega as informações necessária e envia pro server
#=============================================================================
def self.save
actor = $game_party.actors[0]
@data = []
@data[0] = actor.name
@data[1] = $game_player.character_name
@data[2] = $game_party.actors[0].guild
@data[3] = $guild_lider_name
@data[4] = $guild_position
@data[5] = actor.ban
@data_numeric = "("
@data_numeric += $flag.to_s + ", "
@data_numeric += $guild_points.to_s + ", "
@data_numeric += actor.class_id.to_s + ", "
@data_numeric += actor.level.to_s + ", "
@data_numeric += $game_map.map_id.to_s + ", "
@data_numeric += $game_player.x.to_s + ", "
@data_numeric += $game_player.y.to_s + ", "
luva = $luva_ac.id; luva = 0 if $luva_ac.id == 4
bota = $bota_ac.id; bota = 0 if $bota_ac.id == 4
capa = $capa_ac.id; capa = 0 if $capa_ac.id == 4
amuleto = $amuleto_ac.id; amuleto = 0 if $amuleto_ac.id == 4
@data_numeric += luva.to_s + ", "
@data_numeric += bota.to_s + ", "
@data_numeric += capa.to_s + ", "
@data_numeric += amuleto.to_s + ", "
@data_numeric += actor.weapon_id.to_s + ", "
@data_numeric += actor.armor1_id.to_s + ", "
@data_numeric += actor.armor2_id.to_s + ", "
@data_numeric += actor.armor3_id.to_s + ", "
@data_numeric += actor.armor4_id.to_s + ", "
@data_numeric += actor.hp.to_s + ", "
@data_numeric += actor.sp.to_s + ", "
@data_numeric += actor.now_exp.to_s + ", "
@data_numeric += actor.str.to_s + ", "
@data_numeric += actor.dex.to_s + ", "
@data_numeric += actor.agi.to_s + ", "
@data_numeric += actor.int.to_s + ", "
@data_numeric += $distribuir_pontos.to_s + ", "
@data_numeric += $genero.to_s + ")<n>"
@data_contents = ""
#Adicionar @data
for i in 0..@data.size-1
@data_contents += @data[i].to_s+"<n>"
end
#Adiciona os @data_numeric
@data_contents += @data_numeric.to_s
#Adicionar variaveis
vars = "("
for i in 0..Conf_SiS::Vars_max-1
vars += $game_variables[i].to_s+", "
end
vars += $game_variables[Conf_SiS::Vars_max].to_s+")"
@data_contents += vars.to_s+"<n>"
#Adicionar Switches#
switchs = "("
for i in 0..Conf_SiS::Swit_max-1
switchs += $game_switches[i].to_s+", "
end
switchs += $game_switches[Conf_SiS::Swit_max].to_s+")"
switchs = switchs.gsub("false", "0")
switchs = switchs.gsub("true", "1")
@data_contents += switchs.to_s+"<n>"
#Adicionar os Itens#
items = "("
for i in 0..$data_items.size-2
items += $game_party.item_number(i).to_s+", "
end
items += $game_party.item_number($data_items.size-1).to_s+")"
@data_contents += items.to_s+"<n>"
#adicionar as Armas#
armas = "("
for i in 0..$data_weapons.size-2
armas += $game_party.weapon_number(i).to_s+", "
end
armas += $game_party.weapon_number($data_weapons.size-1).to_s+")"
@data_contents += armas.to_s+"<n>"
#Adicionar as Armaduras#
armaduras = "("
for i in 0..$data_armors.size-2
armaduras += $game_party.armor_number(i).to_s+", "
end
armaduras += $game_party.armor_number($data_armors.size-1).to_s+")"
@data_contents += armaduras.to_s+"<n>"
#Adicionar as Skills#
skills = "("
for i in 0...actor.skills.size
if !$data_skills[actor.skills[i]].nil?
skills += $data_skills[actor.skills[i]].id.to_s+", "
end
end
skills += "0)"
@data_contents += skills.to_s
#Enviar o pacote com os dados para o servidor
case $char_id
when 1#
Network::Main.socket.send("<26a>#{@data_contents}</26a>\n")
when 2
Network::Main.socket.send("<26b>#{@data_contents}</26b>\n")
when 3
Network::Main.socket.send("<26c>#{@data_contents}</26c>\n")
end
end
#=============================================================================
#Método que faz o servidor enviar a conta pro client
#=============================================================================
def self.request(id)
Network::Main.update
Network::Main.socket.send("<27>#{id}</27>\n")
end
#=============================================================================
#Método que recebe do servidor a conta e armazena numa var
#=============================================================================
def self.load(data)
Network::Main.update
$SiS_Contents = [[], [], [], []] if $SiS_Contents.nil? or $SiS_Contents.size == 13
if data.include?("(") and data.include?(")")
$SiS_Contents[$sis_id] << data.scan(/\d+/).collect {|n| n.to_i}
else
$SiS_Contents[$sis_id] << data
end
end
#=============================================================================
#Métodos que verificam se a conta existe, e que deleta a conta
#=============================================================================
def self.exist(id)
Network::Main.socket.send("<28>#{id}</28>\n")
end
def self.delete(id)
Network::Main.socket.send("<29>#{id}</29>\n")
end
end
#Salvar o jogo de segundos em segundos
class Scene_Map
alias aliasave_update update
def update
aliasave_update
autosave if Graphics.frame_count % (40*Conf_SiS::Autosave) == 0
end
end
class Game_Actor < Game_Battler
attr_accessor :weapon_id
attr_accessor :armor1_id
attr_accessor :armor2_id
attr_accessor :armor3_id
attr_accessor :armor4_id
end
Agora troque sua [SC] Scene_Title por esta:
- Código:
#==============================================================================
# ** Title
#------------------------------------------------------------------------------
# By Valentine
# Editado para o Save in Server > RD12
#==============================================================================
class Scene_Title
def initialize
Graphics.frame_count = 0
$ABS = MrMo_ABS.new
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
$game_netparty = Game_Party.new
$game_party.setup_starting_members
$game_netparty.setup_starting_members
$game_map.setup($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$game_map.update
@count_load = 0
end
def main
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
$Icon = []
@logbotao = []
@crebotao = []
@direita = []
@esquerda = []
@op_ = []
@deletechar = []
$scrollitemmax = []
$m_click = 0
@tempo = 0
$tempo = 0
@tempinho = 0
$sex = 0
$grafiche = Grafica.new
@current_grp = 0
$game_actors[1].set_chara($grafiche.sex[$game_actors[1].class_id][0])
$game_system.bgm_play($data_system.title_bgm)
Audio.me_stop
Audio.bgs_stop
loop do
@count_load += 1
loadcharacter(1) if @count_load == 1
loadcharacter(2) if @count_load == 999
loadcharacter(3) if @count_load == 9999
break if @count_load == 9999
end
delete
create
Graphics.transition
loop do
Graphics.update
Input.update
Network::Main.update
update
if $scene != self
break
end
end
Graphics.freeze
@sprite.dispose
@delete.dispose
$create.dispose
$Icon[4].dispose
$Icon[5].dispose
$Icon[6].dispose
if @barra_active == true or @barra_active_create == true
@barra.dispose
end
$create_box.dispose
end
def loadcharacter(id)
name = Network::Main.name
$sis_id = id
SiS.exist(id)
SiS.request(id)
for i in 0..99999
if i == 99999
Network::Main.update
if $char_exist == "true" and not @deletechar[id] == true
$Icon[id+3] = Load_Character.new(240,130,170,193,id)
@op_[id] = true
if id == 1
@direita[id] = Button.new($Icon[id+3],124,60," > ",0,1) {$Icon[4].visible = false; $Icon[4].active = false; $Icon[5].visible = true; $Icon[5].active = true; @id_c = 2}
@esquerda[id] = Button.new($Icon[id+3],15,60," < ",0,1) {$Icon[4].visible = false; $Icon[4].active = false; $Icon[6].visible = true; $Icon[6].active = true; @id_c = 3}
elsif id == 2
$Icon[id+3].visible = false
$Icon[id+3].active = false
@direita[id] = Button.new($Icon[5],124,60," > ",0,1)
@esquerda[id] = Button.new($Icon[5],15,60," < ",0,1) {$Icon[5].visible = false; $Icon[5].active = false; $Icon[4].visible = true; $Icon[4].active = true; @id_c = 1}
elsif id == 3
$Icon[id+3].visible = false
$Icon[id+3].active = false
@direita[id] = Button.new($Icon[6],124,60," > ",0,1) {$Icon[6].visible = false; $Icon[6].active = false; $Icon[4].visible = true; $Icon[4].active = true; @id_c = 1}
@esquerda[id] = Button.new($Icon[6],15,60," < ",0,1)
end
if $ban[id] != true
@logbotao[id] = Button.new($Icon[id+3],49,120,LANGUAGE::SELECTCHAR,3,1){@id_c = id;carregar}
end
@crebotao[id] = Button.new($Icon[id+3],49,142,LANGUAGE::DELETECHAR,3,1){@delete.visible = true; @delete.active = true;$char_id = id}
else
$Icon[id+3] = Load_Character.new(240,130,170,193,id)
if id == 1
@direita[id] = Button.new($Icon[id+3],124,60," > ",0,1) {$Icon[4].visible = false; $Icon[4].active = false; $Icon[5].visible = true; $Icon[5].active = true; @id_c = 2}
@esquerda[id] = Button.new($Icon[id+3],15,60," < ",0,1) {$Icon[4].visible = false; $Icon[4].active = false; $Icon[6].visible = true; $Icon[6].active = true; @id_c = 3}
elsif id == 2
$Icon[id+3].visible = false
$Icon[id+3].active = false
@direita[id] = Button.new($Icon[id+3],124,60," > ",0,1)
@esquerda[id] = Button.new($Icon[id+3],15,60," < ",0,1) {$Icon[5].visible = false; $Icon[5].active = false; $Icon[4].visible = true; $Icon[4].active = true; @id_c = 1}
elsif id == 3
$Icon[id+3].visible = false
$Icon[id+3].active = false
@direita[id] = Button.new($Icon[id+3],124,60," > ",0,1) {$Icon[6].visible = false; $Icon[6].active = false; $Icon[4].visible = true; $Icon[4].active = true; @id_c = 1}
@esquerda[id] = Button.new($Icon[id+3],15,60," < ",0,1)
end
@logbotao[id] = Button.new($Icon[id+3],49,120,LANGUAGE::CREATECHAR,3,1){createchar(id)}
end
end
end
end
def createchar(id)
@create_active = true
$create.refresh
if $create.visible != true
$create.visible = true
$create.active = true
end
$Icon[3+id].visible = false
$Icon[3+id].active = false
$char_id = id
$create_box.visible = true
$create_box.active = true
end
def delete
@delete = Window_Delete.new(380, 200, 115,72)
@delete.visible = false
@delete.active = false
@delbotao = Button.new(@delete,10,33,LANGUAGE::DELETEYES,0,1) {sim}
@canbotao = Button.new(@delete,55,33,LANGUAGE::DELETENO,0,1) {@delete.visible = false; @delete.active = false}
end
def sim
@delete.visible = false
@delete.active = false
if $Icon[4].visible == true
@deletechar[1] = true
name = Network::Main.name
SiS.delete(1)
@op_[1] = false
elsif $Icon[5].visible == true
@deletechar[2] = true
name = Network::Main.name
SiS.delete(2)
@op_[2] = false
elsif $Icon[6].visible == true
@deletechar[3] = true
name = Network::Main.name
SiS.delete(3)
@op_[3] = false
end
$scene = Scene_Title.new
end
def update
$create_box.update if $create.visible
@delete.update if @delete.visible
$Icon[4].update if Graphics.frame_count % 5 == 0
$Icon[5].update if Graphics.frame_count % 5 == 0
$Icon[6].update if Graphics.frame_count % 5 == 0
@name_box.active = true if $create.visible
if @barra_active == true or @barra_active_create == true
@barra.refresh
end
if @create_active == true
if Graphics.frame_count / Graphics.frame_rate != @total_sec
@tempo += 1
end
end
if @barra_active == true or @barra_active_create == true
if Graphics.frame_count / Graphics.frame_rate != @total_sec
@tempinho += 1
end
end
if @barra_active == true or @barra_active_create == true
if @tempinho == 5
$tempo += 1
@tempinho = 0
end
end
if $tempo == 103 and @barra_active == true
carregar2
end
if $tempo == 103 and @barra_active_create == true
criar_char2
end
if $tempo == 35
@sprite.bitmap = RPG::Cache.title(User_Edit::LOADING2)
end
if $tempo == 65
@sprite.bitmap = RPG::Cache.title(User_Edit::LOADING3)
end
if @create_active == true
if @tempo == 0.5 * 10
@tempo = 0
@create_active2 = true
@create_active = false
end
end
if @create_active2 == true
$create.update if $create.visible if Graphics.frame_count % 5 == 0
end
end
def create
actor = $game_party.actors[0]
$create = Create_Chars.new
$create.visible = false
$create.active = false
$create_box = Window_Dummys.new(200,126,150,60)
$create_box.opacity = 1
$create_box.visible = false
$create_box.active = false
$create_box.z = 999999
@name_box = Text_Box.new($create_box,10,17,102,10,1,true)
name = Network::Main.name
$sexo = LANGUAGE::MAN
@create_button = Button.new($create,10,170,LANGUAGE::CREATECHAR2,0,1) { criar_char }
@cancel = Button.new($create,85,170,LANGUAGE::CREATERETURN,0,1) { cancel }
@next_g = Button.new($create,137,105," > ",0,1) {next_gr}
@prev_g = Button.new($create,60,105," < ",0,1) {prev_gr}
@next_s = Button.new($create,137,51," > ",0,1) {@current_grp = 0;$game_party.actors[0].set_female; reset_gra ; if $sexo == LANGUAGE::MAN
$sexo = LANGUAGE::WOMAN
end;$create.refresh}
@prev_s = Button.new($create,60,51," < ",0,1) {@current_grp = 0;$game_party.actors[0].set_male; reset_gra ; if $sexo == LANGUAGE::WOMAN
$sexo = LANGUAGE::MAN
end;$create.refresh}
@next_c = Button.new($create,60,77," < ",0,1) {prev_class; $create.refresh } if User_Edit::NOSELECTCLASS == false
@next_D = Button.new($create,137,77," > ",0,1) {next_class; $create.refresh } if User_Edit::NOSELECTCLASS == false
if User_Edit::DISTRIBUIR_ACTIVE == true
@str = Button.new($create,270, 48, " + ",0,1) {str}
@dex = Button.new($create,270, 73, " + ",0,1) {dex}
@agi = Button.new($create,270, 98, " + ",0,1) {agi}
@int = Button.new($create,270, 123, " + ",0,1) {int}
end
end
def cancel
$create.visible = false
$create.active = false
$create_box.visible = false
$create_box.active = false
$Icon[$char_id+3].visible = true
$Icon[$char_id+3].active = true
@create_active2 = false
end
def carregar
if User_Edit::LOADING_ACTIVE == true
$Icon[4].visible = false
$Icon[4].active = false
$Icon[5].visible = false
$Icon[5].active = false
$Icon[6].visible = false
$Icon[6].active = false
@sprite.bitmap = RPG::Cache.title(User_Edit::LOADING)
@barra = Barra.new
@barra_active = true
else
carregar2
end
end
def carregar2
#==========Iniciar variáveis==========
Graphics.frame_count = 0
$ABS = MrMo_ABS.new
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
$game_netparty = Game_Party.new
$game_party.setup_starting_members
$game_netparty.setup_starting_members
$game_party.actors[0].name = $SiS_Contents[@id_c][0]
$game_party.actors[0].character_name = $SiS_Contents[@id_c][1]
$game_party.actors[0].guild = $SiS_Contents[@id_c][2]
$guild_name = $SiS_Contents[@id_c][2]
$guild_lider_name = $SiS_Contents[@id_c][3]
$guild_position = $SiS_Contents[@id_c][4]
$game_party.actors[0].ban = $SiS_Contents[@id_c][5].to_i
$flag = $SiS_Contents[@id_c][6][0].to_i
$guild_points = $SiS_Contents[@id_c][6][1].to_i
$game_party.actors[0].class_id = $SiS_Contents[@id_c][6][2].to_i
$game_party.actors[0].level = $SiS_Contents[@id_c][6][3].to_i
$luva_ac = $data_armors[$SiS_Contents[@id_c][6][7].to_i]
$bota_ac = $data_armors[$SiS_Contents[@id_c][6][8].to_i]
$capa_ac = $data_armors[$SiS_Contents[@id_c][6][9].to_i]
$amuleto_ac = $data_armors[$SiS_Contents[@id_c][6][10].to_i]
$game_party.actors[0].weapon_id = $SiS_Contents[@id_c][6][11].to_i
$game_party.actors[0].armor1_id = $SiS_Contents[@id_c][6][12].to_i
$game_party.actors[0].armor2_id = $SiS_Contents[@id_c][6][13].to_i
$game_party.actors[0].armor3_id = $SiS_Contents[@id_c][6][14].to_i
$game_party.actors[0].armor4_id = $SiS_Contents[@id_c][6][15].to_i
$game_party.actors[0].hp = $SiS_Contents[@id_c][6][16].to_i
$game_party.actors[0].sp = $SiS_Contents[@id_c][6][17].to_i
$game_party.actors[0].exp += $SiS_Contents[@id_c][6][18].to_i
$game_party.actors[0].str = $SiS_Contents[@id_c][6][19].to_i
$game_party.actors[0].dex = $SiS_Contents[@id_c][6][20].to_i
$game_party.actors[0].agi = $SiS_Contents[@id_c][6][21].to_i
$game_party.actors[0].int = $SiS_Contents[@id_c][6][22].to_i
$distribuir_pontos = $SiS_Contents[@id_c][6][23].to_i
$genero = $SiS_Contents[@id_c][6][24].to_i
for i in 0..$SiS_Contents[@id_c][7].size
$game_variables[i] = $SiS_Contents[@id_c][7][i].to_i
end
for i in 0..$SiS_Contents[@id_c][8].size
swtf = false if $SiS_Contents[@id_c][8][i] == 0
swtf = true if $SiS_Contents[@id_c][8][i] == 1
$game_switches[i] = swtf
end
for i in 0..$SiS_Contents[@id_c][9].size-1
$game_party.gain_item(i, $SiS_Contents[@id_c][9][i])
end
for i in 0..$SiS_Contents[@id_c][10].size-1
$game_party.gain_weapon(i, $SiS_Contents[@id_c][10][i])
end
for i in 0..$SiS_Contents[@id_c][11].size-1
$game_party.gain_armor(i, $SiS_Contents[@id_c][11][i])
end
for i in 0..$SiS_Contents[@id_c][12].size-1
$game_party.actors[0].learn_skill($SiS_Contents[@id_c][12][i])
end
$game_map.setup($SiS_Contents[@id_c][6][4].to_i)
$game_player.moveto($SiS_Contents[@id_c][6][5].to_i, $SiS_Contents[@id_c][6][6].to_i)
$game_player.refresh
$game_map.update
$ABS.update
$game_party.refresh
$game_map.autoplay
Graphics.freeze
$char_id = @id_c
$divide_exp = false
if Network::Main.group == 'admin'
$game_party.actors[0].grupo = "Admin"
else
$game_party.actors[0].grupo = "Standard"
end
#Sair da Guild que foi deletada
if $guild_name != ""
if Network::Main.user_exist?($guild_name.to_s+"-Guild-DEL") == true
$guild_name = ""
$game_party.actors[0].guild = ""
$game_player.refresh
$guild_position = LANGUAGE::GUILDRANK
$guild_lider_name = ""
$guild_points = 0
return
end
end
if $guild_name == ""
$flag = 1
end
$game_player.refresh
$chat_ativo_agr = true
$scene = Scene_Map.new
$fechando_ativar = true
Network::Main.send_start
end
def criar_char
if Network::Main.user_exist?(@name_box.text+"-Char") == true
$erro = LANGUAGE::CREATEERRONAME
$create.refresh
return
end
arg = @name_box.text.split
#Evitar Falsos ADM's
if User_Edit::PROIBIR == true
if @name_box.text.include?("GM") or @name_box.text.include?("Gm") or @name_box.text.include?("gM") or @name_box.text.include?("gm")
$erro = "#{arg[0]} "+LANGUAGE::CREATEERROARG
$create.refresh
return
elsif @name_box.text.include?("ADM") or @name_box.text.include?("Adm") or @name_box.text.include?("aDm") or @name_box.text.include?("adM") or @name_box.text.include?("ADm") or @name_box.text.include?("aDM") or @name_box.text.include?("AdM") or @name_box.text.include?("adm")
$erro = "#{arg[0]} "+LANGUAGE::CREATEERROARG
$create.refresh
return
elsif @name_box.text.include?("[ADM]") or @name_box.text.include?("[Adm]") or @name_box.text.include?("[aDm]") or @name_box.text.include?("[adM]") or @name_box.text.include?("[ADm]") or @name_box.text.include?("[aDM]") or @name_box.text.include?("[AdM]") or @name_box.text.include?("[adm]")
$erro = "#{arg[0]} "+LANGUAGE::CREATEERROARG
$create.refresh
return
elsif @name_box.text.include?("GOD") or @name_box.text.include?("God") or @name_box.text.include?("gOd") or @name_box.text.include?("goD") or @name_box.text.include?("GOd") or @name_box.text.include?("gOD") or @name_box.text.include?("GoD") or @name_box.text.include?("god")
$erro = "#{arg[0]} "+LANGUAGE::CREATEERROARG
$create.refresh
return
end
end
if @name_box.text == "" or @name_box.text == " " or @name_box.text == " " or @name_box.text == " " or @name_box.text == " " or @name_box.text == " " or @name_box.text == " " or @name_box.text == " " or @name_box.text == " " or @name_box.text == " " or @name_box.text == " " or @name_box.text == " " or @name_box.text == " "
$erro = LANGUAGE::CREATENOTNAME
$create.refresh
return
end
if User_Edit::LOADING_ACTIVE == true
$create.visible = false
$create.active = false
$create_box.visible = false
$create_box.active = false
@sprite.bitmap = RPG::Cache.title(User_Edit::LOADING)
@barra = Barra.new
@barra_active_create = true
else
criar_char2
end
end
def criar_char2
$game_party.actors[0].name = @name_box.text
$game_player.refresh
$game_map.autoplay
Network::Main.send_start
Graphics.freeze
$chat_ativo_agr = true
$scene = Scene_Reinit.new
$fechando_ativar = true
if $sexo == LANGUAGE::MAN
$genero = 1
$game_party.actors[0].sexo = LANGUAGE::MAN
elsif $sexo == LANGUAGE::WOMAN
$genero = 2
$game_party.actors[0].sexo = LANGUAGE::WOMAN
end
$guild_name = ""
$guild_lider_name = ""
$guild_position = LANGUAGE::GUILDRANK
$flag = 1
$guild_points = 0
if Network::Main.group == 'admin'
$game_party.actors[0].grupo = "Admin"
end
Network::Main.send_register(@name_box.text+"-Char" , @name_box.text)
$game_temp.chat_log.push(LANGUAGE::NOMOTD)
autosave
end
def reset_gra
$grafiche.update
@current_grp = 0
$game_actors[1].set_chara($grafiche.sex[$game_actors[1].class_id][@current_grp])
end
def next_class
@current_grp = 0
$grafiche.update
if $game_actors[1].class_id <= $data_classes.size - 2
$game_actors[1].class_id += 1
else
$game_actors[1].class_id = 1
end
$game_actors[1].set_chara($grafiche.sex[$game_actors[1].class_id][@current_grp])
$create.refresh
end
def prev_class
@current_grp = 0
$grafiche.update
if $game_actors[1].class_id == $data_classes.size - 1
$game_actors[1].class_id -= 1
$game_actors[1].set_chara($grafiche.sex[$game_actors[1].class_id][@current_grp])
$grafiche.update
$create.refresh
return
end
if $game_actors[1].class_id == 1
$game_actors[1].class_id = $data_classes.size - 1
$game_actors[1].set_chara($grafiche.sex[$game_actors[1].class_id][@current_grp])
$grafiche.update
$create.refresh
return
end
if $game_actors[1].class_id <= $data_classes.size - 2
$game_actors[1].class_id -= 1
else
$game_actors[1].class_id = 1
end
$game_actors[1].set_chara($grafiche.sex[$game_actors[1].class_id][@current_grp])
$create.refresh
end
def next_gr
@act = $game_party.actors[0]
if @current_grp <= $grafiche.sex[@act.class_id].size-2
@current_grp += 1
$grafiche.update
$game_actors[1].set_chara($grafiche.sex[@act.class_id][@current_grp])
end
$create.refresh
end
def prev_gr
@act = $game_party.actors[0]
return if @current_grp == 0
if @current_grp >= $grafiche.sex[@act.class_id].size-2
@current_grp -= 1
$grafiche.update
$game_actors[1].set_chara($grafiche.sex[@act.class_id][@current_grp])
$create.refresh
return
end
if @current_grp <= $grafiche.sex[@act.class_id].size-2
@current_grp -= 1
$grafiche.update
$game_actors[1].set_chara($grafiche.sex[@act.class_id][@current_grp])
end
$create.refresh
end
def back_gr
@act = $game_party.actors[0]
if @current_grp > 0 then
@current_grp -= 1
$grafiche.update
$game_actors[1].set_chara($grafiche.sex[@act.class_id][@current_grp])
end
$create.refresh
end
def str
if $distribuir_pontos >= 1
$distribuir_pontos -= 1
$game_actors[1].str += 1
$create.refresh
else
$create.refresh
end
end
def dex
if $distribuir_pontos >= 1
$distribuir_pontos -= 1
$game_actors[1].dex += 1
$create.refresh
else
$create.refresh
end
end
def agi
if $distribuir_pontos >= 1
$distribuir_pontos -= 1
$game_actors[1].agi += 1
$create.refresh
else
$create.refresh
end
end
def int
if $distribuir_pontos >= 1
$distribuir_pontos -= 1
$game_actors[1].int += 1
$create.refresh
else
$create.refresh
end
end
# Fim da Scene Title
end
Agora troque sua [WIN] Load_Character(fica debaixo do script acima), por esta:
- Código:
#==============================================================================
# ** Load Character
#------------------------------------------------------------------------------
# By Valentine
# Editado para o SiS > RD12
#==============================================================================
class Load_Character < Window_Base
def initialize(x,y,a,b,id)
super(x,y,a,b)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 200
@id_char = id
self.windowskin = RPG::Cache.windowskin("WindSkinC")
name = Network::Main.name
SiS.exist(id)
$sis_id = id
refresh
end
def refresh
Network::Main.update
self.contents.clear
rect = Rect.new(4, 0, self.contents.width - 8, 32)
self.contents.draw_text(rect,LANGUAGE::LOADCHARSLOT+"#{@id_char}", 1)
if $char_exist == "true"
bitmap = RPG::Cache.character($SiS_Contents[$sis_id][1].to_s, 4)
cw = bitmap.rect.width / 4
ch = bitmap.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
rect = Rect.new(4, 70, self.contents.width - 8, 32)
@text = "#{$SiS_Contents[$sis_id][0]}"
self.contents.draw_text(rect, @text, 1)
self.contents.font.color = Color.new(0,0,0)
self.contents.blt(54, 30, bitmap, src_rect)
$ban = []
if $SiS_Contents[$sis_id][27] == LANGUAGE::BANNED
$ban[@id_char] = true
self.contents.font.color = Color.new(255,0,0)
rect = Rect.new(4, 97, self.contents.width - 8, 32)
self.contents.draw_text(rect, LANGUAGE::BANNED, 1)
end
end
end
end
Agora vá no script [GM] Game_Actor, em baixo da linha 47 está:
- Código:
level = $game_party.actors[0].level
- Código:
return unless $status
Agora no script [GM] Game_Party, em baixo da linha 21(um end), adiciona:
- Código:
return unless $item_w
No mesmo script, de baixo da linha 50(um end também), adicione a mesma linha acima.
Mesma coisa de baixo da linha 65(mesmo script), adicione a mesma linha acima.
Pronto, agora o client está configurado para o SiS, falta só os scripts no servidor.
Para isso vá na pasta do seu server, na pasta scripts você verá um arquivo chamado Functions.lua, abra-o com o bloco de notas, ou Scite, ou outro editor.
Apague tudo e cole esse código:
- Código:
-- The process function to organize protocol
-- Copyright(c) 2006 sUiCiDeMAniC
-- Email: manic15@gmail.com
-- Last update: 05/11/06
-- Save in Server by RD12
--------------------------------
-- Main Proccessing --
--------------------------------
function process(cmd,data)
--------------------------------
-- CHAT --
--------------------------------
if cmd == "<chat>" then
do NP():SendToAll(data) end
--------------------------------
-- AUTHENFICATION (0) --
--------------------------------
elseif cmd == "<0>" then
do local sname = NP():GetServerName()
NP():SendToUser(user.id,"<0 "..user.id..">'e' n="..sname.."</0>") end
elseif cmd == "<auth>" then
do local sname = NP():GetServerName()
NP():SendToUser(user.id,"<auth "..user.id..">'e' n="..sname.."</auth>") end
--------------------------------
-- ID Request (1) --
--------------------------------
elseif cmd == "<1>" then
do NP():SendToUser(user.id,"<1>"..user.id.."</1>") end
elseif cmd == "<getid>" then
do NP():SendToUser(user.id,"<getid>"..user.id.."</getid>") end
--------------------------------
-- NAME Request (2) --
--------------------------------
elseif cmd == "<2>" then
do NP():SendToUser(user.id,"<2>"..user.name.."</2>") end
elseif cmd == "<getname>" then
do NP():SendToUser(user.id,"<getname>"..user.name.."</getname>") end
--------------------------------
-- PROFILE/GROUP Request (3)--
--------------------------------
elseif cmd == "<3>" then
if user.profile == nil then
do NP():SendToUser(user.id,"<3>'standard'</3>") end
else
do NP():SendToUser(user.id,"<3>"..user.profile.."</3>") end
end
elseif cmd == "<getgroup>" then
if user.profile == nil then
do NP():SendToUser(user.id,"<getgroup>'standard'</getgroup>") end
else
do NP():SendToUser(user.id,"<getgroup>"..user.profile.."</getgroup>") end
end
--------------------------------
-- CLOSE USER (4) --
--------------------------------
elseif cmd == "<4>" then
do NP():CloseSocket(user.ip) end
elseif cmd == "<close>" then
do NP():CloseSocket(user.ip) end
--------------------------------
-- NETPLAYER (5) --
--------------------------------
elseif cmd == "<5>" then
do
local ndata = string.gsub(data,"<5>","")
NP():SendToAll("<5 "..user.id..">"..ndata)
end
elseif cmd == "<netact>" then
do
local nadata = string.gsub(data,"<netact>","")
NP():SendToAll("<netact "..user.id..">"..nadata)
end
elseif cmd == "<netplayer>" then
do
local ndata = string.gsub(data,"<netplayer>","")
NP():SendToAll("<netplayer "..user.id.." >"..ndata)
end
--------------------------------
-- MAP PLAYER ID (6) --
--------------------------------
elseif cmd == "<6a>" then
do
--data = string.gsub(data, " ", "")
mapp_id = string.gsub(data, "<6a>", "")
--NP():SendToUser(user.id,"<6a>'Confirmed'</6a>\n")
end
elseif cmd == "<mappid>" then
do
mapp_id = string.gsub(data, "<mappid>", "")
NP():SendToUser(user.id,"<mappid>'Confirmed'</mappid>\n")
end
elseif cmd == "<6b>" then
do NP():SendToUser(user.id,"<6a>"..mapp_id.."</6a>") end
--------------------------------
-- MAP PLAYER (6) --
--------------------------------
elseif cmd == "<6>" then
do
local nndata = string.gsub(data,"<6>","")
NP():SendToUser(mapp_id,"<6 "..user.id..">"..nndata)
end
--elseif cmd == "<6>" then
-- do NP():SendToUser(mapp_id, data)
-- NP():SendToUser(user.id, mapp_id..data.."\n")
-- end
elseif cmd == "<mapplayer>" then
do NP():SendToUser(mapp_id, data)
NP():SendToUser(user.id, mapp_id..data.."\n")
end
--------------------------------
-- KICK (7) --
--------------------------------
elseif cmd == "<7>" then
do local kickid = string.gsub(data,"<7>","")
local kickid = string.gsub(kickid,"</7>","")
NP():SendToUser(kickid, "<18>kicked</18>\n")
file = io.open("Moderation Logs\\ModLog - "..user.ip.." - "..user.name..".txt", "a+")
file:write(kickid..data.."\n")
file:close()
end
elseif cmd == "<kick>" then
do local kickid = string.gsub(data,"<kick>","")
local kickid = string.gsub(kickid,"</kick>","")
NP():SendToUser(kickid, "<admin>kicked</admin>\n")
end
--------------------------------
-- KICK ALL (8) --
--------------------------------
elseif cmd == "<8>" then
do
NP():SendToAll(kickid, "<18>kick_all</18>\n")
file = io.open("Moderation Logs\\ModLog - "..user.ip.." - "..user.name..".txt", "a+")
file:write(data.."\n")
file:close()
end
elseif cmd == "<kickall>" then
do
NP():SendToAll(kickid, "<admin>kick_all</admin>\n")
end
--------------------------------
-- REMOVE (9) --
--------------------------------
elseif cmd == "<9>" then
do
NP():SendToAll(data)
end
elseif cmd == "<remove>" then
do
NP():SendToAll(data)
end
--------------------------------
-- REMOVE (9a) --
--------------------------------
elseif cmd == "<9a>" then
do
NP():SendToAll(data)
end
elseif cmd == "<remove>" then
do
NP():SendToAll(data)
end
--------------------------------
-- SYSTEM (10) --
--------------------------------
elseif cmd == "<10>" then
do NP():SendToAll(data) end
elseif cmd == "<system>" then
do NP():SendToAll(data) end
--------------------------------
-- TRADE ID (12) --
--------------------------------
elseif cmd == "<12a>" then
do
data = string.gsub(data, " ", "")
trade_id = string.gsub(data, "<12a>", "")
NP():SendToUser(user.id,"<12a>'Confirmed'</12a>")
end
elseif cmd == "<tradeid>" then
do
trade_id = string.gsub(data, "<tradeid>", "")
NP():SendToUser(user.id,"<tradeid>'Confirmed'</tradeid>")
end
--------------------------------
-- TRADE (12) --
--------------------------------
elseif cmd == "<12>" then
do NP():SendToUser(trade_id, data) end
elseif cmd == "<trade>" then
do NP():SendToUser(trade_id, data) end
--------------------------------
-- PRIVATE CHAT ID (13) --
--------------------------------
elseif cmd == "<13a>" then
do
data = string.gsub(data, " ", "")
pchat_id = string.gsub(data, "<13a>", "")
--NP():SendToUser(user.id,"<13a>'Confirmed'</13a>")
end
elseif cmd == "<pchatid>" then
do
pchat_id = string.gsub(data, "<pchatid>", "")
NP():SendToUser(user.id,"<pchatid>'Confirmed'</pchatid>")
end
--------------------------------
-- PRIVATE CHAT (13) --
--------------------------------
elseif cmd == "<13>" then
do local pmesg = string.gsub(data,"<13>","")
NP():SendToUser(pchat_id, "<13 "..user.id..">"..pmesg) end
elseif cmd == "<pchat>" then
do NP():SendToUser(pchat_id, data) end
--------------------------------
-- Poke (15) --
--------------------------------
elseif cmd == "<15>" then
do local idpoke = string.gsub(data,"<15>","")
NP():SendToUser(idpoke,"<15>"..user.id.." poke")
end
--------------------------------
-- SLAP PLAYER ID (16) --
--------------------------------
elseif cmd == "<16a>" then
do
data = string.gsub(data, " ", "")
slapp_id = string.gsub(data, "<16a>", "")
NP():SendToUser(user.id,"<16a>'Confirmed'</16a>\n")
end
elseif cmd == "<slappid>" then
do
slapp_id = string.gsub(data, "<slappid>", "")
NP():SendToUser(user.id,"<slappid>'Confirmed'</slappid>\n")
end
--------------------------------
-- SLAP PLAYER (16) --
--------------------------------
elseif cmd == "<16>" then
do
NP():SendToUser(slapp_id,"<18>"..data.."</18>\n")
file = io.open("Moderation Logs\\ModLog - "..user.ip.." - "..user.name..".txt", "a+")
file:write(slapp_id..data.."\n")
file:close()
end
elseif cmd == "<slap>" then
do
NP():SendToUser(slapp_id,"<admin>"..data.."</admin>\n")
end
--------------------------------
-- TEST END (20) --
--------------------------------
elseif cmd == "<20>" then
do NP():CloseSocket(user.id) end
elseif cmd == "<testend>" then
do NP():CloseSocket(user.id) end
--------------------------------
-- PvP (PvP) --
--------------------------------
elseif cmd == "<attack_id>" then
do attackid = string.gsub(data,"<attack_id>","") end
elseif cmd == "<result_id>" then
do resultid = string.gsub(data,"<result_id>","") end
elseif cmd == "<attack_effect>" then
do NP():SendToUser(attackid,data) end
elseif cmd == "<result_effect>" then
do NP():SendToUser(resultid,data) end
--------------------------------
-- State (PvP) --
--------------------------------
elseif cmd == "<state_id>" then
do stateid = string.gsub(data,"<state_id>","") end
elseif cmd == "<state>" then
do NP():SendToUser(stateid,data) end
--------------------------------
-- Error (err) --
--------------------------------
elseif cmd == "<err>" then
do local bugline = string.gsub(data,"<err>","")
local bugline = string.gsub(bugline,"</err>","")
file = io.open("Error Logs\\ErrorLog - "..user.ip.." - "..user.name..".txt", "a+")
file:write(bugline.."\n")
file:close()
end
elseif cmd == "<showani>" then
do NP():SendToAll(data) end
--------------------------------
-- Map Chat ID (21) --
--------------------------------
elseif cmd == "<21a>" then
do
data = string.gsub(data, " ", "")
mchat_id = string.gsub(data, "<21a>", "")
NP():SendToUser(user.id,"<21a>'Confirmed'</21a>")
end
--------------------------------
-- Map Chat (21) --
--------------------------------
elseif cmd == "<21>" then
do
NP():SendToUser(mchat_id, data)
end
--------------------------------
-- Get PM Message (22a) --
--------------------------------
elseif cmd == "<22a>" then
do
file = io.open("Private Messages\\PM - "..user.name..".txt", "r")
for line in file:lines() do
NP():SendToUser(user.id,"<22a>"..line.."</22a>\n")
end
NP():SendToUser(user.id,"<22a>Compelete</22a>\n")
file:close()
end
--------------------------------
-- Get PM Size (22c) --
--------------------------------
elseif cmd == "<22c>" then
do
pmcode = string.gsub(data,"<22c>","")
pmsize = 0
file = io.open("Private Messages\\PM - "..pm_username..".txt", "r")
for line in file:lines() do
for word in string.gfind(line, "%a+") do
if word == "aaPMaa" then
pmsize = pmsize+1
end
end
end
NP():SendToUser(user.id,"<22c>"..pmsize.."</22c>\n")
file:close()
end
--------------------------------
-- Write PM TO (22b) --
--------------------------------
elseif cmd == "<22b>" then
do
data = string.gsub(data, " ", "")
pm_username = string.gsub(data, "<22b>", "")
end
--------------------------------
-- Write PM MEssage (22d) --
--------------------------------
elseif cmd == "<22d>" then
do
data = string.gsub(data,"<22d>","")
data = string.gsub(data,"</22d>","")
file = io.open("Private Messages\\PM - "..pm_username..".txt", "a+")
file:write(data.."\n")
file:close()
end
--------------------------------
--Delete ALL PM MEssages (22e)--
--------------------------------
elseif cmd == "<22e>" then
do
file = io.open("Private Messages\\PM - "..user.name..".txt", "w+")
file:close()
end
--------------------------------
-- Self Switch (23) --
--------------------------------
elseif cmd == "<23>" then
do NP():SendToAll(data) end
--------------------------------
-- Trade Request(24) --
--------------------------------
elseif cmd == "<24>" then
do
data = string.gsub(data, " ", "")
trade_id = string.gsub(data, "<24>", "")
end
--------------------------------
-- Trade Request(24c) --
--------------------------------
elseif cmd == "<24c>" then
do
data = string.gsub(data, " ", "")
NP():SendToUser(user.id,"<24a>"..data.."</24a>")
NP():SendToUser(trade_id, data)
end
--------------------------------
-- Trade Exit(24d) --
--------------------------------
elseif cmd == "<24d>" then
do
data = string.gsub(data, " ", "")
NP():SendToUser(trade_id, data)
end
--------------------------------
-- Trade Man ID(25) --
--------------------------------
elseif cmd == "<25>" then
do
data = string.gsub(data, " ", "")
tradeid = string.gsub(data, "<25>", "")
end
--------------------------------
-- Trade Request(24a) --
--------------------------------
elseif cmd == "<25a>" then
do NP():SendToUser(tradeid, data) end
--------------------------------
-- Trade Request(24b) --
--------------------------------
elseif cmd == "<25b>" then
do NP():SendToUser(tradeid, data) end
--------------------------------
-- Trade Request(24d) --
--------------------------------
elseif cmd == "<25d>" then
do NP():SendToUser(tradeid, data) end
--------------------------------
-- Trade Request(24e) --
--------------------------------
elseif cmd == "<25e>" then
do NP():SendToUser(tradeid, data) end
--------------------------------
-- Trade Request(24f) --
--------------------------------
elseif cmd == "<25f>" then
do NP():SendToUser(tradeid, data) end
--
--Salvar os dados principais do Char
elseif cmd == "<26a>" then
do
local save_info = string.gsub(data,"<26a>","")
local save_info = string.gsub(save_info,"</26a>","")
local save_info = string.gsub(save_info,"<n>","\n")
file = io.open("Jogadores\\"..user.name.."-1"..".txt", "w+")
file:write(save_info)
file:close()
end
elseif cmd == "<26b>" then
do
local save_info = string.gsub(data,"<26b>","")
local save_info = string.gsub(save_info,"</26b>","")
local save_info = string.gsub(save_info,"<n>","\n")
file = io.open("Jogadores\\"..user.name.."-2"..".txt", "w+")
file:write(save_info)
file:close()
end
elseif cmd == "<26c>" then
do
local save_info = string.gsub(data,"<26c>","")
local save_info = string.gsub(save_info,"</26c>","")
local save_info = string.gsub(save_info,"<n>","\n")
file = io.open("Jogadores\\"..user.name.."-3"..".txt", "w+")
file:write(save_info)
file:close()
end
-- Pedir os dados principais do Char
elseif cmd == "<27>" then
do local char_id = string.gsub(data,"<27>","")
local char_id = string.gsub(char_id,"</27>","")
file = io.open("Jogadores\\"..user.name.."-"..char_id..".txt", "r")
for line in file:lines() do
NP():SendToUser(user.id,"<27>"..line.."</27>\n")
end
file:close()
end
--end
--Verificar se o char existe
elseif cmd == "<28>" then
do
data = string.gsub(data, "<28>", "")
data = string.gsub(data, "</28>", "")
local f = io.open("Jogadores\\"..user.name.."-"..data..".txt", "r")
if f ~= nil then
io.close(f)
NP():SendToUser(user.id, "<28>true</28>\n")
else
NP():SendToUser(user.id, "<28>false</28>\n")
end
end
--Deletar Char
elseif cmd == "<29>" then
do
data = string.gsub(data, "<29>", "")
data = string.gsub(data, "</29>", "")
os.remove("Jogadores\\"..user.name.."-"..data..".txt")
end
end
end
Agora salve, é claro! E crie uma pasta chamada Jogadores, na mesma pasta do seu servidor. As contas serão salvas lá.
Galera faltaram 2 coisas no client, vão no Script Network, linha 950, em baixo de:
- Código:
def self.update_outgame(line)
case line
- Código:
when /<27>(.*)<\/27>/
SiS.load($1)
when /<28>(.*)<\/28>/
$char_exist = $1
Agora Substitua o [ACT] Auto Save
Substitua para
- Código:
#==============================================================================
# ** Auto Save
# By Valentine
#==============================================================================
def autosave
SiS.save
end
def resetwindows
$equip_w.visible = false
$equip_w.active = false
$member_list.visible = false
$member_list.active = false
$item_w.visible = false
$item_w.active = false
$janela_gold_w.visible = false
$help_w.visible = false
$help_w.active = false
$help_w_2.visible = false
$help_w_2.active = false
$help_w.visible = false
$help_w.active = false
$painel_adm.visible = false
$painel_adm.active = false
$convite.visible = false
$convite.active = false
$teleport.visible = false
$teleport.active = false
$skill.visible = false
$skill.active = false
$flag1.visible = false
$guild_w.visible = false
$guild_w.active = false
$msg.visible = false
$msg.active = false
$flag2.visible = false
$guild_created.visible = false
$guild_created.active = false
$memorizando_skill = false
$memorizando = false
$status.visible = false
$status.active = false
$quest_list.visible = false
$quest_list.active = false
$quest_w.visible = false
$quest_w.active = false
end
É só isso pessoal(eu acho )
Demo: http://www.mediafire.com/?8vxm52b0fej0579
Créditos RD12
Última edição por RD12 em Sáb Jul 28, 2012 1:08 pm, editado 7 vez(es)