SA-MP Forums Archive
Need a little help, Please read .. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need a little help, Please read .. (/showthread.php?tid=368904)



Need a little help, Please read .. - Jaber_Brown - 14.08.2012

Im trying to make a registration system, but im stuck in age things

When player enter the age this happend

pawn Код:
public OnAgeGiven(playerid, Age[])
{
    new string2[128];
    format(string2, sizeof(string2), "users/%s.ini", GetPlayerNameEx(playerid));
    new File:example = fopen(string2, io_append);
    if(example)
    {
        strmid(PlayerInfo[playerid][pAge], Age, 0, strlen(Age), 255);
        new ap[32];
        format(ap, 32, "Age=%s\n", PlayerInfo[playerid][pAge]);fwrite(example, ap);
        fclose(example);
        SendClientMessage(playerid, COLOR_RED, "Step 2 Completed!");
        SetPlayerCameraPos(playerid, -2274.2588,110.6220,66.7716);
        SetPlayerCameraLookAt(playerid, -2309.3486,105.3977,35.5809);
        ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Religon","Jewish\nMuslim\nChristian\nCatholic\nIslam\nHindu\nBuddist\nAtheist","Continue","Cancel");
    }
    return 1;
}
What it makes is instead of opening the current User file , it creates another one with Only age,

For example i register with Steven_Ward, when i enter my age, and go check the user folder, i see 2 same files, one has all the Stats but the Age=0 (which means that function or what ever it is has no thing with this file) and i file with only Age=The age i entered , i want to make it edit the current file instead of creating a new one


Re: Need a little help, Please read .. - RedWingz - 15.08.2012

Honestly, I would help if I could, But I've never really worked with something like that (Age)
Sorry, But I'll take a look and I'll see if I can help you.


Re : Need a little help, Please read .. - Jaber_Brown - 15.08.2012

Ok, i'll wait for others


Re: Need a little help, Please read .. - AustinJ - 15.08.2012

When you open a file you need to rewrite the entire file pretty much since if you were just to append the varible to the file then it would take longer and longer to read a file. Take a look at my old post here. https://sampforum.blast.hk/showthread.php?tid=329079


Re : Need a little help, Please read .. - Jaber_Brown - 15.08.2012

Sorry im new in pawn, i didn't understand anything in the thread, can you write me the Pawn code ?


Re : Need a little help, Please read .. - Jaber_Brown - 15.08.2012

Anyone ?