Not spawning by itself
#1

Heres my code: Of SeifAdmin

pawn Код:
public OnPlayerLogin(playerid, password[])
{
  new name[MAX_PLAYER_NAME], str[128];
  GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/Roleplay/%s.cfg", name);
    new File:account = fopen(str, io_read);
    if (account)
    {
      new pass[256];
      new passres[256], value[256];
      fread(account, pass, sizeof pass);
      passres = GetFileString(pass);
      if (!strcmp("Password", passres))
        {
            value = GetFileValue(pass);
            strmid(AccountInfo[playerid][Password], value, 0, strlen(value), 150);
        }
        if (!strcmp(AccountInfo[playerid][Password], password, true))
        {
          while (fread(account, pass, 256))
            {
                passres = GetFileString(pass);
                if (!strcmp("AdminLevel", passres, true))
                {
                    value = GetFileValue(pass);
                    AccountInfo[playerid][AdminLevel] = strval(value);
                }
                if (!strcmp("Cash", passres, true))
                {
                    value = GetFileValue(pass);
                    AccountInfo[playerid][Cash] = strval(value);
                }
                if (!strcmp("Score", passres, true))
                {
                    value = GetFileValue(pass);
                    AccountInfo[playerid][Score] = strval(value);
                }
        if (!strcmp("Warnings", passres, true))
                {
                    value = GetFileValue(pass);
                    AccountInfo[playerid][Warns] = strval(value);
                }
                if (!strcmp("WarnReason1", passres, true))
                {
                    value = GetFileValue(pass);
                    strmid(AccountInfo[playerid][WarnReason1], value, 0, strlen(value), 128);
                }
                if (!strcmp("WarnReason2", passres, true))
                {
                    value = GetFileValue(pass);
                    strmid(AccountInfo[playerid][WarnReason2], value, 0, strlen(value), 128);
                }
            if (!strcmp("WarnReason3", passres, true))
                {
                    value = GetFileValue(pass);
                    strmid(AccountInfo[playerid][WarnReason3], value, 0, strlen(value), 128);
                }
            }
            fclose(account);
      AccountInfo[playerid][Logged] = 1;
        }
        else
        {
            SendClientMessage(playerid, RED, "Incorrect Password.");
        fclose(account);
        return 1;
        }
        GivePlayerMoney(playerid, AccountInfo[playerid][Cash]);
        SetPlayerScore(playerid, AccountInfo[playerid][Score]);
        format(str, sizeof str, "|- You have successfully logged in as %s -|", name);
        SendClientMessage(playerid, GREEN, str);
        printf("%s has logged in", name);
        TogglePlayerSpectating(playerid, 0);
        SpawnPlayer(playerid);
        if (AccountInfo[playerid][AdminLevel] > 0)
        {
        format(str, sizeof str, "|» You are now logged in as a level %d admin «|", AccountInfo[playerid][AdminLevel]);
            SendClientMessage(playerid, LIGHTGREEN, str);
            ViewCmds[playerid] = 0;
        }
    }
    return 1;
}
As you see at the bottom of that code is

pawn Код:
TogglePlayerSpectating(playerid, 0);
        SpawnPlayer(playerid);
Well it turns of spectating but it dosent spawn me, Why?
Reply
#2

It may be something to do with the spectating toggle right before. Just for a test, make a 1 second timer after the spectate and spawn the player after the one second. See what happens .
Reply
#3

Not working
Reply
#4

everything looks right to me hope you get help soon maybe someone knows how to fix this
Reply
#5

Not working, It refuses to spawn the player Anyone know?
Reply
#6

Still no-one? Please i really REALLY need to fix this!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)