Need Help ****** Includes
#1

Decided to Switch from DINI to Y-Less Thats got newer i havent been on much to keep track of the changes..


I need help With.. Y-Less ysi Includes Got the register thing down But the saving and Stuff Aint working out Right IF anyone that knows how it works Could you please tutorial me on a few things..
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=244223
https://sampforum.blast.hk/showthread.php?tid=273088
Reply
#3

Dude I Did Everything right ... On them both even on the thread 273088 i Followed the instructions on how to do it but Something aint right..

pawn Код:
enum pInfo
{
    pPass,
    pAccount,
    pFirstname,
    pLastname,
    pAge,
    pGender,
    pCharacter,
    pAdminLevel,
    pCash,
    pScore,
    pReg,
    pVeh,
    pHouse,
    pId,
    pFrank,
    pPrank,
    pJob,
    pHealth,
    pArmour,
    pLocX,
    pLocY,
    pLocZ,
    pLocA,
    pLocI,
    pLocV,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdminLevel]);
    INI_Int("Job",PlayerInfo[playerid][pJob]);
    INI_Int("Health",PlayerInfo[playerid][pHealth]);
    INI_Int("Armour",PlayerInfo[playerid][pArmour]);
    INI_Int("Character",PlayerInfo[playerid][pCharacter]);
    INI_Int("LocX",PlayerInfo[playerid][pLocX]);
    INI_Int("LocY",PlayerInfo[playerid][pLocY]);
    INI_Int("LocZ",PlayerInfo[playerid][pLocZ]);
    INI_Int("LocA",PlayerInfo[playerid][pLocA]);
    INI_Int("LocI",PlayerInfo[playerid][pLocI]);
    INI_Int("LocV",PlayerInfo[playerid][pLocV]);
   
    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
    //SpawnLastSaved(playerid);
    PlayerOnline[playerid] = 1;
    return 1;
}


public SaveUserAccounts(playerid)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    INI_WriteInt(File,"Firstname",PlayerInfo[playerid][pFirstname]);
    INI_WriteInt(File,"Lastname",PlayerInfo[playerid][pLastname]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    INI_WriteInt(File,"Gender",PlayerInfo[playerid][pGender]);
    INI_WriteInt(File,"Registration",PlayerInfo[playerid][pReg]);
    INI_WriteInt(File,"Vehicle",PlayerInfo[playerid][pVeh]);
    INI_WriteInt(File,"House",PlayerInfo[playerid][pHouse]);
    INI_WriteInt(File,"SSN",PlayerInfo[playerid][pId]);
    INI_WriteInt(File,"FireRank",PlayerInfo[playerid][pFrank]);
    INI_WriteInt(File,"PoliceRank",PlayerInfo[playerid][pPrank]);
    INI_WriteInt(File,"Job",PlayerInfo[playerid][pJob]);
    INI_WriteInt(File,"Health",PlayerInfo[playerid][pHealth]);
    INI_WriteInt(File,"Armour",PlayerInfo[playerid][pArmour]);
    INI_WriteInt(File,"Character", GetPlayerSkin(playerid));
    INI_WriteInt(File,"LocX",PlayerInfo[playerid][pLocX]);
    INI_WriteInt(File,"LocY",PlayerInfo[playerid][pLocY]);
    INI_WriteInt(File,"LocZ",PlayerInfo[playerid][pLocZ]);
    INI_WriteInt(File,"LocA",PlayerInfo[playerid][pLocA]);
    INI_WriteInt(File,"LocI",PlayerInfo[playerid][pLocI]);
    INI_WriteInt(File,"LocV",PlayerInfo[playerid][pLocV]);
    INI_Close(File);
    return 1;
}



public SavePlayerPos(playerid)
{
    new INI:File = INI_Open(UserPath(playerid));
    new Float:X, Float:Y, Float:Z, Float:A;
    GetPlayerPos(playerid, X,Y,Z);
    GetPlayerFacingAngle(playerid, A);
    INI_WriteFloat(File, "LocX", X);
    INI_WriteFloat(File, "LocY", Y);
    INI_WriteFloat(File, "LocZ", Z);
    INI_WriteFloat(File, "LocA", A);
    INI_WriteFloat(File, "LocI", GetPlayerInterior(playerid));
    INI_WriteFloat(File, "LocV", GetPlayerVirtualWorld(playerid));
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    Delete3DTextLabel(Admindutylabel[playerid]);
   // SaveStats(playerid);
    SavePlayerPos(playerid);
    SaveUserAccounts(playerid);
    PlayerOnline[playerid] = 0;
    return 1;
}

And this
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered, Type in a password to register", "Register", "Leave");
            new INI:File = INI_Open(UserPath(playerid));
            INI_SetTag(File,"data");
            INI_WriteInt(File,"Password",udb_hash(inputtext));
            INI_WriteInt(File,"Cash",0);
            INI_WriteInt(File,"Admin",0);
            INI_WriteInt(File,"Kills",0);
            INI_WriteInt(File,"Deaths",0);
            INI_WriteInt(File, "LocX",0);
            INI_WriteInt(File, "LocY",0);
            INI_WriteInt(File, "LocZ",0);
            INI_WriteInt(File, "LocA",0);
            INI_WriteInt(File, "LocI",0);
            INI_WriteInt(File, "LocV",0);
            INI_WriteInt(File, "Registration",1);
            INI_Close(File);
            ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Age Section","How old are you?","Submit","Cancel");
        }
    }
    if (dialogid == 2)
    {
        if ( !response ) return Kick ( playerid );
        if( response )
        {
            if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
            {
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
            }
            else
            {
                ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You have entered an incorrect password..", "Enter your password below, LEAVE!!", "Login", "Leave");
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)