/login
#1

PHP код:
        if(sscanf"u[30]"password) return SendClientMessage(playeridCOLOR_RED"* USAGE: /login [password]"); 
True usage? i wanted to make /login and remove dialogs so iam confused with "i, u,r"
Reply
#2

Код:
Specifier(s)			Name				Example values
	i, d			Integer				1, 42, -10
	c			Character			a, o, *
	l			Logical				true, false
	b			Binary				01001, 0b1100
	h, x			Hex				1A, 0x23
	o			Octal				045 12
	n			Number				42, 0b010, 0xAC, 045
	f			Float				0.7, -99.5
	g			IEEE Float			0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E
	u			User name/id (bots and players)	******, 0
	q			Bot name/id			ShopBot, 27
	r			Player name/id			******, 42
Reply
#3

Quote:
Originally Posted by Flamehaze7
Посмотреть сообщение
Код:
Specifier(s)			Name				Example values
	i, d			Integer				1, 42, -10
	c			Character			a, o, *
	l			Logical				true, false
	b			Binary				01001, 0b1100
	h, x			Hex				1A, 0x23
	o			Octal				045 12
	n			Number				42, 0b010, 0xAC, 045
	f			Float				0.7, -99.5
	g			IEEE Float			0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E
	u			User name/id (bots and players)	******, 0
	q			Bot name/id			ShopBot, 27
	r			Player name/id			******, 42
So its better to use "u" or "f"? password can be integer or name
Reply
#4

Quote:
Originally Posted by Loinal
Посмотреть сообщение
So its better to use "u" or "f"? password can be integer or name
it's better to use "u" since "f" is a float and you don't usually put your passwords as 7,5,3.4.5,34,123 or something like that.
Reply
#5

Quote:
Originally Posted by Flamehaze7
Посмотреть сообщение
it's better to use "u" since "f" is a float and you don't usually put your passwords as 7,5,3.4.5,34,123 or something like that.
Nope, i uses the numbers in my password
Reply
#6

Quote:
Originally Posted by Loinal
Посмотреть сообщение
Nope, i uses the numbers in my password
"u" contains numbers too. "f" contains only a float number, nothing more.
Reply
#7

You no need "u" or "r" unless you want the password to be an online player/bot.
Use "s" , cuz strings can have numbers/letters
Reply
#8

if your password is not only numbers, use "s" instead of "u".
Reply
#9

PHP код:
new thepass[30];
CMD:login(playeridparams[])
{
    if(
IsPlayerRegistered[playerid] == && MLogin[playerid] == false)
    {
        new 
query[280];
        if(
sscanf(params"u"thepass)) return SendClientMessage(playeridCOLOR_RED"* USAGE: /login [password]");

        
mysql_format(mysqlquerysizeof(query),"SELECT `IP`, `Password`, `ID` FROM `players` WHERE `Username` = '%e' LIMIT 1"GetName(playerid));
        
mysql_tquery(mysqlquery"Login""iu"playeridthepass);
    }
    return 
1;
}
forward Login(playeridpassword);
public 
Login(playeridpassword)
{
    if(
IsPlayerRegistered[playerid] == && MLogin[playerid] == true)
    {
        
SendClientMessage(playeridCOLOR_RED"* You are already logged in.");
    }
    
    if(
cache_num_rows() >= 1)
    {
        
cache_get_value_name(0"Password"pData[playerid][Password], 129);
        
cache_get_value_name_int(0"ID"pData[playerid][ID]);

        new 
hpass[129]; //for password hashing
        
new query[100]; // for formatting our query.
        
WP_Hash(hpass129thepass);
        if(!
strcmp(hpasspData[playerid][Password])) //remember we have loaded player's password into this variable, pData[playerid][Password] earlier. Now let's use it to compare the hashed password with password that we load
        
{
            
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1"GetName(playerid));
            
mysql_tquery(mysqlquery"OnAccountLoad""i"playerid);
            
MLogin[playerid] = true;

        }
        else 
//if the hashed password didn't match with the loaded password(pData[playerid][Password])
        
{
            new 
tmp[128], str[280];
            
pInfo[playerid][WrongPass]++;
            
format(tmpsizeof(tmp), "9,2%s (ID: %d) tried to login using a wrong password"GetName(playerid), playerid);
            
IRC_GroupSay(groupIDIRC_aCHANNELtmp);
            
IRC_GroupSay(groupIDIRC_CHANNELtmp);
            
format(strsizeof(str), "* %s (ID: %d) tried to login using a wrong password"GetName(playerid), playerid);
            
SendClientMessage(playeridCOLOR_REDstr);
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_RED"* You are not registered, use /register.");
    }
    return 
1;

it doesn't check if the password is the right one or not
Reply
#10

use "s[64]" instead of "u"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)