How can i read a value from a file?
#1

Trying to get a skin id from a users file when they connect...

If they've not saved a skin then the default value is "Skin=999"

As soon as the player connects, they're checked weather they are registered or not. If they are their file will be checked for a saved skin...

If the skin is 999 then they'll be sent to class selection... Otherwise they'll be spawned in an area with their saved skin loaded. And remain there until they login..

This is the check i've done for the skin in the players file, It doesn't work right though im always getting CJ skin.

pawn Код:
stock AccountSkinCheck(playerid)
{
    if(gPlayerAccount[playerid] == 1)
    {
      new string[128];
      new plname[32];
      GetPlayerName(playerid, plname, 32);
      format(string, sizeof(string), "lcs-admin/accounts/%s.ini", plname);
      new File: plFile = fopen(string, io_read);

        if(plFile)
      {
      new key[128],val[128],Data[128];

        while (fread(plFile, Data, sizeof(Data)))

        key = ini_GetKey( Data );
        if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSkin] = strval( val ); }

        fclose(plFile);
        }
       
    pSavedSkin[playerid] = 1;
    }
    return 1;
 }
Reply
#2

Anybody know the answer to this?

I tried the wiki and it wasn't much help.
Reply
#3

There is something very similar on V-Admin. BAsically in that Admin Script, each user has their own file with their details such as bank, level, kills/deaths and the usual stuff etc. Their is a variable that checks the skin. If the user has Skin=999, then nothing happens, but if it is not 999, then the player has their skin set to that value as in their user file.

I won't post it here, because Yaheli might not want me to post it. But what you can do is look at the V-Admin filterscript. It's in there. PM me if you need more help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)