Рекомендованные сообщения



4 posts in this topic

Здравствуйте участники PR.RU!

 

У меня проблемы с сохранением координат в базу данных при выходе игрока с сервера.

 

Спойлер

stock acc_int_strcat(query[], len, name[], number) // Для Save
{
	new string[128];
    f("`%s` = '%d',",name, number);
    strcat(query, string, len);
    return true;
}
stock acc_str_strcat(query[], len, name[], str[])  // Для Save
{
	new string[128];
    f("`%s` = '%s',",name, str);
    strcat(query, string, len);
    return true;
}
stock acc_float_strcat(query[], len, name[], Float:number)  // Для Save
{
	new string[128];
    f("`%s` = '%f',", name, number);
    strcat(query, string, len);
    return true;
}

stock SaveAccount(p)
{
	new query[3000];
	if(PlayerLogin[p] == false) return false;
	GetPlayerPos(p, PI[p][pPosX], PI[p][pPosY], PI[p][pPosZ]);
	GetPlayerFacingAngle(p, PI[p][pPosA]);
	new Interior = GetPlayerInterior(p);
	new World = GetPlayerVirtualWorld(p);
	query = "UPDATE `accounts` SET";
	acc_str_strcat(query, sizeof(query), "Name", GetName(p));
	acc_str_strcat(query, sizeof(query), "Email", PI[p][pEmail]);
	acc_str_strcat(query, sizeof(query), "Referal", PI[p][pReferal]);
	acc_int_strcat(query, sizeof(query), "Age", PI[p][pAge]);
	acc_int_strcat(query, sizeof(query), "Sex", PI[p][pSex]);
	acc_int_strcat(query, sizeof(query), "Skin", PI[p][pSkin]);
	acc_int_strcat(query, sizeof(query), "Spawn", PI[p][pSpawn]);
	acc_int_strcat(query, sizeof(query), "Exp", PI[p][pExp]);
	acc_int_strcat(query, sizeof(query), "Level", PI[p][pLevel]);
	acc_float_strcat(query, sizeof(query), "Health", PI[p][pHealth]);
	acc_float_strcat(query, sizeof(query), "Armour", PI[p][pArmour]);
	acc_int_strcat(query, sizeof(query), "Admin", PI[p][pAdmin]);
	acc_int_strcat(query, sizeof(query), "Money", PI[p][pMoney]);
	acc_int_strcat(query, sizeof(query), "Bank", PI[p][pBank]);
	acc_int_strcat(query, sizeof(query), "PayMoney", PI[p][pPayMoney]);
	acc_int_strcat(query, sizeof(query), "Rub", PI[p][pRub]);
	acc_int_strcat(query, sizeof(query), "Job", PI[p][pJob]);
	acc_int_strcat(query, sizeof(query), "Voennic", PI[p][pVoennic]);
	acc_int_strcat(query, sizeof(query), "TempLeader", PI[p][pTempLeader]);
	acc_int_strcat(query, sizeof(query), "FracLeader", PI[p][pFracLeader]);
	acc_int_strcat(query, sizeof(query), "Frac", PI[p][pFrac]);
	acc_int_strcat(query, sizeof(query), "FracRang", PI[p][pFracRang]);
	acc_int_strcat(query, sizeof(query), "FracSkin", PI[p][pFracSkin]);
	acc_int_strcat(query, sizeof(query), "FracWarn", PI[p][pFracWarn]);
	acc_int_strcat(query, sizeof(query), "Zakon", PI[p][pZakon]);
	acc_int_strcat(query, sizeof(query), "Wanted", PI[p][pWanted]);
	acc_int_strcat(query, sizeof(query), "Mute", PI[p][pMute]);
	acc_str_strcat(query, sizeof(query), "MuteTime", PI[p][pMuteTime]);
	acc_int_strcat(query, sizeof(query), "Jail", PI[p][pJail]);
	acc_str_strcat(query, sizeof(query), "JailTime", PI[p][pJailTime]);
	acc_int_strcat(query, sizeof(query), "Warn", PI[p][pWarn]);
	acc_int_strcat(query, sizeof(query), "WarnTime", PI[p][pWarnTime]);
	acc_int_strcat(query, sizeof(query), "Ban", PI[p][pBan]);
    // Вот эти строки ниже сораняют координаты игрока  при выходе!
	acc_float_strcat(query, sizeof(query), "PosX", PI[p][pPosX]);
	acc_float_strcat(query, sizeof(query), "PosY", PI[p][pPosY]);
	acc_float_strcat(query, sizeof(query), "PosZ", PI[p][pPosZ]);
	acc_float_strcat(query, sizeof(query), "PosA", PI[p][pPosA]);
    
	acc_int_strcat(query, sizeof(query), "Interior", Interior);
	acc_int_strcat(query, sizeof(query), "World", World);
	acc_str_strcat(query, sizeof(query), "Time", PI[p][pTime]);
	acc_int_strcat(query, sizeof(query), "Settings", PI[p][pSettings]);
	return true;
}

 

 

Share this post


Link to post
Share on other sites

@Andrey_Akkerman, неверные координаты сохраняются?

Share this post


Link to post
Share on other sites

Уважаемая администрация закройте тему данная проблема была решена

 

Share this post


Link to post
Share on other sites

@Andrey_Akkerman Если проблема решена, то опишите как вы её решили, и сами закройте тему правильным ответом, т.е выберите свой ответ 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • .037
      By .037
      в чём может быть проблема? Передаю строку через PR_String, и получаю с клиента бред
      CMD:TestData(playerid, params[]){ new msg[] = "Code_Test"; new BitStream:bs = BS_New(); BS_WriteInt8(bs,30); BS_WriteFloat(bs,0.9); BS_WriteFloat(bs,23.4); BS_WriteString(bs, msg, sizeof msg); PR_SendRPC(bs, playerid, 179); BS_Delete(bs); return 1; } [05:57:27] RPC - Длина  30 | 0.900000 | 23.400000 | I*(!@dp
      И всегда текст разный 

      Хотя принимаю всё нормально:

       
      bool CALLBACK Hok_RPC_BYTE(stRakNetHookParams *params) { if (params->packetId == 179) { SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(0, 0xAA, 0), "Кастомный RPC работает!!!"); byte nameLen; float test; float test1; char szPlayerName[100]; params->bitStream->ResetReadPointer(); params->bitStream->Read(nameLen); params->bitStream->Read(test); params->bitStream->Read(test1); params->bitStream->Read(szPlayerName, 100); params->bitStream->ResetReadPointer(); SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(0, 0xAA, 0), "RPC - Длина %d | %f | %f | %s", nameLen, test , test1, szPlayerName); } return true; };