SA-MP Forums Archive
[Help] Load maked file - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Load maked file (/showthread.php?tid=71480)



[Help] Load maked file - Diablo1st - 01.04.2009

Hello
I was make a system to load a saved file, the save thing is ok without bugs, so i was trying to make the load part, i don't have problems on compilation but when i use a command for check if lthe value is loaded it wont work, for example player connect with a value set to = 0 if file is loaded this value must change to the value in the file.

here is the code:
pawn Код:
public Open(playerid)
{
    new name[MAX_PLAYER_NAME],
    str[128];
    GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "%s.ini", name);
    new File:account = fopen(str, io_read);
    if(account)
    {
        new string[256];
        new passres[128],
            value[128];
    fread(account, string, sizeof string);
        passres = GetFileString(string);
    while (fread(account, string, 256))
        {
            passres = GetFileString(string);
            if (strfind(passres, "Cash") != -1)
            {
                value = GetFileValue(string);
                PlayerInv[playerid][Object1] = strval(value);
            }
            if (strfind(passres, "PosX") != -1)
            {
                value = GetFileValue(string);
                PlayerInv[playerid][Object2] = strval(value);
            }
            if (strfind(passres, "PosY") != -1)
            {
                value = GetFileValue(string);
                PlayerInv[playerid][Object3] = strval(value);
            }
            if (strfind(passres, "PosZ") != -1)
            {
                value = GetFileValue(string);
                PlayerInv[playerid][Object4] = strval(value);
            }
            fclose(account);
            SendClientMessage(playerid, 0x21DD00FF, "Confermation Text");
        }
    }
    return 1;
}
This is an example of the file when is maked:
Cash: value
PosX: value
PosY: value
PosZ: value
etc...

if you need other things for understand if code is ok just tell me

(the identation is just perfect, on pawn)