25.08.2013, 01:40
The variable id is not set to anything so it's going to return 0 every time. If the houses actually correspond to the ids in the database, then you can do something like:
pawn Код:
stock SpawnPlayerAtHouse(playerid)
{
new pname[24],QUERY[400],id;
GetPlayerName(playerid, pname, 24);
format(QUERY, sizeof(QUERY), "SELECT id FROM House WHERE Owner = '%s' LIMIT 1",pname);
mysql_query(QUERY);
mysql_store_result();
id = mysql_fetch_int();
SetPlayerPos(playerid, HouseInfo[id][hExitX], HouseInfo[id][hExitY], HouseInfo[id][hExitZ]);
SetPlayerInterior(playerid, HouseInfo[id][hInterior]);
SetPlayerVirtualWorld(playerid, id); //You may want to change this. If the house id is 0, then it will go into the normal world.
mysql_free_result();
}