25.01.2011, 10:47
hello everyone i have a little, but very bad problem. ; / sometimes player spawns into 0,0 pos (at village) i don't know why.... i tri'd alot of variety like onplayerspawn spawning, at request spawn use some variables and no one help me : / so:
Saving positions:
Loading OnPlayerReqSpawn:
Spawn variable is setting OnPlayerSpawn into true and Loaded variable is setting to true when player enter his password correctly, and the variable 'klaikas' about jail timer and his i think have nothing to do with this stuff? i' don't know what to do... this bug really anoying me about one month, fellas help me!
Saving positions:
Код:
stock SavePlayer(playerid) { if(pInfo[playerid][Logged]) { if(loaded[playerid]) { new pName[ MAX_PLAYER_NAME ], file [ 50 ]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); new Float:pos[ 3 ]; if(Spawned[playerid]) { GetPlayerPos(playerid, pos[ 0 ],pos[ 1 ],pos[ 2 ]); format(query, 256, "UPDATE `"TABLENAME"` SET `Interior` = '%i', `pos_X` = '%f', `pos_Y` = '%f', `pos_Z` = '%f' WHERE (`id` = '%i')",\ GetPlayerInterior(playerid),pos[ 0 ],pos[ 1 ],pos[ 2 ],pInfo[playerid][pId]); mysql_query(query); } } } }
Код:
if(playerDB[playerid][klaikas] <= 0) { new fetch[ 256 ], Float:pos[ 3 ]; format(query, 256, "SELECT * FROM `"TABLENAME"` WHERE id = '%i'", pInfo[playerid][pId]); mysql_query(query); mysql_store_result(); mysql_retrieve_row(); mysql_fetch_field_row(fetch,"pos_X"); pos[0] = floatstr(fetch); mysql_fetch_field_row(fetch,"pos_Y"); pos[1] = floatstr(fetch); mysql_fetch_field_row(fetch,"pos_Z"); pos[2] = floatstr(fetch); mysql_fetch_field_row(fetch,"Interior"); SetPlayerInterior(playerid, strval(fetch)); SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), pos[ 0 ], pos[ 1 ], pos[ 2 ], 0, 0, 0, 0, 0, 0, 0); // Spawn vieta. mysql_free_result(); }