Comando /save

    Compartilhe
    avatar
    RenanR
    Membro

    Mensagens : 12
    Level : 2
    Data de inscrição : 03/11/2011

    default Comando /save

    Mensagem por RenanR em Qui Nov 03, 2011 6:07 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.

      Data/hora atual: Dom Nov 18, 2018 11:18 pm