Jump to content
  • 0

Cum transform comanda in dialog?


DeLeT.

Question

Cum as putea transforma comanda intr-un dialog cu imput si anume, dupa ce dai /v create sa apara un dialog in care sa scri in el carid, culoare 1, culoarea2 iar apoi sa iti dea masina.

if(strcmp(x_nr,"create",true) == 0)

          {

              if(PlayerInfo[playerid][pLevel] >= 2)

              {

              if(PlayerInfo[playerid][pPcarkey] == -1 && PlayerInfo[playerid][pPcarkey2] == -1 && PlayerInfo[playerid][pPcarkey3] == -1)

              {

                  tmp = strtok(cmdtext, idx);

                  if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /v create [carid] [color1] [color2]"); return 1; }

                  new car = strval(tmp);

                  if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Vehicle Number can't be below 400 or above 611 !"); return 1; }

                  if(IsInvalidVehicleId(car) == 0)

                  {

                    SendClientMessage(playerid, COLOR_GREY, "Invalid vehicle model !"); return 1;

                  }

                  tmp = strtok(cmdtext, idx);

                  if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /v create [carid] [color1] [color2]"); return 1; }

                  new color1 = strval(tmp);

                  if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Color Number can't be below 0 or above 126 !"); return 1; }

                  tmp = strtok(cmdtext, idx);

                  if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /v create [carid] [color1] [color2]"); return 1; }

                  new color2 = strval(tmp);

                  if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Color Number can't be below 0 or above 126 !"); return 1; }

                 

                  new thiscar, Float:X, Float:Y, Float:Z;

                  GetPlayerPos(playerid, X, Y, Z);

                  GetPlayerName(playerid, sendername, sizeof(sendername));

                  thiscar = CreateVehicle(car, X, Y, Z, 1, color1, color2, -1);

                  strmid(CarInfo[thiscar][cOwner], sendername, 0, strlen(sendername), 999);

                  format(CarInfo[thiscar][cDescription], 32, "%s", vehName[GetVehicleModel(thiscar) - 400]);

                  CarInfo[thiscar][cOwned] = 1;

                  CarInfo[thiscar][cModel] = car;

                  CarInfo[thiscar][cColorOne] = color1;

                  CarInfo[thiscar][cColorTwo] = color2;

                  CarInfo[thiscar][cLocationx] = X;

                  CarInfo[thiscar][cLocationy] = Y;

                  CarInfo[thiscar][cLocationz] = Z;

                  CarInfo[thiscar][cAngle] = 1;

                    CarInfo[thiscar][paintjob] = -1;

                  if(PlayerInfo[playerid][pPcarkey] == -1) { PlayerInfo[playerid][pPcarkey] = thiscar; }

                  else if(PlayerInfo[playerid][pPcarkey2] == -1) { PlayerInfo[playerid][pPcarkey2] = thiscar; }

                  else if(PlayerInfo[playerid][pPcarkey3] == -1) { PlayerInfo[playerid][pPcarkey3] = thiscar; }

                  format(TextCar, sizeof(TextCar), "{EE1111}Proprietar: {0099FF}• %s •", CarInfo[thiscar][cOwner]);

                  TextUpCar[thiscar] = Create3DTextLabel(TextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1);

                  Attach3DTextLabelToVehicle(TextUpCar[thiscar], thiscar, 0.0, 0.0, 0.1);

                  LoadComponents(thiscar), OnCarUpdate(), SavePlayerData(playerid);

              }

              else

              {

                  SendClientMessage(playerid, COLOR_WHITE, "Ai deja o masina creeata de tine !");

              }

              }

              else

              {

                SendClientMessage(playerid, COLOR_WHITE, "Trebuie sa ai level 2 !");

              }

              return 1;

          }

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Nu seamana cu al meu ma poti ajuta eu am reusit sa fac prima parte da la a 2-a ma incurc

case 1:

{

    if(PlayerInfo[playerid][pLevel] >= 2)

{

ShowPlayerDialog(playerid,5004, DIALOG_STYLE_INPUT, "Create the Vehicle", "Enter: [carid] [color1] [color2]", "Create", "Cancel");

}

else

        {

        SendClientMessage(playerid, COLOR_WHITE, "Trebuie sa ai level 2 !");

        }

}

Dar continuarea nu o stiu

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.