por Niunzini Sáb Ago 04, 2012 12:09 pm
Li o tutorial inteirinho, calmamente e passo a passo, porém estou me deparando com esse erro chato:
- Imagem:
Oque acontece?Bem, quando eu me registro e entro pela primeira vez no jogo é tudo normal, eu começo pelado (que é um gráfico que eu coloquei) e recebo um item, este item está com o visual equipament configurado.
Porém, quando eu vou logar na segunda vez esse erro ocorre :/
Alguém também está tendo este problema?
- Script do SiS:
- 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 = 230
#Número de Switches salvas, do ID[1] até o definido
Swit_max = 230
#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
- Script do Visual Equip:
- Código:
#--------------------------------------------------------------------------
# Aqui é o Método de configuração para os equips para adcionar os icones
# relacionado ao ID da arma coloque:
# return ['equip\\icone_da_arma, o] if id == id_do_item_no_database
# E a mesma coisa com armaduras, porem devem ser adcionados depois do "else"
# return ['equip\\Icone_defesa', 0] if id == id_do_equip_no_database
#--------------------------------------------------------------------------
if User_Edit::VISUAL_EQUIP_ACTIVE
def equip_character(type, id)
#Homem
if $genero == 1
if type == 2
# GRAFICOS DA ARMA
# Adcione aqui os equipamentos de ataque
return ['Homem\\Arma3', 0] if id == 1
return ['Homem\\Arma3', 0] if id == 2
return ['Homem\\Arma3', 0] if id == 3
return ['Homem\\Arma3', 0] if id == 4
return ['Homem\\arco_0', 0] if id == 17
return ['Homem\\arco_0', 0] if id == 18
return ['Homem\\arco_0', 0] if id == 19
return ['Homem\\arco_0', 0] if id == 20
return ['Homem\\spear_0', 0] if id == 5
return ['Homem\\spear_0', 0] if id == 6
return ['Homem\\spear_0', 0] if id == 7
return ['Homem\\spear_0', 0] if id == 8
return ['Homem\\weapon-stick01', 0] if id == 29
return ['Homem\\weapon-stick01', 0] if id == 30
return ['Homem\\weapon-stick01', 0] if id == 31
return ['Homem\\weapon-stick01', 0] if id == 32
return ['Homem\\mazza_0', 0] if id == 25
return ['Homem\\mazza_0', 0] if id == 26
return ['Homem\\mazza_0', 0] if id == 27
return ['Homem\\mazza_0', 0] if id == 28
else
# Armaduras, Elmos, escudos etc..
return ['Homem\\Bronze-Shield', 0] if id == 1
return ['Homem\\Bronze-Shield', 0] if id == 2
return ['Homem\\aprendiz', 0] if id == 41
return ['Homem\\chapeu1', 0] if id == 42
return ['Homem\\Gold-Shield', 0] if id == 51
end
end
#Mulher
if $genero == 2
if type == 2
# GRAFICOS DA ARMA
# Adcione aqui os equipamentos de ataque
return ['Mulher\\Arma3', 0] if id == 1
return ['Mulher\\Arma3', 0] if id == 2
return ['Mulher\\Arma3', 0] if id == 3
return ['Mulher\\Arma3', 0] if id == 4
return ['Mulher\\arco_0', 0] if id == 17
return ['Mulher\\arco_0', 0] if id == 18
return ['Mulher\\arco_0', 0] if id == 19
return ['Mulher\\arco_0', 0] if id == 20
return ['Mulher\\spear_0', 0] if id == 5
return ['Mulher\\spear_0', 0] if id == 6
return ['Mulher\\spear_0', 0] if id == 7
return ['Mulher\\spear_0', 0] if id == 8
return ['Mulher\\weapon-stick01', 0] if id == 29
return ['Mulher\\weapon-stick01', 0] if id == 30
return ['Mulher\\weapon-stick01', 0] if id == 31
return ['Mulher\\weapon-stick01', 0] if id == 32
return ['Mulher\\mazza_0', 0] if id == 25
return ['Mulher\\mazza_0', 0] if id == 26
return ['Mulher\\mazza_0', 0] if id == 27
return ['Mulher\\mazza_0', 0] if id == 28
else
# Armaduras, Elmos, escudos etc..
return ['Mulher\\Bronze-Shield', 0] if id == 1
return ['Mulher\\Bronze-Shield', 0] if id == 2
return ['Gold-Shield', 0] if id == 51
return ['Homem\\aprendiz', 0] if id == 41
return ['Homem\\chapeu1', 0] if id == 42
end
end
return false
end
end
- Save do SiS:
- Código:
Niun
base
Membro
(1, 0, 1, 6, 1, 20, 13, 0, 0, 0, 0, 1, 0, 0, 41, 0, 501, 350, 0, 67, 66, 62, 36, 35, 1)
(0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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/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
- Script no Servidor:
- Código:
-- The main script, do not tamper with if you have no knowledge of Lua
-- Copyright(c) 2006 sUiCiDeMAniC
-- Email: manic15@gmail.com
-- Last update: 03/11/06
dofile( "./Scripts/functions.lua" )
function StartUp()
end
function OnConnect()
NP():SendToUser( user.id , "<chat>Bem vindo ao servidor "..NP():GetServerName().. ", divirtase "..user.name.."; Seu ip é: "..user.ip.." e seu grupo é: "..user.group.."</chat>" )
StartNPCLoop()
end
function OnCMD(data,cmd)
do process(cmd,data) end
end
function OnDisconnect()
--NP():SendToAll( "<chat>O jogador "..user.name.." saiu do servidor</chat>" )
end
Erro no Servidor:(Lua Error): ./Scripts/functions.lua:301: attempt to index global 'file' (a nil value)
(Lua Error): ./Scripts/functions.lua:301: attempt to index global 'file' (a nil value)
Obrigado desde já.