13.09.2016, 12:48
Hello guys , My mysql system don't save my admin level and the onther codes
PHP код:
stock MySQL_Register(playerid, passwordstring[])
{
new query1[350], pname[24];
new Bannedby[20];
format(Bannedby, 20, "Not Banned");
GetPlayerName(playerid, pname, 24);
format(query1, sizeof(query1), "INSERT INTO playerdata (user, password, score,cookies, money, level, vip, kma, rank, kills, deaths, muted, jailed, frozen, mutedtimes, jailedtimes, frozentimes, logins, posx, posy, posz, posa, IP) VALUES('%s', SHA1('%s'), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s')", pname, passwordstring, GetIP(playerid));
mysql_query(query1);
SendClientMessage(playerid,COLOR_PINK,"You have successfully registered on the server! Enjoy!");
GameTextForPlayer(playerid,"~G~You have registered successfully!",5000,4);
Logged[playerid] = 1;
mysql_query("SELECT * FROM playerdata");
mysql_store_result();
new rows = mysql_num_rows();
mysql_free_result();
new st[128];
format(st,128,"%s has registered at XtremeX, Total registered players %d",GetName(playerid),rows);
SendClientMessageToAll(COLOR_LIGHTBLUE,st);
return 1;
}
stock MySQL_Login(playerid)
{
new query2[300], pname[24], savingstring[20];
GetPlayerName(playerid, pname, 24);
format(query2, sizeof(query2), "SELECT score,cookies, 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, "Cookies"); PlayerInfo[playerid][pCookies] = 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);
new st[128];
format(st,128,"%s has joined SA-MP: DayZ ! Welcome back, %s!",GetName(playerid),GetName(playerid));
SendClientMessageToAll(COLOR_LIGHTBLUE,st);
return 1;
}