Stats not saving on logout/login
#1

Hello, I've got a problem. I'm making a script, but when I make myself admin IG it doesn't save to my userfile. Any ideas why?
Reply
#2

Can you give us the script?
Reply
#3

Which part do you need?
Reply
#4

The one you make yourself admin. the /makeadmin command (or what u use).
Reply
#5

pawn Код:
if(strcmp(cmd, "/makeadmin", true) == 0) // Make player an admin
    {
        if (PlayerInfo[playerid][AdminLevel] >= 1337 || IsPlayerAdmin(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /makeadmin [playerid] [level 1-1338]");
                SendClientMessage(playerid, COLOR_ORANGE, "FUNCTION: Player will be an admin depending on the given level.");
                return 1;
            }
            //new giveplayerid = ReturnUser(tmp, playerid);
            tmp = strtok(cmdtext, idx);
            new level = strval(tmp);
            if(giveplayerid != INVALID_PLAYER_ID)
            {
              if (level >= 0)
              {
                    GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    printf("ADMIN: %s made %s a level %d admin.", sendername, giveplayername, level);
                    format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, sendername);
                    SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "|- Administrator %s has given %s an Admin Level. [Level: %d] -|", sendername,giveplayername,level);
                    SendClientMessageToAdmins(COLOR_RED, string, 1);
                    PlayerInfo[giveplayerid][AdminLevel] = level;
                    format(string, sizeof(string), "You have given %s level %d admin.", giveplayername,PlayerInfo[giveplayerid][AdminLevel]);
                    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                }
                else return SendClientMessage(playerid, COLOR_RED, "You can't go below level 0!");
            }
            else if(giveplayerid == INVALID_PLAYER_ID)
            {
                format(string, sizeof(string), "%i is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_RED, string);
            }
        }
        else SendClientMessage(playerid, COLOR_RED, "You are not a lead admin!");
        return 1;
    }
Reply
#6

Well, there is missing that it saves in the userdata.
I will check it in afternoon, cause i donґt have my script on this PC.

Or anyone else can help.
Reply
#7

Ok thanks alot Jeffry
Reply
#8

Where do you actually save anything to a file ?
Reply
#9

To the userfile, in scriptfiles.
Reply
#10

Where is that piece of code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)