27.09.2015, 21:53
(
Последний раз редактировалось itsCody; 28.09.2015 в 21:26.
)
Are you logging them in with their IP address? Here try this.
Be sure to reset all stats when they disconnect, it will prevent other players who connect with the previous ID to capture those stats.
Change pInfo to your enum thing.
Assuming you're using Whirlpool. So try this
I've edited your check to see if they're registered or not.
I've changed some of your functions so if you get errors just reply with error and the lines. And me or somebody will help you. I didn't really understand why half of the variables were in your OnAccountCheck so if it doesnt work properly you'll have to put them back in.
Be sure to reset all stats when they disconnect, it will prevent other players who connect with the previous ID to capture those stats.
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
if(Logged[playerid] == 1)
{
for(new i; pInfo:i < pInfo; i++) pData[playerid][pInfo:i] = 0;
Logged[playerid] = 0;
}
return 1;
}
Assuming you're using Whirlpool. So try this
PHP код:
forward OnAccountLoad(playerid, const password[]);
public OnAccountLoad(playerid, const password[])
{
new ppassword[500], hashedpass[500], registerdate;
WP_Hash(hashedpass, sizeof(hashedpass), mysql);
cache_get_field_content(0, "Password", ppassword, mysql);
cache_get_field_content(0, "RegisterDate", registerdate, mysql);
if(!strcmp(hashedpass, ppassword))
{
if(Logged[playerid] != 1)
{
pData[playerid][Admin] = cache_get_field_content_int(0, "Admin");
pData[playerid][VIP] = cache_get_field_content_int(0, "VIP");
GivePlayerCash(playerid, cache_get_field_content_int(0, "Money"));
SetPlayerScore(playerid, cache_get_field_content_int(0, "Score"));
pData[playerid][Deaths] = cache_get_field_content_int(0, "Deaths");
pData[playerid][MissionsPlayed] = cache_get_field_content_int(0, "MissionsPlayed");
pData[playerid][VipTime] = cache_get_field_content_int(0, "VipTime");
pData[playerid][Warns] = cache_get_field_content_int(0, "Warns");
pData[playerid][Cookies] = cache_get_field_content_int(0, "Cookies");
pData[playerid][Jailed] = cache_get_field_content_int(0, "Jailed");
pData[playerid][Muted] = cache_get_field_content_int(0, "Muted");
pData[playerid][Duty] = cache_get_field_content_int(0, "Duty");
pData[playerid][Nopm] = cache_get_field_content_int(0, "Nopm");
pData[playerid][RegisterDate] = registerdate;
CheckVipTime(playerid);
Logged[playerid] = 1;
SendClientMessage(playerid,red,"------------------------------------------------------");
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
new string[128];
format(string,sizeof(string),"* System: Welcome back {F70505}%s (%d) {FFFFFF} - Your stats have been restored.",playername3,playerid);
SCM(playerid,-1,string);
SendClientMessage(playerid,red,"------------------------------------------------------");
}
}
else ShowPlayerDialog(playerid, dLOGIN, DIALOG_STYLE_INPUT, "Login", "In order to play, you need to login", "Login", "Quit");
return 1;
}
PHP код:
forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows)
{
ShowPlayerDialog(playerid, dLOGIN, DIALOG_STYLE_INPUT, "Login", "In order to play, you need to login", "Login", "Quit");
}
else
{
ShowPlayerDialog(playerid, dREGISTER, DIALOG_STYLE_INPUT, "Register", "In order to play, you need to register.", "Register", "Quit");
}
return 1;
}