Suporte ao desenvolvimento de jogos!


    Comando "/save"

    Compartilhe
    avatar
    Nãner
    Iniciante
    Iniciante

    Mensagens : 58
    Créditos : 16

    Comando "/save"

    Mensagem por Nãner em Sex Ago 12, 2011 2:11 pm

    Esse comando serve p/ caso o server caia (por um RTE ou algo do tipo), o player tenha seus dados (lvl, stat points, str points, etc) salvos...

    Insira esse código no fim de seu main.txt:

    Código:
    Sub Save(index) 
    Call PlayerMsg(INDEX, "Você salvou seus dados", 1)
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "NecklaceSlot" , "0")
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "RingSlot" , "0")
    Call PutVar("Banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "NecklaceSlot" , "0")
    Call PutVar("Banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "RingSlot" , "0")
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Guild" , GetPlayerGuild(index))
    Call PutVar("Banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Guild" , GetPlayerGuild(index))

    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "EXP" , GetPlayerExp(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Class" , GetPlayerClass(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Sprite" , Index) , "Sprite" , GetPlayerSprite(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "ArmorSlot" , GetPlayerArmorSlot(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "WeaponSlot" , GetPlayerWeaponSlot(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "HelmetSlot" , GetPlayerHelmetSlot(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "ShieldSlot" , GetPlayerShieldSlot(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Level" , GetPlayerLevel(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "HP" , GetPlayerHP(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "MP" , GetPlayerMP(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "SP" , GetPlayerSP(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "STR" , GetPlayerSTR(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "DEF" , GetPlayerDEF(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "SPEED" , GetPlayerSPEED(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "MAGI" , GetPlayerMAGI(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "POINTS" , GetPlayerPOINTS(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Map" , GetPlayerMap(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , (Index) , "X" , GetPlayerX(Index))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Y" , GetPlayerY(Index))
    n = 1
    Do While n < 25
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "InvItemNum" & n, GetPlayerInvItemNum(Index, n))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "InvItemVal" & n, GetPlayerInvItemValue(Index, n))
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "InvItemDur" & n, GetPlayerInvItemDur(Index, n))
    n = n + 1
    Loop
    n = 1
    Do While n < 21
    Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "Spell" & n, GetPlayerSpell(Index, n))
    n = n + 1
    Loop
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "NecklaceSlot" , "0")
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "RingSlot" , "0")
    Call PutVar("Banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "NecklaceSlot" , "0")
    Call PutVar("Banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "RingSlot" , "0")
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "EXP" , GetPlayerExp(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Class" , GetPlayerClass(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Sprite" , GetPlayerSprite(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "ArmorSlot" , GetPlayerArmorSlot(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "WeaponSlot" , GetPlayerWeaponSlot(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "HelmetSlot" , GetPlayerHelmetSlot(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "ShieldSlot" , GetPlayerShieldSlot(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Level" , GetPlayerLevel(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "HP" , GetPlayerHP(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "MP" , GetPlayerMP(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "SP" , GetPlayerSP(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "STR" , GetPlayerSTR(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "DEF" , GetPlayerDEF(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "SPEED" , GetPlayerSPEED(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "MAGI" , GetPlayerMAGI(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "POINTS" , GetPlayerPOINTS(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Map" , GetPlayerMap(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "X" , GetPlayerX(Index))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini " , "CHAR" & GetPlayerCharNum(Index) , "Y" , GetPlayerY(Index))
    n = 1
    Do While n < 25
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "InvItemNum" & n, GetPlayerInvItemNum(Index, n))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "InvItemVal" & n, GetPlayerInvItemValue(Index, n))
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "InvItemDur" & n, GetPlayerInvItemDur(Index, n))
    n = n + 1
    Loop
    n = 1
    Do While n < 21
    Call PutVar("banks\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "Spell" & n, GetPlayerSpell(Index, n))
    n = n + 1
    Loop
    End Sub

    Agora procure por:
    Código:
    If LCase(Trim(TextSay)) = "/admin" Then
            If GetPlayerAccess(index) > 0 Then
                Call PlayerMsg(index, "Social Commands:", 15)
                Call PlayerMsg(index, """msghere = Global Admin Message", 15)
                Call PlayerMsg(index, "=msghere = Private Admin Message", 15)
                Call PlayerMsg(index, "Available Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", 15)
            End If
        Exit Sub
        End If

    Abaixo adicione:
    Código:
    If LCase(Mid(TextSay, 1, 5)) = "/save" Then
            Call Save(index)
        Exit Sub
        End If

    Procure por:
    Código:
    Sub LeftGame(index)
    Dim GameName
    Dim n

    Insira esse código na linha abaixo:
    Código:
    Call Save(index)


    Feito isso basta testar Wink
    Espero que gostem...
    Até mais!

    Créditos: Daniel
    RenanR


    Até, Renan.
    avatar
    Cordobes
    Iniciante
    Iniciante

    Mensagens : 35
    Créditos : 0

    Re: Comando "/save"

    Mensagem por Cordobes em Qua Out 12, 2011 10:15 pm

    Podrian explicarme si esto sirve para corregir el fallo de:

    cript '[act] auto save' line 10 eeno::ENOENT occured.

    Que un jugador conectado a mi servidor no le guarda el jugador si la cuenta...
    avatar
    Nanzin
    Membro de Honra
    Membro de Honra

    Mensagens : 1558
    Créditos : 252

    Re: Comando "/save"

    Mensagem por Nanzin em Qua Out 12, 2011 10:18 pm

    @cordobes > é elysium isso?

    se nao me engano isso que voce postou ai é no NP Master v3.0
    e eu nunca vi esse erro!
    poste uma screen

    @topico > muiito bom, parece uma programaçao bem simples!

    abraços


    _________________


    Para Aqueles que gostam de Min e de meu Trabalho;
    Upem Meu Pet nao custa nda!!


    Pet:
    avatar
    Cordobes
    Iniciante
    Iniciante

    Mensagens : 35
    Créditos : 0

    Re: Comando "/save"

    Mensagem por Cordobes em Qua Out 12, 2011 10:51 pm

    El problema es el siguiente: Cuando un usuario se registra, la cuenta y contraseña la guarda el servidor pero el jugador lo guarda el servidor en el pc del cliente, eso es un problema a la hora de servidor online, ¿Hay alguna manera de que el servidor guarde el personaje en los archivos del usuario?

    Traductor google:

    O problema é este: Quando um usuário se registra conta e senha do servidor, mas mantém o jogador no servidor salva o pc do cliente, isso é um problema quando o servidor online, existe alguma maneira que o servidor armazena o personagem em arquivos do usuário?
    avatar
    tenchumaster
    Banido
    Banido

    Mensagens : 578
    Créditos : 76

    Re: Comando "/save"

    Mensagem por tenchumaster em Dom Nov 06, 2011 5:44 pm

    Sempre quis aprender script essas coisas !


    _________________




    Barra de fan do meu joguinho use voce tambem

    [code:1][URL=http://imageshack.us/photo/my-images/163/barradefan.jpg/][IMG]http://img163.imageshack.us/img163/2981/barradefan.jpg[/IMG][/URL]

    [/code:1]
    avatar
    Nãner
    Iniciante
    Iniciante

    Mensagens : 58
    Créditos : 16

    Re: Comando "/save"

    Mensagem por Nãner em Qui Nov 10, 2011 7:32 pm

    Isso armazena todos os dados do personagem no arquivo de sua conta, salvando o mesmo.

    Felipe1998
    Novato
    Novato

    Mensagens : 8
    Créditos : 0

    Re: Comando "/save"

    Mensagem por Felipe1998 em Qui Jan 12, 2012 4:02 pm

    Renan me diz uma coisa....aqui, quando eu vou criar um NPC dá error, você sabe o que está acontecendo e como resovler esse problema?

    Obrigado xD

    Conteúdo patrocinado

    Re: Comando "/save"

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Ter Dez 11, 2018 5:15 pm