SA-MP Forums Archive
login command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: login command (/showthread.php?tid=160388)



login command - Kar - 16.07.2010

it says successfully logged in and server unknown command help? and it doesnt log me in>><


pawn Код:
CMD:login(playerid, params[])
{
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    new ppw[20], str[128];
    format(pfile, sizeof(pfile), pfile_path, Playername(playerid));
    if(sscanf(params, "s", ppw)) return SendMsg(playerid, RED, "*USAGE: /register [password] - Max length is 20 & minium is 3");
    else if(strlen(ppw) < 3) return SendMsg(playerid, RED, "*Error: Password Is Under The Limit Sorry");
    else if(strlen(ppw) > 20) return SendMsg(playerid, RED, "*Error: Password Is Over The Limit Sorry");
    else if(IsLogged[playerid] == 1) return SendMsg(playerid, RED, "*Error: |- You Are Already Logged In -|");
    else if(!dini_Exists(pfile)) return SendMsg(playerid, RED, "*Error: No account with that username is registered, please register");
    else
    {
        if(dini_Exists(pfile))
        {
            if(strcmp(dini_Get(pfile, "Password"), ppw, true) == 0)
            {
                format(str, sizeof(str), "*Success: You have Successfully Logged In %s", Playername(playerid), dini_Int(pfile, "AdminLevel"));
                SendMsg(playerid, LIME, str);
                LoadPlayer(playerid);
                IsLogged[playerid] = 1;
                SetTimerEx("TimePlayerLogged", 1000, true, "i", playerid);
            }
            else
            {
                SendMsg(playerid, RED, "*Error: Wrong Password. Password Did Not Match With The One You Have Register With.");
            }
        }
    }
    return 1;
}



Re: login command - DJDhan - 16.07.2010

Try this :

Код:
CMD:login(playerid, params[])
{    
	new PlayerName[MAX_PLAYER_NAME];    
	GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);    
	new ppw[20], str[128];    

	format(pfile, sizeof(pfile), pfile_path, Playername(playerid));    

	if(sscanf(params, "s", ppw)) return SendMsg(playerid, RED, "*USAGE: /register [password] - Max length is 20 & minium is 3");    
	if(strlen(ppw) < 3) return SendMsg(playerid, RED, "*Error: Password Is Under The Limit Sorry");    
	if(strlen(ppw) > 20) return SendMsg(playerid, RED, "*Error: Password Is Over The Limit Sorry");    
	if(IsLogged[playerid] == 1) return SendMsg(playerid, RED, "*Error: |- You Are Already Logged In -|");    
	if(!dini_Exists(pfile)) return SendMsg(playerid, RED, "*Error: No account with that username is registered, please register");    
   
	if(strcmp(dini_Get(pfile, "Password"), ppw, true) == 1) return SendMsg(playerid, RED, "*Error: Wrong Password. Password Did Not Match With The One You Have Register With."); 	
	format(str, sizeof(str), "*Success: You have Successfully Logged In %s", Playername(playerid), dini_Int(pfile, "AdminLevel"));                
	SendMsg(playerid, LIME, str);                
	LoadPlayer(playerid);                
	IsLogged[playerid] = 1;                
	SetTimerEx("TimePlayerLogged", 1000, true, "i", playerid);            
	 
	return 1;
}



Re: login command - Kar - 16.07.2010

nope want my script to see?