if(cache_num_rows() >= 1)
{
cache_get_value_name(0, "IP", IP[playerid], 16);
new newIP[16];// query[300];
GetPlayerIp(playerid, newIP, 16);
IsPlayerRegistered[playerid] = 1;
if(strlen(IP[playerid]) != 0 && !strcmp(IP[playerid], newIP, true)) //Checks that the MySQL IP has a value and that they are the same.
{
new query[150];
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1", pName(playerid));
mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
}
else
{
new string[280];
cache_get_value_name(0, "Password", pData[playerid][Password], 129);
//we will load player's password into pData[playerid][Password] to be used in logging in
cache_get_value_name_int(0, "ID", pData[playerid][ID]); //now let's load player's ID into pData[playerid][ID] so we can use it later
format(string,sizeof(string),"Welcome back to ZoneX {FFFA00}%s\n{FFFFFF}\nYour UserID: %d | Your account is registered on our database\nPlease type your password to login",GetName(playerid),pData[playerid][ID]);
ShowPlayerDialog(playerid, dLOGIN, DIALOG_STYLE_INPUT, "Login", string, "Login", "Quit"); //And since we found a result from the database, which means, there is an account; we will show a login dialog
}
}
public OnAccountLoad(playerid)
{
new score,string[143], join[100];
cache_get_value_int(0, "SkinID", pData[playerid][Skin]);
cache_get_value_name_int(0, "Admin", pData[playerid][Admin]); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
cache_get_value_name_int(0, "Money", pData[playerid][Money]);//Above
cache_get_value_name_int(0,"Kills", pData[playerid][Kills]);
cache_get_value_name_int(0,"Tokens", pData[playerid][Tokens]);
cache_get_value_name_int(0, "Deaths", pData[playerid][Deaths]);
cache_get_value_name_int(0, "Hours", pData[playerid][pHours]);
cache_get_value_name_int(0, "Minutes", pData[playerid][pMinutes]);
cache_get_value_name_int(0, "RaceWon", pData[playerid][RaceWon]);
cache_get_value_name_int(0, "Score", score);
cache_get_value_name_int(0, "ID", pData[playerid][ID]);
cache_get_value_name(0, "Rdate", pData[playerid][Rdate], 12);
print(pData[playerid][Rdate]);
SetPlayerScore(playerid, score);
GivePlayerMoney(playerid, pData[playerid][Money]);//Let's set their money
//somecodes
return 1;
"is not working" is always such a vague description. State what the intended output should be and what the actual output currently is. Add prints in every if and else block to see the program flow.
|
This guy won't understand like this, he want a code to copy and replace it, He got gangsta with this threads.
|
"is not working" is always such a vague description. State what the intended output should be and what the actual output currently is. Add prints in every if and else block to see the program flow.
|
This guy won't understand like this, he want a code to copy and replace it, He got gangsta with this threads.
|
Abso-fucking-lutely right. I've helped him over TeamViewer before, and he understands nothing about his code. He just copies and replaces it himself or by help of someone else..
|
This guy won't understand like this, he want a code to copy and replace it, He got gangsta with this threads.
|