Vehicle Color - Dialog Input
#1

So yeah, as the title says I'm a bit stuck here. So, I'm making "something". So, i decided to put a vehicle color changer that works with dialog input. When they write the command/ select it via a dialog list it asks them for the : First Color ID and after putting a valid number 0-255 the second color ID. So, for ChangeVehicleColor you have to input "color1" and "color2". Here's where I'm stuck. If I only had to do one ID it would of been easy "inputtext" but now ehhh... How to save the First ColorID from the first dialog, so i can use it altogether with the Second ID on the Second Dialog.

pawn Код:
if(dialogid == 1754)
    {
        if(response)
        {
            if(strval(inputtext) < 0 || strval(inputtext) > 255)
            {
                ShowPlayerDialog(playerid, 1754, DIALOG_STYLE_INPUT, "Color", "Input your first vehicle color ID! 0-255", "Choose", "Exit");
                SendClientMessage( playerid, -1, "Error: You must input a valid ID 0-255!");
            }
            //My beautiful code
        }
        return 1;
    }
    if(dialogid == 1755)
    {
        if(response)
        {
            if(strval(inputtext) < 0 || strval(inputtext) > 255)
            {
                ShowPlayerDialog(playerid, 1755, DIALOG_STYLE_INPUT, "Color", "Input your second vehicle color ID! 0-255", "Choose", "Exit");
                SendClientMessage( playerid, -1, "Error: You must input a valid ID 0-255!");
            }
            //My beautiful code
        }
        return 1;
    }
If you don't understand, What I'm trying to say just Ask about it. I wrote this in confusion, so my brain isn't in its full potential.
Reply
#2

If it's a personal car, with a savable variable for the color(s), then you could just set the car color 2 of the first beautiful code and then put the car color 1 as the inputtext if you get what I mean, i.e.:

pawn Код:
ChangeVehicleColor(vehicleid, VehicleData[vehicleid][vColor1], strval(inputtext))
Otherwise if you don't, some guy made an include for GetVehicleColor, here: https://sampforum.blast.hk/showthread.php?tid=176496.
Reply
#3

Yep something like that

pawn Код:
new StoredColor[MAX_PLAYERS];


Command you show dialog wow awesome{
    ShowTheDialogForTheFristColor!
    StoredColor[playerid] = 0;
}

if(dialogid == 1754)
{
    if(response)
    {
        if(strval(inputtext) < 0)
        {
            ShowPlayerDialog(playerid, 1754, DIALOG_STYLE_INPUT, "Color", "Input your first vehicle color ID! 0-255", "Choose", "Exit");
            SendClientMessage( playerid, -1, "Error: You must input a valid ID 0-255!");
        }
        if(strval(inputtext) > 255)
        {
            ShowPlayerDialog(playerid, 1754, DIALOG_STYLE_INPUT, "Color", "Input your first vehicle color ID! 0-255", "Choose", "Exit");
            SendClientMessage( playerid, -1, "Error: You must input a valid ID 0-255!");
        }
        StoredColor[playerid] = strval(inputtext);
        //HERE YOU SHOW THE SECOND DIALOG....
    }
    return 1;
}
if(dialogid == 1755)
{
    if(response)
    {
        if(strval(inputtext) < 0)
        {
            ShowPlayerDialog(playerid, 1755, DIALOG_STYLE_INPUT, "Color", "Input your second vehicle color ID! 0-255", "Choose", "Exit");
            SendClientMessage( playerid, -1, "Error: You must input a valid ID 0-255!");
        }
        if(strval(inputtext) > 255)
        {
            ShowPlayerDialog(playerid, 1755, DIALOG_STYLE_INPUT, "Color", "Input your second vehicle color ID! 0-255", "Choose", "Exit");
            SendClientMessage( playerid, -1, "Error: You must input a valid ID 0-255!");
        }
        ChangeVehicleColor(GetPlayerVehicleID(playerid),StoredColor[playerid],strval(inputtext));
    }
    return 1;
}
Reply
#4

-Deleted-
Reply
#5

I think you'll have to use the GetVehicleColor include that I gave you, because it'll be easier to store the car color's. Unless you save it to a global variable upon the vehicle spawning, if you know what I mean.
Reply
#6

Or just use what i posted..
Reply
#7

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
Or just use what i posted..
Oh lol, didn't see your reply that you posted whatsoever. Yea, use what iJumbo posted, it's a good example of saving it to a global variable, you could use this variable too upon the vehicle spawning, i.e. the command of the vehicle, the color parameters will save to the global variable.
Reply
#8

Nevermind, Ignore Spiderman. Anyways, Both of you helped me. It works now and I get +15 experience in "Dialogs Tactics", Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)