Last Position BUG [MYSQL]
#1

Hello to everyone..

I want to make Last Position Spawn..The Float Pos is savings GOOD in database.. pPosX , pPosY, pPosZ..Coordinates save fine..But when player login, he will spawn in Palomino Creek in water..I don't know why..

SAVE STATS CODE OnPlayerDisconnect..

Код:
public SavePlayerStats(playerid)
{
	new vehicles[64], contacts[256], drugs[256], tickets[256];
	if(playerid != INVALID_PLAYER_ID && PlayerIsOn(playerid) && PlayerLogged(playerid))
	{
		SavePlayerPos(playerid);
		format(query, sizeof(query), "UPDATE `users` SET `registered` = %d, `cash` = %d, `bank` = %d, `skin` = %d, `sex` = %d, `age` = %d, `origin` = '%s', `level` = %d, `exp` = %d, `hours` = %d, `admin` = %d, `helper` = %d, `int` = %d, `world` = %d WHERE `name` = '%s'",
		PlayerInfo[playerid][pRegistered],
		PlayerInfo[playerid][pCash],
		PlayerInfo[playerid][pBank],
		PlayerInfo[playerid][pSkin],
		PlayerInfo[playerid][pSex],
		PlayerInfo[playerid][pAge],
		PlayerInfo[playerid][pOrigin],
		PlayerInfo[playerid][pLevel],
		PlayerInfo[playerid][pExp],
		PlayerInfo[playerid][pHours],
		PlayerInfo[playerid][pAdmin],
		PlayerInfo[playerid][pHelper],
		PlayerInfo[playerid][pInt],
		PlayerInfo[playerid][pWorld],
		GetName(playerid));
		mysql_function_query(dbHandle, query, false, "", "");
		//=========================================================================================================
		format(query, sizeof(query), "UPDATE `users` SET `jailed` = %d, `jailtime` = %d, `banned` = %d, `warns` = %d, `donate` = %d, `carlic` = %d, `weplic` = %d, `flylic` = %d, `posx` = %f, `posy` = %f, `posz` = %f, `posa` = %f WHERE `name` = '%s'",
		PlayerInfo[playerid][pJailed],
		PlayerInfo[playerid][pJailTime],
		PlayerInfo[playerid][pBanned],
		PlayerInfo[playerid][pWarns],
		PlayerInfo[playerid][pDonateRank],
		PlayerInfo[playerid][pCarLic],
		PlayerInfo[playerid][pWepLic],
		PlayerInfo[playerid][pFlyLic],
		PlayerInfo[playerid][pPosX],
		PlayerInfo[playerid][pPosY],
		PlayerInfo[playerid][pPosZ],
		PlayerInfo[playerid][pPosA],
		GetName(playerid));
		mysql_function_query(dbHandle, query, false, "", "");
		//=============================================================
You will see there : PlayerInfo[playerid][pPosY],
PlayerInfo[playerid][pPosZ],
PlayerInfo[playerid][pPosA],

This is Player Last Position..

And When player Login code :
Код:
PutPlayer(playerid, PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
SetInterior(playerid,0);
SetWorld(playerid, 0);
But don't work..Player will spawn in Palomino Crekk (in water ) or Montgomery..I don't have any coordinates for that towns...
If i enter in database and copy pPosX,Y,Z coordinates and i use /gotopos COORDINATES i will go to player good coordinates..but when he spawn don't work..
Reply
#2

Where do you get the players information?

You should have a SELECT query somewhere in your script, like under a function called LoadPlayerData or something.
PHP код:
"SELECT * FROM `users` <rest of code>" 
Reply
#3

Код:
public OnAccountLoad(playerid)
{
	    new tickets[256], drugs[256];
	    cache_get_field_content(0, "id", query);
		PlayerInfo[playerid][pDatabaseID] = strval(query);
		cache_get_field_content(0, "registered", query);
		PlayerInfo[playerid][pRegistered] = strval(query);
		cache_get_field_content(0, "cash", query);
		PlayerInfo[playerid][pCash] = strval(query);
		cache_get_field_content(0, "bank", query);
		PlayerInfo[playerid][pBank] = strval(query);
		cache_get_field_content(0, "skin", query);
		PlayerInfo[playerid][pSkin] = strval(query);
		cache_get_field_content(0, "sex", query);
		PlayerInfo[playerid][pSex] = strval(query);
		cache_get_field_content(0, "age", query);
		PlayerInfo[playerid][pAge] = strval(query);
		cache_get_field_content(0, "origin", query);
		format(PlayerInfo[playerid][pOrigin], 256, query);
		cache_get_field_content(0, "level", query);
		PlayerInfo[playerid][pLevel] = strval(query);
		cache_get_field_content(0, "exp", query);
		PlayerInfo[playerid][pExp] = strval(query);
		cache_get_field_content(0, "hours", query);
		PlayerInfo[playerid][pHours] = strval(query);
		cache_get_field_content(0, "admin", query);
		PlayerInfo[playerid][pAdmin] = strval(query);
		cache_get_field_content(0, "helper", query);
		PlayerInfo[playerid][pHelper] = strval(query);
		cache_get_field_content(0, "int", query);
		PlayerInfo[playerid][pInt] = strval(query);
		cache_get_field_content(0, "world", query);
		PlayerInfo[playerid][pWorld] = strval(query);
		cache_get_field_content(0, "jailed", query);
		PlayerInfo[playerid][pJailed] = strval(query);
		cache_get_field_content(0, "jailtime", query);
		PlayerInfo[playerid][pJailTime] = strval(query);
		cache_get_field_content(0, "banned", query);
		PlayerInfo[playerid][pBanned] = strval(query);
		cache_get_field_content(0, "warns", query);
		PlayerInfo[playerid][pWarns] = strval(query);
        cache_get_field_content(0, "donate", query);
		PlayerInfo[playerid][pDonateRank] = strval(query);
		cache_get_field_content(0, "carlic", query);
		PlayerInfo[playerid][pCarLic] = strval(query);
		cache_get_field_content(0, "weplic", query);
		PlayerInfo[playerid][pWepLic] = strval(query);
		cache_get_field_content(0, "flylic", query);
		PlayerInfo[playerid][pFlyLic] = strval(query);
		cache_get_field_content(0, "posx", query);
		PlayerInfo[playerid][pPosX] = floatstr(query);
		cache_get_field_content(0, "poxy", query);
		PlayerInfo[playerid][pPosY] = floatstr(query);
		cache_get_field_content(0, "posz", query);
		PlayerInfo[playerid][pPosZ] = floatstr(query);
		cache_get_field_content(0, "posa", query);
		PlayerInfo[playerid][pPosA] = floatstr(query);
		cache_get_field_content(0, "died", query);
		PlayerInfo[playerid][pDied] = strval(query);
		cache_get_field_content(0, "pen", query);
		PlayerInfo[playerid][pPen] = strval(query);
		cache_get_field_content(0, "note1", query);
		PlayerInfo[playerid][pNote1] = strval(query);
		cache_get_field_content(0, "note1s", query);
		PlayerInfo[playerid][pNote1s] = strval(query);
		cache_get_field_content(0, "note2", query);
		PlayerInfo[playerid][pNote2] = strval(query);
		cache_get_field_content(0, "note2s", query);
		PlayerInfo[playerid][pNote2s] = strval(query);
		cache_get_field_content(0, "note3", query);
		PlayerInfo[playerid][pNote3] = strval(query);
		cache_get_field_content(0, "note3s", query);
		PlayerInfo[playerid][pNote3s] = strval(query);
		cache_get_field_content(0, "attributes", query);
		PlayerInfo[playerid][pAttributes] = strval(query);
		cache_get_field_content(0, "paycheck", query);
		PlayerInfo[playerid][pPayCheckMade] = strval(query);
		cache_get_field_content(0, "paycheckmoney", query);
		PlayerInfo[playerid][pPayCheckMoney] = strval(query);
		cache_get_field_content(0, "upgrade", query);
		PlayerInfo[playerid][pUpgrade] = strval(query);
		cache_get_field_content(0, "paydaytime", query);
		PlayerInfo[playerid][pPayDayTime] = strval(query);
		cache_get_field_content(0, "spawnhealth", query);
		PlayerInfo[playerid][pSHealth] = floatstr(query);
		cache_get_field_content(0, "cellphone", query);
		PlayerInfo[playerid][pCellPhone] = strval(query);
		cache_get_field_content(0, "number", query);
		PlayerInfo[playerid][pNumber] = strval(query);
		cache_get_field_content(0, "savings", query);
		PlayerInfo[playerid][pSavings] = strval(query);
		cache_get_field_content(0, "housekey", query);
		PlayerInfo[playerid][pHouseKey] = strval(query);
		cache_get_field_content(0, "melee", query);
		PlayerInfo[playerid][pMeleeWep] = strval(query);
		cache_get_field_content(0, "wep1", query);
		PlayerInfo[playerid][pPerm1] = strval(query);
		cache_get_field_content(0, "wep2", query);
		PlayerInfo[playerid][pPerm2] = strval(query);
		cache_get_field_content(0, "ammo1", query);
		PlayerInfo[playerid][pAmmo1] = strval(query);
		cache_get_field_content(0, "ammo2", query);
		PlayerInfo[playerid][pAmmo2] = strval(query);
		cache_get_field_content(0, "radio", query);
		PlayerInfo[playerid][pRadio] = strval(query);
		cache_get_field_content(0, "channel", query);
		PlayerInfo[playerid][pChannel] = strval(query);
		cache_get_field_content(0, "ownedchannel", query);
		PlayerInfo[playerid][pOwnedChannel] = strval(query);
		cache_get_field_content(0, "authed", query);
		PlayerInfo[playerid][pAuthed] = strval(query);
		cache_get_field_content(0, "crashed", query);
		PlayerInfo[playerid][pCrashed] = strval(query);
		cache_get_field_content(0, "mask", query);
		PlayerInfo[playerid][pMask] = strval(query);
		cache_get_field_content(0, "bmx", query);
		PlayerInfo[playerid][pBMX] = strval(query);
		cache_get_field_content(0, "carkey", query);
		PlayerInfo[playerid][pCarKey] = strval(query);
		cache_get_field_content(0, "veh1", query);
		PlayerVehicle[playerid][pVeh1] = strval(query);
		cache_get_field_content(0, "veh2", query);
		PlayerVehicle[playerid][pVeh2] = strval(query);
		cache_get_field_content(0, "veh3", query);
		PlayerVehicle[playerid][pVeh3] = strval(query);
		cache_get_field_content(0, "vehicles", query);
		PlayerInfo[playerid][pVehicles] = strval(query);
		cache_get_field_content(0, "vehslot", query);
		PlayerInfo[playerid][pVehSlot] = strval(query);
		cache_get_field_content(0, "sparekey", query);
		PlayerInfo[playerid][pSpareKey] = strval(query);
		cache_get_field_content(0, "lighter", query);
		PlayerInfo[playerid][pLighter] = strval(query);
		cache_get_field_content(0, "cigars", query);
		PlayerInfo[playerid][pCigars] = strval(query);
		cache_get_field_content(0, "bizkey", query);
		PlayerInfo[playerid][pBizKey] = strval(query);
		cache_get_field_content(0, "workon", query);
		PlayerInfo[playerid][pWorkOn] = strval(query);
		cache_get_field_content(0, "walk", query);
		PlayerInfo[playerid][pWalk] = strval(query);
		cache_get_field_content(0, "armour", query);
		PlayerInfo[playerid][pArmour] = floatstr(query);
		cache_get_field_content(0, "hasarmour", query);
		PlayerInfo[playerid][pHasArmour] = strval(query);
		cache_get_field_content(0, "faction", query);
		PlayerInfo[playerid][pFaction] = strval(query);
		cache_get_field_content(0, "rank", query);
		PlayerInfo[playerid][pRank] = strval(query);
		cache_get_field_content(0, "badgenumber", query);
		PlayerInfo[playerid][pBadgeNumber] = strval(query);
		cache_get_field_content(0, "drivewarns", query);
		PlayerInfo[playerid][pDriveWarns] = strval(query);
		cache_get_field_content(0, "jailtime2", query);
		PlayerInfo[playerid][pJailTime2] = strval(query);
		cache_get_field_content(0, "arrested", query);
		PlayerInfo[playerid][pArrested] = strval(query);
		cache_get_field_content(0, "chat", query);
		PlayerInfo[playerid][pTalk] = strval(query);
		cache_get_field_content(0, "swat", query);
		PlayerInfo[playerid][pSwat] = strval(query);
		cache_get_field_content(0, "slot", query);
		PlayerInfo[playerid][pSlot] = strval(query);
		cache_get_field_content(0, "tickets", query);
		AssignPlayerTickets(playerid, tickets);
		cache_get_field_content(0, "job", query);
		PlayerInfo[playerid][pJob] = strval(query);
		cache_get_field_content(0, "jobrank", query);
		PlayerInfo[playerid][pJobRank] = strval(query);
		cache_get_field_content(0, "career", query);
		PlayerInfo[playerid][pCareer] = strval(query);
		cache_get_field_content(0, "engcareer", query);
		PlayerInfo[playerid][pEngCareer] = strval(query);
		cache_get_field_content(0, "spawntype", query);
		PlayerInfo[playerid][pSpawnType] = strval(query);
		cache_get_field_content(0, "prisoned", query);
		PlayerInfo[playerid][pPrisoned] = strval(query);
		cache_get_field_content(0, "drugs", query);
		AssignPlayerDrugs(playerid, drugs);
		cache_get_field_content(0, "seeds", query);
		PlayerInfo[playerid][pSeeds] = strval(query);
		cache_get_field_content(0, "spawnedcar", query);
		PlayerInfo[playerid][pSpawnedCar] = strval(query);
		cache_get_field_content(0, "garagelic", query);
		PlayerInfo[playerid][pGarageLic] = strval(query);
		cache_get_field_content(0, "materiale", query);
		PlayerInfo[playerid][pMateriale] = strval(query);
		cache_get_field_content(0, "demerol", query);
		PlayerInfo[playerid][pDemerol] = strval(query);
		cache_get_field_content(0, "morphine", query);
		PlayerInfo[playerid][pMorphine] = strval(query);
		cache_get_field_content(0, "haloperidol", query);
		PlayerInfo[playerid][pHaloperidol] = strval(query);
		cache_get_field_content(0, "aspirin", query);
		PlayerInfo[playerid][pAspirin] = strval(query);
		cache_get_field_content(0, "steroid", query);
		PlayerInfo[playerid][pSteroid] = strval(query);
		cache_get_field_content(0, "heroin", query);
		PlayerInfo[playerid][pHeroin] = strval(query);
		cache_get_field_content(0, "lsd", query);
		PlayerInfo[playerid][pLsd] = strval(query);
		cache_get_field_content(0, "ecstasy", query);
		PlayerInfo[playerid][pEcstasy] = strval(query);
		cache_get_field_content(0, "cocaine", query);
		PlayerInfo[playerid][pCocaine] = strval(query);
		cache_get_field_content(0, "marijuana", query);
		PlayerInfo[playerid][pMarijuana] = strval(query);
		cache_get_field_content(0, "crack", query);
		PlayerInfo[playerid][pCrack] = strval(query);
		cache_get_field_content(0, "pcp", query);
		PlayerInfo[playerid][pPcp] = strval(query);
		cache_get_field_content(0, "ingrediente", query);
		PlayerInfo[playerid][pIngrediente] = strval(query);
		cache_get_field_content(0, "mandat", query);
		PlayerInfo[playerid][pMandat] = strval(query);
		cache_get_field_content(0, "motivmandat", query);
		PlayerInfo[playerid][pMotivMandat] = strval(query);
		cache_get_field_content(0, "fishinglic", query);
		PlayerInfo[playerid][pFishingLic] = strval(query);
    	return 1;
}
cache_get_field_content(0, "posx", query);
PlayerInfo[playerid][pPosX] = floatstr(query);
cache_get_field_content(0, "poxy", query);
PlayerInfo[playerid][pPosY] = floatstr(query);
cache_get_field_content(0, "posz", query);
PlayerInfo[playerid][pPosZ] = floatstr(query);
cache_get_field_content(0, "posa", query);
PlayerInfo[playerid][pPosA] = floatstr(query);
Reply
#4

Post the code for the SELECT query as well please.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)