13.04.2012, 19:05
Hi guys i have got a problem, mysql isnt loading the positions as it should soo im sent to pos 0.
Register Part
Loading Part
Everything else works fine, any ideas?
pawn Код:
// Part of code
enum Penum
{
Float:posx,
Float:posy,
Float:posz,
Float:angle
}
new Pinfo[MAX_PLAYERS][Penum]
pawn Код:
new Query[256],pName[MAX_PLAYER_NAME],EscapedText[60], Float:x, Float:y, Float:z, Float:PAngle;
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, PAngle);
mysql_real_escape_string(inputtext, EscapedText);
format(Query,sizeof(Query),"INSERT PlayerInfo (Name, Password, Level, VIP, AdminLevel, FactionID, Money, RankID, Leader, Njailed, Ajailed, Sexo, Idade, x, y, z, Skin, Angle) VALUES ('%s', '%s', 0, 0, 0, 0, 5000, 0, 0, 0, 0, 0, 0, 0.00, 0.00, 0.00, 26, 0.00)", pName, EscapedText, x, y, z, PAngle);
mysql_query(Query);
pawn Код:
new Query[128],pName[24];
GetPlayerName(playerid,pName, sizeof(pName));
format(Query, sizeof(Query),"SELECT * FROM `PlayerInfo` WHERE `Name` = '%s'", pName);
mysql_query(Query);
mysql_store_result();
new datastr[256];
while(mysql_fetch_row_format(Query, "|"))
{
mysql_fetch_field_row(datastr, "Money"); GivePlayerMoney(playerid, strval(datastr));
mysql_fetch_field_row(datastr, "Level"); SetPlayerScore(playerid, strval(datastr));
mysql_fetch_field_row(datastr, "VIP"); pInfo[playerid][VIP] = strval(datastr);
mysql_fetch_field_row(datastr, "AdminLevel"); pInfo[playerid][AdminLevel] = strval(datastr);
mysql_fetch_field_row(datastr, "FactionID"); pInfo[playerid][FactionID] = strval(datastr);
mysql_fetch_field_row(datastr, "RankID"); pInfo[playerid][RankID] = strval(datastr);
mysql_fetch_field_row(datastr, "Leader"); pInfo[playerid][Leader] = strval(datastr);
mysql_fetch_field_row(datastr, "Njailed"); pInfo[playerid][Njailed] = strval(datastr);
mysql_fetch_field_row(datastr, "Ajailed"); pInfo[playerid][Ajailed] = strval(datastr);
mysql_fetch_field_row(datastr, "Sexo"); pInfo[playerid][Sexo] = strval(datastr);
mysql_fetch_field_row(datastr, "Idade"); pInfo[playerid][Idade] = strval(datastr);
mysql_fetch_field_row(datastr, "Skin"); pInfo[playerid][skin] = strval(datastr);
mysql_fetch_field_row(datastr, "x"); pInfo[playerid][posx] = strval(datastr);
mysql_fetch_field_row(datastr, "y"); pInfo[playerid][posy] = strval(datastr);
mysql_fetch_field_row(datastr, "z"); pInfo[playerid][posz] = strval(datastr);
mysql_fetch_field_row(datastr, "Angle"); pInfo[playerid][angle] = strval(datastr);
}
mysql_free_result();
TogglePlayerSpectating(playerid, 0);
SetSpawnInfo(playerid, 0, pInfo[playerid][skin], pInfo[playerid][posx], pInfo[playerid][posy], pInfo[playerid][posz], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
return 1;