16.05.2014, 18:08
pawn Код:
stock MySQL_Login(playerid)
{
new query2[300], pname[24], savingstring[20];
GetPlayerName(playerid, pname, 24);
format(query2, sizeof(query2), "SELECT score, money, level, vip, kma, rank, kills, deaths, muted, jailed, frozen, mutedtimes, jailedtimes, frozentimes, logins, posx, posy, posz, posa FROM playerdata WHERE user = '%s'", pname);
mysql_query(query2);
mysql_store_result();
while(mysql_fetch_row_format(query2,"|"))
{
mysql_fetch_field_row(savingstring, "score"); SetPlayerScore(playerid, strval(savingstring));
mysql_fetch_field_row(savingstring, "money"); MoneyGiven[playerid] = strval(savingstring);
mysql_fetch_field_row(savingstring, "level"); PlayerInfo[playerid][pLevel] = strval(savingstring);
mysql_fetch_field_row(savingstring, "vip"); PlayerInfo[playerid][pVIP] = strval(savingstring);
mysql_fetch_field_row(savingstring, "kma"); PlayerInfo[playerid][pKMA] = strval(savingstring);
mysql_fetch_field_row(savingstring, "rank"); PlayerInfo[playerid][pRank] = strval(savingstring);
mysql_fetch_field_row(savingstring, "kills"); PlayerInfo[playerid][pKills] = strval(savingstring);
mysql_fetch_field_row(savingstring, "deaths"); PlayerInfo[playerid][pDeaths] = strval(savingstring);
mysql_fetch_field_row(savingstring, "muted"); PlayerInfo[playerid][pMuted] = strval(savingstring);
mysql_fetch_field_row(savingstring, "jailed"); PlayerInfo[playerid][pJailed] = strval(savingstring);
mysql_fetch_field_row(savingstring, "frozen"); PlayerInfo[playerid][pFrozen] = strval(savingstring);
mysql_fetch_field_row(savingstring, "mutedtimes"); PlayerInfo[playerid][pMutedTimes] = strval(savingstring);
mysql_fetch_field_row(savingstring, "jailedtimes"); PlayerInfo[playerid][pJailedTimes] = strval(savingstring);
mysql_fetch_field_row(savingstring, "frozentimes"); PlayerInfo[playerid][pFrozenTimes] = strval(savingstring);
mysql_fetch_field_row(savingstring, "logins"); PlayerInfo[playerid][pLogins] = strval(savingstring);
mysql_fetch_field_row(savingstring, "posx"); PlayerInfo[playerid][pPosX] = strval(savingstring);
mysql_fetch_field_row(savingstring, "posy"); PlayerInfo[playerid][pPosY] = strval(savingstring);
mysql_fetch_field_row(savingstring, "posz"); PlayerInfo[playerid][pPosZ] = strval(savingstring);
mysql_fetch_field_row(savingstring, "posa"); PlayerInfo[playerid][pPosA] = strval(savingstring);
}
mysql_free_result();
JustLogged[playerid] = 1;
Logged[playerid] = 1;
PlayerInfo[playerid][pLogins]++;
GameTextForPlayer(playerid,"~g~You have succesfully ~n~logged in!",5000,5);
return 1;
}