A big problem
#6

here you are:
pawn Код:
public OnPlayerLogin(playerid,password[])
{
    if(IsPlayerNPC(playerid)) return SpawnPlayer(playerid);
    if(IsPlayerNPC(playerid)) return 1;
    new tmp2[256];
    new string2[64];
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    split(playername2, playernamesplit, '_');
    format(string2, sizeof(string2), "Jucatori/%s.ini", playername2);
    new File: UserFile = fopen(string2, io_read);
    if (UserFile)
    {
        new PassData[256];
        new keytmp[256];
        new valtmp[256];
        fread(UserFile, PassData, sizeof(PassData));
        format(keytmp,sizeof(keytmp),"%s",ini_GetKey(PassData));
        if(strcmp(keytmp, "Password", true) == 0)
        {
            format(valtmp,sizeof(valtmp),"%s",ini_GetValue(PassData));
            strmid(PlayerInfo[playerid][pPass], valtmp, 0, strlen(valtmp)-1, 255);
        }
        if(strcmp(PlayerInfo[playerid][pPass],password, true) == 0)
        {
                new key[256];
                new val[256];
                new Data[256];
                while (fread(UserFile , Data, sizeof(Data)))
                {
                    format(key,sizeof(key),"%s",ini_GetKey(Data));
                    if(strcmp(key, "Money", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pCash] = strval(val);
                    }
                    if(strcmp(key, "Muted", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pMuted] = strval(val);
                    }
                    if(strcmp(key, "Level", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pLevel] = strval(val);
                    }
                    if(strcmp(key, "Respect", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pExp] = strval(val);
                    }
                    if(strcmp(key, "Sex", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pSex] = strval(val);
                    }
                    if(strcmp(key, "Origin", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pOrigin] = strval(val);
                    }
                    if(strcmp(key, "Age", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pAge] = strval(val);
                    }
                    if(strcmp(key, "Admin", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pAdmin] = strval(val);
                    }
                    if(strcmp(key, "Kills", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pKills] = strval(val);
                    }
                    if(strcmp(key, "Deaths", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pDeaths] = strval(val);
                    }
                    if(strcmp(key, "Jailed", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pJailed] = strval(val);
                    }
                    if(strcmp(key, "Model", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pModel] = strval(val);
                    }
                    if(strcmp(key, "Tutorial", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pTutorial] = strval(val);
                    }
                    if(strcmp(key, "Оnregistrat", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pReg] = strval(val);
                    }
                    if(strcmp(key, "Int", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pInt] = strval(val);
                    }
                    if(strcmp(key, "Local", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pLocal] = strval(val);
                    }
                    if(strcmp(key , "Char", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pChar] = strval(val);
                    }
                    if(strcmp(key, "FacingAngle", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pFacingAngle] = floatstr(val);
                    }
                    if(strcmp(key, "Health", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pHealth] = floatstr(val);
                    }
                    if(strcmp(key, "Armour", true) == 0)
                    {
                        format(val,sizeof(val),"%s",ini_GetValue(Data));
                        PlayerInfo[playerid][pArmour] = floatstr(val);
                    }
                }
                fclose(UserFile);
        }
        else
        {
            ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"{FFFFFF}Login", "{FFFFFF}Aceasta parola nu este corecta. Mai оncearca o data:" ,"{FFFFFF}Login", "{FFFFFF}Exit");
            fclose(UserFile);
            gPlayerLogTries[playerid] += 1;
            if(gPlayerLogTries[playerid] == 3)
            {
                SendClientMessage(playerid, COLOR_WHITE, "{FA8072}ConsolaJucator: {FFFFFF} Ai luat kick pentru ca ai bagat parola de 3 ori gresita !");
                Kick(playerid);
            }
            return 1;
        }
        if(PlayerInfo[playerid][pAdmin] >= 1)
        {
            format(tmp2, sizeof(tmp2), "{FA8072}ConsolaJucator: {FFFFFF}Te-ai conectat cu level {006400}%d {FFFFFF}admin.",PlayerInfo[playerid][pAdmin]);
            SendClientMessage(playerid, COLOR_WHITE,tmp2);
        }
        if(PlayerInfo[playerid][pLevel] == -999)
        {
            SendClientMessage(playerid, COLOR_GREEN, "{FA8072}ConsolaJucator: {FFFFFF} Esti banat pe acest SERVER!"); // 1
            Ban(playerid);
        }
        if(PlayerInfo[playerid][pReg] == 0)
        {
            PlayerInfo[playerid][pLevel] = 1;
            PlayerInfo[playerid][pExp] = 0;
            PlayerInfo[playerid][pHealth] = 50.0;
            PlayerInfo[playerid][pInt] = 15;
            PlayerInfo[playerid][pLocal] = 255;
            PlayerInfo[playerid][pModel] = 60;
            PlayerInfo[playerid][pReg] = 1;
            GivePlayerMoneyEx(playerid, 50000);
        }
        format(tmp2, sizeof(tmp2), "~w~bine ai venit ~n~~b~   %s", GetName(playerid));
        GameTextForPlayer(playerid, tmp2, 5000, 1);
        GivePlayerMoneyEx(playerid, PlayerInfo[playerid][pCash]);
          SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
          SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
        SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
        SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
        SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
        SetPlayerVirtualWorld(playerid, 0);
        SetCameraBehindPlayer(playerid);
        ResetPlayerWeapons(playerid);
        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pChar], 1964.8954, -1305.2051 ,53.4559, 90, 0, 0, 0, 0, 0, 0);
    }
    return 1;
}
Reply


Messages In This Thread
A big problem - by radiobizza - 14.01.2016, 14:18
Re: A big problem - by Eth - 14.01.2016, 14:25
Re: A big problem - by radiobizza - 14.01.2016, 14:49
Re: A big problem - by Eth - 14.01.2016, 16:28
Re: A big problem - by radiobizza - 14.01.2016, 16:43
Re: A big problem - by Eth - 14.01.2016, 17:05
Re: A big problem - by radiobizza - 14.01.2016, 17:17
Re: A big problem - by Eth - 14.01.2016, 17:22
Re: A big problem - by radiobizza - 14.01.2016, 17:24
Re: A big problem - by Eth - 14.01.2016, 17:26

Forum Jump:


Users browsing this thread: 1 Guest(s)