[++REP] Change automatic ID!
#3

OnPlayerConnect:
Код HTML:
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM `players` WHERE `user` = '%e' LIMIT 1", GetName(playerid));
    mysql_pquery(MySQLCon, query, "OnAccountCheck", "d", playerid);
-----------------------------------------------------------------------------------------
Код HTML:
forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
    new string[228], rows = cache_num_rows();
    if(rows)
    {
        cache_get_row(0, 2, pInfo[playerid][pPass], MySQLCon, 129);
        cache_get_field_content(0, "LastLogin", string), strmid(pInfo[playerid][pLastLogin], string, 0, 255, 255);

   		//string.....
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{EDDC57}Login",string,"Login","Cancel");
	}
    else
    {
        //string.....
        ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"{FFFB80}Registration",string,"Register","Cancel");
    }
    return 1;
}
Код HTML:
if(dialogid == DIALOG_LOGIN)
{
    if(!response) return Kick(playerid);
    if(!strcmp(PasswordHash(inputtext), pInfo[playerid][pPass], false))
    {
        mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM `players` WHERE `user` = '%e' LIMIT 1", GetName(playerid));
        mysql_pquery(MySQLCon, query, "OnPlayerLogin", "d", playerid);
	}
}
Код HTML:
forward OnPlayerLogin(playerid);
public OnPlayerLogin(playerid)
{
	new rows = cache_num_rows();
	if(rows)
	{
	    pInfo[playerid][pID] = cache_get_field_content_int(0, "ID");
	    pInfo[playerid][pAdmin] = cache_get_field_content_int(0, "Admin");
	    pInfo[playerid][pHelper] = cache_get_field_content_int(0, "Helper");
	    pInfo[playerid][pMoney] = cache_get_field_content_int(0, "Money");
	    pInfo[playerid][pScore] = cache_get_field_content_int(0, "Score");
	    pInfo[playerid][pStatus] = cache_get_field_content_int(0, "Status");
	    pInfo[playerid][pReg] = cache_get_field_content_int(0, "Reg");
	    pInfo[playerid][pSex] = cache_get_field_content_int(0, "Sex");
	    pInfo[playerid][pAge] = cache_get_field_content_int(0, "Age");
	    pInfo[playerid][pMute] = cache_get_field_content_int(0, "Mute");
	    // ................. and so on
	}
	return 1;
}
Reply


Messages In This Thread
[++REP] Change automatic ID! - by norton2 - 22.10.2015, 18:28
Re: [++REP] Change automatic ID! - by AbyssMorgan - 22.10.2015, 18:31
Re: [++REP] Change automatic ID! - by norton2 - 22.10.2015, 18:42
Re: [++REP] Change automatic ID! - by norton2 - 23.10.2015, 13:52
Re: [++REP] Change automatic ID! - by Vince - 23.10.2015, 14:09
Re: [++REP] Change automatic ID! - by AbyssMorgan - 23.10.2015, 15:14
Re: [++REP] Change automatic ID! - by norton2 - 23.10.2015, 15:15
Re: [++REP] Change automatic ID! - by norton2 - 23.10.2015, 17:04
Re: [++REP] Change automatic ID! - by J0sh... - 23.10.2015, 17:22
Re: [++REP] Change automatic ID! - by norton2 - 23.10.2015, 17:31

Forum Jump:


Users browsing this thread: 1 Guest(s)