Simple help needed
#1

Ok so i made a dm server now all of a sudden "pInfo[playerid][Logged]" doesnt work anymore to see if the player is loggedin but it wont work, i set it under the dialog where the player logs in but yet it doesnt set them as logged in and is preventing them from saving there accounts or using commands... Here is the coding

PHP код:
   case DIALOG_ACCLOGIN:
        {
            if ( !
response ) return Kick playerid );
            if( 
response )
            {
                if(
udb_hash(inputtext) == pInfo[playerid][Pass])
                {
                    new 
file[100];
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in to your Account!","Ok","");
                    
GetPlayerIp(playerid,pIP,16);
                    
format(file100PATHGetName(playerid));
                    new 
INI:ACCOUNT INI_Open(file);
                    
INI_SetTag(ACCOUNT,"data");
                    
INI_WriteString(ACCOUNT"LastLoggedIP"pIP);
                    
INI_Close(ACCOUNT);
                    
SetPlayerScore(playeridpInfo[playerid][Score]);
                    
GivePlayerCash(playeridpInfo[playerid][Cash]);
                    
SetPlayerPos(playerid,1918.1643,1175.7311,18.2846);
                    
SetPlayerCameraLookAt(playerid,1918.1643,1175.7311,18.2846);
                    
SetPlayerCameraPos(playerid,1908.1575,1175.7079,18.2846);
                    
SetPlayerFacingAngle(playerid,91.2061);
                    
pInfo[playerid][Logged] = 1//This is where i set them as logged in but it doesn't work
                     
SetTimerEx("pTime"1000true"i"playerid);
                } 
Reply
#2

If you just want to check if they're logged and not saving the variable, you could just:

PHP код:
new Logged[MAX_PLAYERS]; // Add this somewhere on top of your script
public OnPlayerSpawn(playerid)
{
    
Logged[playerid] = 1;
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
Logged[playerid] = 0;
    return 
1;

Reply
#3

Quote:
Originally Posted by Escobabe
Посмотреть сообщение
If you just want to check if they're logged and not saving the variable, you could just:

PHP код:
new Logged[MAX_PLAYERS]; // Add this somewhere on top of your script
public OnPlayerSpawn(playerid)
{
    
Logged[playerid] = 1;
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
Logged[playerid] = 0;
    return 
1;

Xd i know all that i tried it both ways and it didnt set the player as logged, so im wondering why wont it work... i even made a command to manually log my self in n it works but i dont know why it wont work under the dialog if they have successfully logged in
Reply
#4

Try under OnPlayerConnect, under if(fexist(UserPath(playerid))):

PHP код:
public OnPlayerConnect(playerid)
{
     if(
fexist(UserPath(playerid)))
    {
        
// Loading users data code
        
pInfo[playerid][Logged] = 1;
     } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)