26.01.2015, 07:32
(
Последний раз редактировалось Gangster-rocks; 26.01.2015 в 08:16.
Причина: cus my brain finally functioned.
)
Alright. So the issue acquires when I log in, when I log in the server crashes. Like, instantly. I tried creating the loading function in a stock instead of the login dialog, still same shit.
I need help, asap.
I need help, asap.
pawn Код:
stock LoadAcc(playerid,password[])
{
new Query[250],DBResult:Result;
format(Query,sizeof(Query),"SELECT * FROM `users` WHERE `name` = '%s' COLLATE NOCASE AND `password` = '%s'",DB_Escape(GPN(playerid)),DB_Escape(password));
Result = db_query(server,Query);
if(db_num_rows(Result))
{
new Field[60];
db_get_field_assoc(Result,"MONEY",Field,60);
pInfo[Money][playerid] = strval(Field);
GivePlayerMoney(playerid,pInfo[Money][playerid]);
db_get_field_assoc(Result,"ADMINLEVEL",Field,60);
pInfo[AdminLevel][playerid] = strval(Field);
db_get_field_assoc(Result,"SCORE",Field,60);
SetPlayerScore(playerid,strval(Field));
db_get_field_assoc(Result,"X",Field,60);
Pos[playerid][pX] = floatstr(Field);
db_get_field_assoc(Result,"Y",Field,60);
Pos[playerid][pY] = floatstr(Field);
db_get_field_assoc(Result,"Z",Field,60);
Pos[playerid][pZ] = floatstr(Field);
db_get_field_assoc(Result,"SEX",Field,60);
pInfo[Sex][playerid] = strval(Field);
db_get_field_assoc(Result,"SKIN",Field,60);
pInfo[Skin][playerid] = strval(Field);
SetPlayerSkin(playerid,pInfo[Skin][playerid]);
db_get_field_assoc(Result,"Type",Field,60);
gTeam[playerid] = strval(Field);
db_get_field_assoc(Result,"AGE",Field,60);
pInfo[Age][playerid] = strval(Field);
db_get_field_assoc(Result,"Primary",Field,60);
pInfo[Primary][playerid] = strval(Field);
db_get_field_assoc(Result,"pAmmo",Field,60);
pInfo[pAmmo][playerid] = strval(Field);
GiveWeapon(playerid,pInfo[Primary][playerid],pInfo[pAmmo][playerid]);
db_get_field_assoc(Result,"Secondary",Field,60);
pInfo[Secondary][playerid] = strval(Field);
db_get_field_assoc(Result,"sAmmo",Field,60);
pInfo[sAmmo][playerid] = strval(Field);
GiveWeapon(playerid,pInfo[Secondary][playerid],pInfo[sAmmo][playerid]);
printf("PLAYER %s SEX %i SKIN %i PRIMARY %i",GPN(playerid),pInfo[Skin][playerid],pInfo[Primary][playerid]);
CheckBan(playerid);
if(pInfo[Sex][playerid] == 0)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX,"What's your character's sex?","Please choose your character's sex below","Female","Male");
}
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Login","Please type your password to proceed accessing your account!","Login","Quit");
SendClientMessage(playerid,COLOR_RED,"ERROR: Wrong password!");
}
db_free_result(Result);
return 1;
}