Question

Приветствую помогите пожалуйста сделать закрытие текст драйва на Esc, Я вроде сделал но всего лишь выходит игрок из автосалона а текст драйв не закрывается. Заранее спасибо. (Не судите строго я новичок)

 

Спойлер

    В public OnPlayerClickTextDraw(playerid, Text:clickedid) добавил

    if(clickedid == INVALID_TEXT_DRAW && pTemp[playerid][pSellCarSelect])
    {

            pTemp[playerid][pOff]++;
            pTemp[playerid][pSellCarSelect] = false;
            DeletePVar(playerid,"sellcarID");
            DeletePVar(playerid,"sellcarClass");
            TogglePlayerControllable(playerid,1);
            SetPlayerVirtualWorld(playerid,0);
            SetPlayerInterior(playerid,0);
            PlayerTextDrawDestroy(playerid,pTemp[playerid][pSellCarText]);
            SetCameraBehindPlayer(playerid);
            pTemp[playerid][pJustTP] = true;
            new carclass = GetPVarInt(playerid,"sellcarClass");
            SetPVarInt(playerid,"sellcarID",aSellCar[carclass]);
            pTemp[playerid][pSellCarSelect] = true;
            new model = GetVehicleModel(aSellCar[carclass]);
            new modelid = model - 400;
            new mes[256],fuelname[30];
            SelectTextDraw(playerid, 0xADD8E6FF);
            format(mes,sizeof(mes),"MODEL:     %s",gTransport[modelid][trName]);
            PlayerTextDrawSetString(playerid,PTD_autosalon[2],mes);
            format(mes,sizeof(mes),"MAX. FUEL:    %d L",gTransport[modelid][trTank]);
            PlayerTextDrawSetString(playerid,PTD_autosalon[4],mes);
            format(mes,sizeof(mes),"%d $",gTransport[modelid][trPrice]);
            PlayerTextDrawSetString(playerid,PTD_autosalon[6],mes);
            format(mes,sizeof(mes),"ENGINE:    Regular",fuelname);
            PlayerTextDrawSetString(playerid,PTD_autosalon[7],mes);
            format(mes,sizeof(mes),"CONS.:    %d l/100km",gTransport[modelid][trConsumption]);
            PlayerTextDrawSetString(playerid,PTD_autosalon[8],mes);
            for(new t = 0; t < 13; t++) PlayerTextDrawShow(playerid, PTD_autosalon[t]);
            SendClientMessage(playerid,CGRAY,"Вы вышли из автосалона");
            switch(carclass)
            {
            case 0: SetPlayerPos(playerid,555.3174,-1290.6477,17.2482);
            case 1: SetPlayerPos(playerid,-1955.4077,296.6946,35.4688);
            case 2: SetPlayerPos(playerid,1658.9636,2198.3733,10.8203);
            case 3: SetPlayerPos(playerid,2131.2488,-1149.5587,24.2475);
            }
    }

 

Спойлер


