Problem with login system
#1

Hi all, i have a problem with login system, This is how it looks like. http://imgur.com/S0Xsduc
It should show me when i join the server my level, donator rank, job [posao], organisation [organizacija]. As you can see level and donator rank are 0 although i am 30 level and donator rank 5 or so. Also i have a job and i am in organisation but it does not shows me my job and my organisation.
Код:
//I put this on OnPlayerConnect
PlayerTextDrawSetPreviewModel(playerid,LoginRegs5[playerid], GetPlayerSkin(playerid));
PlayerTextDrawShow(playerid,LoginRegs5[playerid]);
new imea[50];
format(imea,sizeof(imea),"%s",GetName(playerid));
PlayerTextDrawSetString(playerid,LoginRegs13[playerid], imea);
PlayerTextDrawShow(playerid,LoginRegs13[playerid]);
new levela[50];
format(levela,sizeof(levela),"%d",PlayerInfo[playerid][pLevel]);
PlayerTextDrawSetString(playerid,LoginRegs14[playerid], levela);
PlayerTextDrawShow(playerid,LoginRegs14[playerid]);
new posoooo[50];
format(posoooo,sizeof(posoooo),"%s",PlayerInfo[playerid][pJob]);
PlayerTextDrawSetString(playerid,LoginRegs16[playerid], posoooo);
PlayerTextDrawShow(playerid,LoginRegs16[playerid]);
new orgaz[50];
format(orgaz,sizeof(orgaz),"%s",PlayerInfo[playerid][pMember]);
PlayerTextDrawSetString(playerid,LoginRegs17[playerid],orgaz);
PlayerTextDrawShow(playerid,LoginRegs17[playerid]);
new dona[50];
format(dona,sizeof(dona),"%d",PlayerInfo[playerid][pVip]);
PlayerTextDrawSetString(playerid,LoginRegs15[playerid],dona);
PlayerTextDrawShow(playerid,LoginRegs15[playerid]);
Reply
#2

Obviously you can't show stuff that hasn't been loaded. The data has to be loaded from somewhere before it can be displayed. Also you can't reliably get a skin from a player that isn't spawned.
Reply
#3

Its not showing i think because of loading your variables. Its loading PlayerInfo variables on login.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
Obviously you can't show stuff that hasn't been loaded. The data has to be loaded from somewhere before it can be displayed. Also you can't reliably get a skin from a player that isn't spawned.
Should i load those files from "users.in" folder in scriptfiles or? Skin can be loaded before player spawns i seen it before on one other server.
Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
Its not showing i think because of loading your variables. Its loading PlayerInfo variables on login.
Slould i put on onplayerconnect my variables PlayerInfo[playerid] [pLevel] [pJob] [pMember] [pVip] [pChar], To load on login or whereelse should i put it.?
Reply
#5

Bump?
Reply
#6

GetPlayerSkin works fine while you are on the class selection, and yes you have to load the values from your "user.ini" or whatever it is, so that the values loads properly.

I suggest this; Show the textdraws once the player is logged in, Instead of showing it before player logs in. This way, The server has a time to process the data. Once the data's are loaded, You can use them on the textdraws or on something elses...
Reply
#7

Can you show me how to load the values from user.ini or give me some example, i want before player login to show him textdraws.
Reply
#8

If you will show the textdraws before the login, The textdraws won't show the proper values that you are looking for..

There are many ways on loading these values, Are you using dini, y_ini ...? You may try searching up for a tutorial on how to load the data from a file.
Reply
#9

Its a Strcmp.

Код:
public UlogujIgraca(playerid,password[])
{
    new tmp2[256];
    new string2[128];
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    split(playername2, playernamesplit, '_');
    format(string2, sizeof(string2), "users/%s.ini", playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
        new PassData[256];
        new keytmp[256], valtmp[256];
        fread( UserFile , PassData , sizeof( PassData ) );
        keytmp = ini_GetKey( PassData );
        if( strcmp( keytmp , "Key" , true ) == 0 )
        {
            valtmp = ini_GetValue( PassData );
            strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
        }
        if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
        {
                new key[ 256 ] , val[ 256 ];
                new Data[ 256 ];
                while ( fread( UserFile , Data , sizeof( Data ) ) )
                {
                    key = ini_GetKey( Data );
                    if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
                    if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
                    if( strcmp( key , "DonateRank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonateRank] = strval( val ); }
                    if( strcmp( key , "UpgradePoints" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gPupgrade] = strval( val ); }
                    if( strcmp( key , "ConnectedTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pConnectTime] = strval( val ); }
                    if( strcmp( key , "Registered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pReg] = strval( val ); }
                    if( strcmp( key , "Sex" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSex] = strval( val ); }
                    if( strcmp( key , "Age" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAge] = strval( val ); }
                    if( strcmp( key , "Origin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pOrigin] = strval( val ); }
                    if( strcmp( key , "CK" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCK] = strval( val ); }
                    if( strcmp( key , "Muted" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMuted] = strval( val ); }
                    if( strcmp( key , "MuteAD" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMuteAD] = strval( val ); }
                    if( strcmp( key , "Respect" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
                    if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
                    if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAccount] = strval( val ); }
                    if( strcmp( key , "Crimes" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrimes] = strval( val ); }
                    if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
                    if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
Reply
#10

Bump!
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)