Question

Приветствую. На сервере всего 18 АЗС, при покупке АЗС №1 в статистике показывает ид 19, то есть добавляется +18 к ИД заправок. фрапс

 

Спойлер

#define FILLING_COUNT 18//точное кол-во заправок
#define FILLING_ID_OFFSET 18 //смещение ИД заправок в  pData[id][pBusiness] (Думаю проблема вот тут, потому что добавляется +18)

 

Спойлер

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
            new query[256];
            format(query,sizeof(query),"UPDATE `fillings` SET `ownerid` = '%d', `ownernick` = '%s' WHERE `id` = '%d'",pData[playerid][pMysqlID],pData[playerid][pNickname],fillingid+1);
            sql_query(snow, query);
            gFillings[fillingid][fillOwnerID] = pData[playerid][pMysqlID];
            format(gFillings[fillingid][fillOwner],24,"%s",pData[playerid][pNickname]);
            pData[offerid][pBusiness] = 0;
            pData[playerid][pBusiness] = fillingid + 1 + FILLING_ID_OFFSET;
            UpdatePlayerData(playerid,"bussiness",pData[playerid][pBusiness]);
            UpdatePlayerData(offerid,"bussiness",pData[offerid][pBusiness]);
            pData[offerid][pMoney] += price;
            pData[playerid][pMoney] -= price;
            pTemp[offerid][pSellFillingOffer] = INVALID_PLAYER_ID;
            pTemp[playerid][pSellFillingOffer] = INVALID_PLAYER_ID;
            pTemp[playerid][pSellFillingOffee] = INVALID_PLAYER_ID;
            pTemp[playerid][pSellFillingPrice] = 0;
            SendClientMessage(offerid,CGRAY,"Âû ïðîäàëè ÀÇÑ");
            SendClientMessage(playerid,CGREEN,"Ïîçäðàâëÿåì âû êóïèëè ÀÇÑ.");
            SendClientMessage(playerid,CGREEN,"Ìåíþ óïðàâëåíèÿ ÀÇÑ {"#cW"}\"/filling\"");
            new stringer[255];
            format(stringer, sizeof(stringer), "%s ïðîäàë àçñ èãðîêó %s çà %d$ (ÀÇÑ %d)",pData[offerid][pNickname],pData[playerid][pNickname],price,fillingid+1);
            SendLog(stringer);
            PlayerPlaySound(playerid,1185,0.0,0.0,0.0);
            SetTimerEx("PlayerPlaySoundDelay",6900,false,"ii",playerid,1186);
}

 