Вот сам TextDrive автосалона
case dBuyCarSalon:
        {
            if(!response) return 1;
            new carclass = GetPVarInt(playerid,"sellcarClass");
            SetPlayerVirtualWorld(playerid,carclass+1);
            TogglePlayerControllable(playerid,0);
            SetPlayerInterior(playerid,18);
            SetPlayerPos(playerid,210.93231423.08141417.0219);
            new Float:x, Float:y, Float:z;
            GetVehiclePos(aSellCar[carclass],x,y,z);
            SetPlayerCameraLookAt(playerid,x,y,z,1);
            //x -= 5.0;
            //y = y - 5.0;
            z = z + 1.0;
            SetPlayerCameraPos(playerid,212.0646,y,z);
            SetPVarInt(playerid,"sellcarID",aSellCar[carclass]);
            pTemp[playerid][pSellCarSelect] = true;
            SendClientMessage(playerid,CGREEN,"Äîáðî ïîæàëîâàòü â àâòîñàëîí. Èñïîëüçóéòå ïàíåëü äëÿ âûáîðà.");
            new model = GetVehicleModel(aSellCar[carclass]);
            new modelid = model - 400;
            new mes[256],fuelname[30];
            SelectTextDraw(playerid, 0xADD8E6FF);
            format(mes,sizeof(mes),"MODEL:     %s",gTransport[modelid][trName]);
            PlayerTextDrawSetString(playerid,PTD_autosalon[2],mes);
            format(mes,sizeof(mes),"MAX. FUEL:    %d L",gTransport[modelid][trTank]);
            PlayerTextDrawSetString(playerid,PTD_autosalon[4],mes);
            format(mes,sizeof(mes),"%d $",gTransport[modelid][trPrice]);
            PlayerTextDrawSetString(playerid,PTD_autosalon[6],mes);
            format(mes,sizeof(mes),"ENGINE:    Regular",fuelname);
            PlayerTextDrawSetString(playerid,PTD_autosalon[7],mes);
            format(mes,sizeof(mes),"CONS.:    %d l/100km",gTransport[modelid][trConsumption]);
            PlayerTextDrawSetString(playerid,PTD_autosalon[8],mes);
            for(new t = 0; t < 13; t++) PlayerTextDrawShow(playerid, PTD_autosalon[t]);
        }
        case dBuyCar:
        {
            if(!response) return 1;

            pTemp[playerid][pSellCarSelect] = false;
            new carclass = GetPVarInt(playerid,"sellcarClass");
            new carid = GetPVarInt(playerid,"sellcarID");
            new color1 = GetPVarInt(playerid,"pbuycarC1");
            new color2 = GetPVarInt(playerid,"pbuycarC2");
            DeletePVar(playerid,"sellcarID");
            DeletePVar(playerid,"sellcarClass");
            TogglePlayerControllable(playerid,1);
            SetPlayerVirtualWorld(playerid,0);
            SetPlayerInterior(playerid,0);
            PlayerTextDrawDestroy(playerid,pTemp[playerid][pSellCarText]);
            SetCameraBehindPlayer(playerid);
            pTemp[playerid][pJustTP] = true;
            switch(carclass)
            {
                case 0: SetPlayerPos(playerid,555.3174,-1290.6477,17.2482);
                case 1: SetPlayerPos(playerid,-1955.4077,296.6946,35.4688);
                case 2: SetPlayerPos(playerid,1658.9636,2198.3733,10.8203);
                case 3: SetPlayerPos(playerid,2131.2488,-1149.5587,24.2475);
            }
            if(!pData[playerid][pHouse])
            {
            SendClientMessage(playerid,CGRAY,"Ó Âàñ íåò äîìà"); //ïîêóïêà àâòî îòìåíà
            for(new t = 0; t < 13; t++) PlayerTextDrawHide(playerid, PTD_autosalon[t]);
            CancelSelectTextDraw(playerid);
            return true;
            }
            new model = GetVehicleModel(carid);
            new modelid = model - 400;
            new houseid = pData[playerid][pHouse]-1;
            new price = gTransport[modelid][trPrice];
            if(GetPlayerMoneyEx(playerid) < price) return SendClientMessage(playerid,CGRAY,"Ó âàñ íåäîñòàòî÷íî äåíåã");
            new query[256];
            format(query,sizeof(query),"INSERT INTO `cars` VALUES ('','%d','%d','GoodCar','%.0f','0.0','1000','%d','%d','0','0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0','-')",pData[playerid][pMysqlID],modelid,gTransport[modelid][trTank]+0.0,color1,color2);
            new Result:r = sql_query(snow, query);
            new id = sql_insert_id(r);
            sql_free_result(r);
            UpdatePlayerData(playerid,"car",id);
            new slot = -1;
            for(new i;i<MAX_VEHICLES;i++)
            {
                if(gCars[i][carOwnerid] == 0) {slot = i; break;}
            }
            if(slot == -1)
            {
                format(query,sizeof(query),"DELETE FROM `cars` WHERE `id` = '%d'",id);
                sql_query(snow, query);
                SendClientMessage(playerid,CRED,"Îøèáêà ñëîòà (#01)");
            }
            pData[playerid][pCar] = id;
            gCars[slot][carMysqlID] = id;
            gCars[slot][carOwnerid] = pData[playerid][pMysqlID];
            gCars[slot][carModelid] = modelid;
            gCars[slot][carFuel] = gTransport[modelid][trTank];
            gCars[slot][carDrived] = 0.0;
            gCars[slot][carHealth] = 1000.0;
            gCars[slot][carProbability] = 0;
            gCars[slot][carColor1] = color1;
            gCars[slot][carColor2] = color2;
            strcat(gCars[slot][carPlate],"GoodCar");
            if(houseid >= 0)
            {
                new vehicleid = CreateVehicle(gTransport[modelid][trModel],gHouses[houseid][houseParkX],gHouses[houseid][houseParkY],gHouses[houseid][houseParkZ],gHouses[houseid][houseParkR],gCars[slot][carColor1],gCars[slot][carColor2],-1);
                gCars[slot][carVid] = vehicleid;
                gVehicles[vehicleid-1][vLock] = 1;
                gVehicles[vehicleid-1][vFuel] = gCars[slot][carFuel];
                gVehicles[vehicleid-1][vDrived] = gCars[slot][carDrived];
                gVehicles[vehicleid-1][vHealth] = gCars[slot][carHealth];
                gVehicles[vehicleid-1][vOwnerid] = gCars[slot][carOwnerid];
                gVehicles[vehicleid-1][vX] = gHouses[houseid][houseParkX];
                gVehicles[vehicleid-1][vY] = gHouses[houseid][houseParkY];
                gVehicles[vehicleid-1][vZ] = gHouses[houseid][houseParkZ];
                gVehicles[vehicleid-1][vProbability] = 0;
            }
            for(new t = 0; t < 13; t++) PlayerTextDrawHide(playerid, PTD_autosalon[t]);
            pData[playerid][pMoney] -= price;
            SendClientMessage(playerid,CGREEN,"Ïîçäðàâëÿåì Âû êóïèëè ò/ñ. Îíî äîñòàâëåíî ê âàøåìó äîìó");
            CancelSelectTextDraw(playerid);
            new stringer[255];
            format(stringer, sizeof(stringer), "%s êóïèë àâòî ïî ãîñ öåíå â %d$ (Àâòî %d)",pData[playerid][pNickname],price,pData[playerid][pCar]);
            SendLog(stringer);
            pData[playerid][pCarnomera] = 0;
            UpdatePlayerData(playerid,"carnumber",0);
        }
        case dBuyCarC1:
        {
            if(!response) return 1;
            new color;
            switch(listitem)
            {
                case 0: color = 1;
                case 1: color = 0;
                case 2: color = 2;
                case 3: color = 3;
                case 4: color = 6;
                case 5: color = 103;
                case 6: color = 33;
                case 7: color = 126;
                case 8: color = 102;
                case 9: color = 85;
                defaultreturn ShowPlayerDialog(playerid,dBuyCarC1Edit,1,"Âûáîð öâåòà íîìåð 1","Ââåäèòå ID öâåòà íîìåð 1:","ÎÊ","Íàçàä");
            }
            SetPVarInt(playerid,"pbuycarC1",color);
            ShowPlayerDialog(playerid,dBuyCarC2,2,"Âûáåðèòå öâåò íîìåð 2","1.Áåëûé\n{505050}2.×åðíûé\n{"#cLIGHTBLUE"}3.Ãîëóáîé\n{"#cRED"}4.Êðàñíûé\n{"#cY"}5.Æåëòûé\n{0066FF}6. Ñèíèé\n{"#cGRAY"}7.Ñåðûé\n{"#cPINK"}8. ÐîçîÂûé\n{f5f5dc}9.ÁåæåÂûé\n{ff00ff}10.Ïóðïóðíûé\n{"#cW"}Äðóãîé...","OK","Âûõîä");
        }
        case dBuyCarC1Edit:
        {
            if(!response) return ShowPlayerDialog(playerid,dBuyCarC1,2,"Âûáåðèòå öâåò íîìåð 1","1.Áåëûé\n{505050}2.×åðíûé\n{"#cLIGHTBLUE"}3.Ãîëóáîé\n{"#cRED"}4.Êðàñíûé\n{"#cY"}5.Æåëòûé\n{0066FF}6. Ñèíèé\n{"#cGRAY"}7.Ñåðûé\n{"#cPINK"}8. ÐîçîÂûé\n{f5f5dc}9.ÁåæåÂûé\n{ff00ff}10.Ïóðïóðíûé\n{"#cW"}Äðóãîé...","OK","Âûõîä");
            if(!strval(inputtext) || !isNumeric(inputtext))
            {
                SendClientMessage(playerid,CGRAY,"Âû äîëæíû óêàçàòü ID öâåòà àâòî");
                return ShowPlayerDialog(playerid,dBuyCarC1Edit,1,"Âûáîð öâåòà íîìåð 1","Ââåäèòå ID öâåòà íîìåð 1:","ÎÊ","Íàçàä");
            }
            SetPVarInt(playerid,"pbuycarC1",strval(inputtext));
            ShowPlayerDialog(playerid,dBuyCarC2,2,"Âûáåðèòå öâåò íîìåð 2","1.Áåëûé\n{505050}2.×åðíûé\n{"#cLIGHTBLUE"}3.Ãîëóáîé\n{"#cRED"}4.Êðàñíûé\n{"#cY"}5.Æåëòûé\n{0066FF}6. Ñèíèé\n{"#cGRAY"}7.Ñåðûé\n{"#cPINK"}8. ÐîçîÂûé\n{f5f5dc}9.ÁåæåÂûé\n{ff00ff}10.Ïóðïóðíûé\n{"#cW"}Äðóãîé...","OK","Íàçàä");
        }
        case dBuyCarC2:
        {
            if(!response) ShowPlayerDialog(playerid,dBuyCarC1,2,"Âûáåðèòå öâåò íîìåð 1","1.Áåëûé\n{505050}2.×åðíûé\n{"#cLIGHTBLUE"}3.Ãîëóáîé\n{"#cRED"}4.Êðàñíûé\n{"#cY"}5.Æåëòûé\n{0066FF}6. Ñèíèé\n{"#cGRAY"}7.Ñåðûé\n{"#cPINK"}8. ÐîçîÂûé\n{f5f5dc}9.ÁåæåÂûé\n{ff00ff}10.Ïóðïóðíûé\n{"#cW"}Äðóãîé...","OK","Âûõîä");
            new color;
            switch(listitem)
            {
                case 0: color = 1;
                case 1: color = 0;
                case 2: color = 2;
                case 3: color = 3;
                case 4: color = 6;
                case 5: color = 103;
                case 6: color = 33;
                case 7: color = 126;
                case 8: color = 102;
                case 9: color = 85;
                defaultreturn ShowPlayerDialog(playerid,dBuyCarC2Edit,1,"Âûáîð öâåòà íîìåð 2","Ââåäèòå ID öâåòà íîìåð 2:","ÎÊ","Íàçàä");
            }
            SetPVarInt(playerid,"pbuycarC2",color);
            ShowPlayerDialog(playerid,dBuyCar,0,"Ïîêóïêà àâòî","Âû äåéñòâèòåëüíî õîòèòå êóïèòü ýòîò àâòîìîáèëü?","Äà","Íåò");
        }
        case dBuyCarC2Edit:
        {
            if(!response) return ShowPlayerDialog(playerid,dBuyCarC2,2,"Âûáåðèòå öâåò íîìåð 2","1.Áåëûé\n{505050}2.×åðíûé\n{"#cLIGHTBLUE"}3.Ãîëóáîé\n{"#cRED"}4.Êðàñíûé\n{"#cY"}5.Æåëòûé\n{0066FF}6. Ñèíèé\n{"#cGRAY"}7.Ñåðûé\n{"#cPINK"}8. ÐîçîÂûé\n{f5f5dc}9.ÁåæåÂûé\n{ff00ff}10.Ïóðïóðíûé\n{"#cW"}Äðóãîé...","OK","Íàçàä");
            if(!strval(inputtext) || !isNumeric(inputtext))
            {
                SendClientMessage(playerid,CGRAY,"Âû äîëæíû óêàçàòü ID öâåòà àâòî");
                return ShowPlayerDialog(playerid,dBuyCarC2Edit,1,"Âûáîð öâåòà íîìåð 2","Ââåäèòå ID öâåòà íîìåð 2:","ÎÊ","Íàçàä");
            }
            SetPVarInt(playerid,"pbuycarC2",strval(inputtext));
            ShowPlayerDialog(playerid,dBuyCar,0,"Ïîêóïêà àâòî","Âû äåéñòâèòåëüíî õîòèòå êóïèòü ýòîò àâòîìîáèëü?","Äà","Íåò");
        }


Снял проблему на видео - click

 

 

Share this post


Link to post

5 answers to this question

  • 0
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) 
{
    if(playertextid == PlayerText:INVALID_TEXT_DRAW && pTemp[playerid][pSellCarSelect])
    {
        // ваш код выше
        for(new t = 0; t < 13; t++) PlayerTextDrawHide(playerid, PTD_autosalon[t]);
        return 1;
    }
    return 1;
}

 

Edited by danya_white

Share this post


Link to post
  • 0

up

Заметка от _bogdan_ , создано

3.6. Запрещено поднимать (апать) свою тему чаще, чем 1 раз в 24 часа. 

Устное предупреждение.

Share this post


Link to post
  • 0

Не совсем понимаю для чего ты используешь паблик  OnPlayerClickTextDraw
В паблик  OnPlayerKeyStateChange добавь следующее

if(PRESSED(27)) //key esc
{
    for(new t = 0; t < 13; t++) PlayerTextDrawHide(playerid, PTD_autosalon[t]);
}

 

Share this post


Link to post
  • 0

@user408337  а дальше что? добавил и толку 0. Не закрывается TD

Share this post


Link to post
  • 0

@danya_white  Бро спасибо тебе огромное!!! ОГРОМНОЕ УВАЖЕНИЕ И БЛАГОДАРНОСТЬ ТЕБЕ. Только ты мне помог. Лови +

Заметка от _bogdan_ , создано

2.8. Если вы нашли ответ на свой вопрос, рекомендуется поощрить автора лучшего ответа поднятием репутации, а также обязательно пометить ответ на вопрос лучшим.  Как пометить ответ лучшим?

Устное предупреждение.

Share this post


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