TempNameID 1
#1

hello guys i want if the player cant login set his name TempNameID 1 or 0 or his id

My login Code:
PHP Code:
CMD:login(playerid,params[])
{
    if (
pInfo[playerid][Logged] == 1) return SendClientMessage(playerid,lighterblue,"You are already logged in");
    
format(Jstring, 128, ACCOUNTS_PATH, GetName(playerid));
    if(!
fexist(Jstring))
    {
        
SendClientMessage(playerid,red,"Nick name isn't registered!");
        
SendClientMessage(playerid,lighterblue,"Please '/register' to create your account");
        return 
1;
    }
    
format(Jstring, sizeof(Jstring),"Account \"%s\"\nPlease enter the password to login", GetName(playerid));
    
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Account Access", Jstring, "Login", "Quit");
    return 
1;
} 
OnDialogResponse:
PHP Code:
if(dialogid == DIALOG_LOGIN)
    {
       if(
response)
       {
              new 
Jfile[100],pIP[16],buf[145];
              
format(Jfile, 60, ACCOUNTS_PATH, GetName(playerid));
              
INI_ParseFile(Jfile, "GetPassword", .bExtra = true, .extra = playerid);
              
WP_Hash(buf, sizeof(buf),inputtext);
              if(
strcmp(pInfo[playerid][Password], buf, false) == 0)
              {
                   
format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid));
                   
INI_ParseFile(Jfile, "LoginPlayer", .bExtra = true, .extra = playerid);
                   
SendClientMessage(playerid,green,"You have been succesfully logged In!");
                   
SetPlayerScore(playerid, pInfo[playerid][Score]);
                   
GivePlayerMoney(playerid, pInfo[playerid][Cash]);
                   
pInfo[playerid][Logged] = 1;
                   
GetPlayerIp(playerid,pIP,16);
                   
format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid));
                   new 
INI:ACCOUNT = INI_Open(Jfile);
                   
INI_WriteString(ACCOUNT, "LastLoggedIP", pIP);
                   
INI_Close(ACCOUNT);
                   
#if LoginTextDraw == true
                   
TextDrawHideForPlayer(playerid, TEXT_PASSWORD);
                   
TextDrawHideForPlayer(playerid, TEXT_REGISTER);
                   
TextDrawHideForPlayer(playerid, TEXT_REGISTERED);
                   
CancelSelectTextDraw(playerid);
                   
#endif
              
}
              else
              {
                  
pInfo[playerid][LoginAttempts]++;
                  if(
pInfo[playerid][LoginAttempts] >= MAX_LOGIN_ATTEMPTS)
                  {
                      
format(Jstring, sizeof(Jstring),"%s has been automatically kicked | Reason: 'Incorrect password'", GetName(playerid));
                      
SendToAdmins(orange,Jstring);
                      
ShowPlayerDialog(playerid, JDIALOGS+45, DIALOG_STYLE_MSGBOX, "WARRING","You have been automatically kicked | Reason: 'Incorrect password'", "Ok", "");
                      
SetTimerEx("KickPlayer",100,false,"d",playerid);
                      return 
1;
                  }
                  
format(Jstring, sizeof(Jstring),"Account \"%s\"\nEnter your password to login\n{FF0000}*Incorrect password", GetName(playerid));
                  
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Account Login error",Jstring, "Login", "Quit");
              }
       }
       
#if LoginTextDraw == false
       
else SetTimerEx("KickPlayer",100,false,"d",playerid);
       
#endif 
Reply


Forum Jump:


Users browsing this thread: