14.01.2013, 14:03
every time i use mysql_fetch_field_row i get crash on my server why ? help me
stock MySql_Login(playerid)
{
new pname[24], savingstring[20];
new MySql_QueryLogin[500];
GetPlayerName(playerid, pname, 24);
format(MySql_QueryLogin, sizeof(MySql_QueryLogin), "SELECT * FROM `playerdata` WHERE `name` = '%s'", PlayerName(playerid));
mysql_query(MySql_QueryLogin);
mysql_store_result();
while(mysql_fetch_row_format(MySql_QueryLogin,"|"))
{
mysql_fetch_field_row(savingstring,"score"); SetPlayerScore(playerid,strval(savingstring));
mysql_fetch_field_row(savingstring,"money"); GivePlayerMoney(playerid,strval(savingstring));
SystemMsg(playerid,"You are now logged in. Your stats will be auto-saved when you disconnect");
PLAYERLIST_authed[playerid]=true;
}
mysql_free_result();
return 1;
}
[19:23:42] CMySQLHandler::Query(SELECT * FROM `playerdata` WHERE `name`='VoxPF' AND `password`='reallly') - Successfully executed.
[19:23:42] >> mysql_store_result( Connection handle: 1 )
[19:23:42] CMySQLHandler::StoreResult() - Result was stored.
[19:23:42] >> mysql_num_rows( Connection handle: 1 )
[19:23:42] CMySQLHandler::NumRows() - Returned 1 row(s)
[19:23:42] >> mysql_query( Connection handle: 1 )
[19:23:42] CMySQLHandler::Query(SELECT * FROM `playerdata` WHERE `name` = 'VoxPF') - Successfully executed.
[19:23:42] >> mysql_store_result( Connection handle: 1 )
[19:23:42] CMySQLHandler::StoreResult() - Result was stored.
[19:23:42] >> mysql_fetch_row_format( Connection handle: 1 )
[19:23:42] CMySQLHandler::FetchRow() - Return: VoxPF|amir11211|77126|0|7500|10000|0|0|0|0|0|0|0|0|0|0|0|0|0|6|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
[19:23:42] >> mysql_fetch_field_row( Connection handle: 1 )
login mysql
pawn Код:
last part of debug problem area pawn Код:
|
//// mysql login
stock MySql_Login(playerid)
{
new pname[24], savingstring[20];
new MySql_QueryLogin[500];
GetPlayerName(playerid, pname, 24);
format(MySql_QueryLogin, sizeof(MySql_QueryLogin), "SELECT * FROM `playerdata` WHERE `name` = '%s'", PlayerName(playerid));
mysql_query(MySql_QueryLogin);
mysql_store_result();
while(mysql_fetch_field(MySql_QueryLogin))
{
sscanf(savingstring,"p<|>ddddddddddddddddddddddddddddddddddddddddddddddd",
SafeGivePlayerMoney(playerid,GetPlayerMoney(playerid)),
SetPlayerScore(playerid,GetPlayerScore(playerid)),
robberrank[playerid],
Jailed[playerid],
JailTime[playerid],
raperrank[playerid],
arrestranks[playerid],
swatranks[playerid],
copranks[playerid],
pvtlaw[playerid],
armyranks[playerid],
tazerank[playerid],
hitmanranks[playerid],
takesdownranks[playerid],
weapondealer[playerid],
itemsdealer[playerid],
medic[playerid],
mechanic[playerid],
CanUseArmy[playerid],
CanUseSwat[playerid],
SwatCommander[playerid],
ArmyCommander[playerid],
PlayerAdminLevel[playerid],
AccountLocked[playerid],
HasWallet[playerid],
HasCrock[playerid],
HasDrugBag[playerid],
PlayerDrugs[playerid],
BankCash[playerid],
AirPortOwner[playerid],
BoatOwner[playerid],
SFBoatOwner[playerid],
DrugHouseOwner[playerid],
grottiowner[playerid],
autobahnowner[playerid],
uttoautoowner[playerid],
couttowner[playerid],
wangsowner[playerid],
BankRobInsurance[playerid],
Warnings[playerid],
IRCWarnings[playerid],
RegAsAdmin[playerid],
KickWarn[playerid],
HaveBlunts[playerid],
PlayerInjections[playerid],
HaveWine[playerid],
LockingPick[playerid]);
PLAYERLIST_authed[playerid]=true;
}
mysql_free_result();
return 1;
}