Спойлер

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

        case dFillingBuy:
        {
            if(!response) return 1;
            if(pData[playerid][pBusiness]) return SendClientMessage(playerid,CGRAY,"Ó âàñ óæå åñòü áèçíåñ");
            new fillingid = GetPVarInt(playerid,"bfillingid");
            new price = gFillings[fillingid][fillPrice];
            if(GetPlayerMoneyEx(playerid) < price) return SendClientMessage(playerid,CGRAY,"Ó âàñ íåäîñòàòî÷íî äåíåã");
            new query[256];
            format(query,sizeof(query),"UPDATE `fillings` SET `ownerid` = '%d', `ownernick` = '%s', `working` = '0', bank = '0' WHERE `id` = '%d'",pData[playerid][pMysqlID],pData[playerid][pNickname],fillingid+1);
            sql_query(snow, query);
            UpdatePlayerData(playerid,"bussiness",fillingid + 1 + FILLING_ID_OFFSET);
            pData[playerid][pBusiness] = fillingid + 1 + FILLING_ID_OFFSET;
            gFillings[fillingid][fillOwnerID] = pData[playerid][pMysqlID];
            format(gFillings[fillingid][fillOwner],24,"%s",pData[playerid][pNickname]);
            gFillings[fillingid][fillWorking] = true;
            gFillings[fillingid][fillBank] = 0;
            gFillings[fillingid][fillPumps] = 0;
            pData[playerid][pMoney] -= price;
            new stringer[255];
            format(stringer, sizeof(stringer), "%s êóïèë àçñ ïî ãîñ öåíå â %d$ (ÀÇÑ %d)",pData[playerid][pNickname],price,fillingid+1);
            SendLog(stringer);
            SendClientMessage(playerid,CGREEN,"Ïîçäðàâëÿåì âû êóïèëè ÀÇÑ.");
            SendClientMessage(playerid,CGREEN,"Ìåíþ óïðàâëåíèÿ ÀÇÑ {"#cW"}\"/filling\"");
            PlayerPlaySound(playerid,1185,0.0,0.0,0.0);
            SetTimerEx("PlayerPlaySoundDelay",6900,false,"ii",playerid,1186);
            UpdateFillingText(fillingid);
        }

 

 

Спойлер

Команда /stats


        if(pData[id][pBusiness]) {
            new businessid = pData[id][pBusiness] - 1;
            if(businessid < FILLING_ID_OFFSET) format(bussiness,sizeof(bussiness),"%s",gBusiness[businessid][busiName]);
            else format(bussiness,sizeof(bussiness),"ÀÇÑ");
        }
        else format(bussiness,32"Îòñóòñòâóåò");
        if(!pData[id][pMarried]) format(divrc,32,"Îòñóòñòâóåò");
        else if(pData[id][pMarried] == 1) format(divrc,32,"%s",pData[id][pDivorce]);
        new zText[1260];
        format(zText,sizeof(zText),"{"#cWHITE"}Íîìåð àêêàóíòà: \t\t{0099ff}%d\n{"#cWHITE"}Èìÿ: \t\t\t\t{0099ff}%s\n{"#cWHITE"}Óðîâåíü: \t\t\t{0099ff}%d\n{"#cWHITE"}Î÷êè îïûòà: \t\t\t{0099ff}%d èç %d\n{"#cWHITE"}Ïðåäóïðåæäåíèé: \t\t{0099ff}%d\n\n{"#cWHITE"}Íîìåð òåëåôîíà \t\t{0099ff}%d\n{"#cWHITE"}Íà ñ÷åòó òåëåôîíà:\t\t{0099ff}%d",pData[id][pMysqlID],pData[id][pNickname],pData[id][pLevel],pData[id][pExp],pData[id][pLevel]*6,warn,pData[id][pPhone],pData[id][pPhoneMoney]);
        format(zText,sizeof(zText),"%s\n\n{"#cWHITE"}Çàêîíîïîñëóøíîñòü: \t\t{0099ff}%d\n{"#cWHITE"}Óðîâåíü ðîçûñêà: \t\t{0099ff}%d\n{"#cWHITE"}˸ãêèõ íàðêîòèêîâ: \t\t{0099ff}%d ãð.\n{"#cWHITE"}Òÿæ¸ëûõ íàðêîòèêîâ: \t\t{0099ff}%d ãð.\n{"#cWHITE"}Ïàòðîíû: \t\t\t{0099ff}%d\n{"#cWHITE"}Åä. Îðóæèÿ: \t\t\t{0099ff}%d\n{"#cWHITE"}Ñèãàðåòû: \t\t\t{0099ff}%d",zText, pData[id][pZakon],wanted,pData[id][pDrugs],pData[id][pHarddrugs],pData[id][pAmmo],pData[id][pGunAmount],pData[id][pCiggaret]);
        format(zText,sizeof(zText),"%s\n\n{"#cWHITE"}Ïîë: \t\t\t\t{0099ff}%s\n{"#cWHITE"}Âîçðàñò: \t\t\t{0099ff}%d\n{"#cWHITE"}Ìóæ/Æåíà: \t\t\t{0099ff}%s\n{"#cWHITE"}Íàöèîíàëüíîñòü: \t\t{0099ff}%s{"#cWHITE"}",zText, sex,pData[id][pAge],divrc,nation);
        format(zText,sizeof(zText),"%s\n\n{"#cWHITE"}Îðãàíèçàöèÿ: \t\t\t{0099ff}%s\n{"#cWHITE"}Ðàáîòà/Äîëæíîñòü: \t\t{0099ff}%s\n{"#cWHITE"}Ðàíã: \t\t\t\t{0099ff}%d\n{"#cWHITE"}Âûãîâîðîâ: \t\t\t{0099ff}%d",zText, fraction,job,pData[id][pRank],pData[id][pTWarn]);
        format(zText,sizeof(zText),"%s\n\n{"#cWHITE"}Äîì: \t\t\t\t{0099ff}%s %s\n{"#cWHITE"}Áèçíåñ: \t\t\t{0099ff}%s (%d)",zText, housenumber,classname,bussiness,pData[id][pBusiness]);
        format(zText,sizeof(zText),"%s\n\n{"#cWHITE"}Âðåìÿ: \t\t\t{0099ff}%02d:%02d:%02d\n{"#cWHITE"}Äàòà: \t\t\t\t{0099ff}%02d.%02d.%d\n",zText, h,m,s,day,month,year);
        ShowPlayerDialog(playerid,dMes,0,"{"#cOR"}Ñòàòèñòèêà",zText,"OK","");
        return 1;
    }

 

 

Share this post


Link to post

1 answer to this question

  • 0

closed

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0