Mysql Problem -
IndependentGaming - 01.12.2014
Hello, when i compile the server im getting 0 Warnings and Errors, but when i start the server and someone want to join it the server just go off and shows this in the logs:
Код:
#0 native mysql_real_escape_string () [10006af0] from mysql.dll
i tryed some mysql plugins but or it wont let me compile the gamemode or i get the same problem that the server is crashing.
Re: Mysql Problem -
Raweresh - 01.12.2014
The server probably crashed while executing
mysql_real_escape_string. Show callbacks where you use it.
Re: Mysql Problem -
AnthonyTimmers - 01.12.2014
Where are you using mysql_real_escape_string?
Re: Mysql Problem -
IndependentGaming - 01.12.2014
the Saveaccount ? and loadaccount ?
Re: Mysql Problem -
Raweresh - 01.12.2014
Yes, show it.
Re: Mysql Problem -
IndependentGaming - 01.12.2014
Код:
stock SaveAccount(playerid) {
// The query threads continue in the callback for finished queries.
if(GetPVarInt(playerid, "TempName") != 1 && gPlayerLogged[playerid] && AdminDuty[playerid] == 0) {
new
szPlayerName[MAX_PLAYER_NAME],
szPlayerName2[MAX_PLAYER_NAME],
szAdminName[MAX_PLAYER_NAME],
szQuery[2048];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
mysql_real_escape_string(szPlayerName, szPlayerName2, g_MySQLConnections[0]);
mysql_real_escape_string(PlayerInfo[playerid][pAdminName], szAdminName, g_MySQLConnections[0]);
format(szQuery, sizeof(szQuery), "UPDATE players SET Username = '%s', Password = '%s', Level = %d, AdminLevel = %d, AdminName = '%s', BanAppealer = %d, Donator = %d, Banned = %d, Permabanned = %d, Disabled = %d, LastIP = '%s', Registered = %d, \
Tutorial = %d, Sex = %d, Age = %d, Skin = %d, PosX = '%f', PosY = '%f', PosZ = '%f', PosR = '%f', ConnectTime = %d, Respect = %d, PhoneNumber = %d, Warnings = %d, Gang = %d, Faction = %d, Leader = %d, Rank = %d WHERE ID = %d",
szPlayerName, PlayerInfo[playerid][pKey], PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pAdmin], szAdminName, PlayerInfo[playerid][pBanAppealer], PlayerInfo[playerid][pDonator], PlayerInfo[playerid][pBanned],
PlayerInfo[playerid][pPermaBanned], PlayerInfo[playerid][pDisabled], PlayerInfo[playerid][pIP], PlayerInfo[playerid][pReg], PlayerInfo[playerid][pTut], PlayerInfo[playerid][pSex], PlayerInfo[playerid][pAge], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPos_x],
PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], PlayerInfo[playerid][pPos_r], PlayerInfo[playerid][pConnectTime], PlayerInfo[playerid][pRespect], PlayerInfo[playerid][pNumber], PlayerInfo[playerid][pWarns], PlayerInfo[playerid][pGang],
PlayerInfo[playerid][pFaction], PlayerInfo[playerid][pLeader], PlayerInfo[playerid][pRank], PlayerInfo[playerid][pID]);
mysql_query(szQuery, THREAD_SAVE_ACCOUNT_CHAIN_1, playerid, g_MySQLConnections[0]);
}
return 1;
}
Re: Mysql Problem -
Raweresh - 01.12.2014
Show
LoadAccount because it's crashed when player join in, not when player exit, right?
Re: Mysql Problem -
AnthonyTimmers - 01.12.2014
What version are you using? mysql_real_escape_string doesn't get used in newer versions..
https://sampwiki.blast.hk/wiki/MySQL/R33..._escape_string
Re: Mysql Problem -
IndependentGaming - 01.12.2014
Код:
public OnPlayerConnect(playerid) {
new
szPlayerIP[16];
// Code to patch a SA-MP exploit where you can connect to a SA-MP server multiple times with a bunch of names and completely rape the logs
// We don't receive attacks like this very often, but I have produced the code so if we ever need it, we have it right in front of us. It requires testing though...
/*new
szPlayerName[MAX_PLAYER_NAME],
szPlayerIP[16],
szPlayerIPs[16],
szPlayerNames[MAX_PLAYER_NAME];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
GetPlayerIp(playerid, szPlayerIP, sizeof(szPlayerIP));
foreach(Player, x) {
GetPlayerName(x, szPlayerNames, MAX_PLAYER_NAME);
GetPlayerIp(playerid, szPlayerIPs, sizeof(szPlayerIPs));
if(strfind(szPlayerName, szPlayerNames, true) != -1 && !strcmp(szPlayerIPs, szPlayerIP, true) && IsStringAlphaNumeric(szPlayerNames) == 0)
return BanEx(playerid, "NieXrlaM client spam attack attempt");
}*/
TotalConnect++;
if(Iter_Count(Player) > MaxPlayersConnected)
{
MaxPlayersConnected = Iter_Count(Player);
getdate(MPYear,MPMonth,MPDay);
}
GetPlayerIp(playerid, szPlayerIP, sizeof(szPlayerIP));
GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 16);
if(!InvalidNameCheck(playerid)) return 1;
if(CheckBan(szPlayerIP) == 1) {
SetPlayerName(playerid, "BannedPlayer");
Kick(playerid);
return 1;
}
ResetPlayerVariables(playerid);
SetTimerEx("Login", 1000, 0, "d", playerid);
return 1;
}
Re: Mysql Problem -
IndependentGaming - 01.12.2014
I use mysql R5