PaintJob Problem..
#1

Hey ,

I have script that improve the vehicle.I want to know how can I PaintJob the car after changing her color ?

For Example..

I come to the garage (Faction) and I changing her colors to yellow and then i want to paintjob it on the color..and when I change set paintjob the paintjob will be in yellow.

when I do it in my server it set normal paintjob...

Tnx !

http://pastebin.com/6ex4fCqS
Reply
#2

You can easily make a command with Dialogs
For ZCMD
pawn Код:
CMD:paintjob(playerid, params[])
{
    ShowPlayerDialog(playerid, 90, DIALOG_STYLE_LIST, "{FFFFFF}PaintJobs", "PaintJob 0\nPaintJob 1\nPaintJob 2\nPaintJob 3", "Select", "Cancel");
    return 1;
}
OnDialogResponse
pawn Код:
if(dialogid == 90)
{
    if(response) {
        if(listitem == 0) {
            if(IsPlayerInAnyVehicle(playerid)) {
                ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 0);
            }
            else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
        }
        if(listitem == 1) {
            if(IsPlayerInAnyVehicle(playerid)) {
                ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 1);
            }
            else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
        }
        if(listitem == 2) {
            if(IsPlayerInAnyVehicle(playerid)) {
                ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 2);
            }
            else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
        }
        if(listitem == 3) {
            if(IsPlayerInAnyVehicle(playerid)) {
                ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 3);
            }
            else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
        }
    }
}
If else, you are using strcmp
pawn Код:
if (strcmp(cmdtext, "/paintjob", true)==0)
{
    ShowPlayerDialog(playerid, 90, DIALOG_STYLE_LIST, "{FFFFFF}PaintJobs", "PaintJob 0\nPaintJob 1\nPaintJob 2\nPaintJob 3", "Select", "Cancel");
    return 1;
}
OnDialogResponse
pawn Код:
if(dialogid == 90)
{
    if(response) {
        if(listitem == 0) {
            if(IsPlayerInAnyVehicle(playerid)) {
                ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 0);
            }
            else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
        }
        if(listitem == 1) {
            if(IsPlayerInAnyVehicle(playerid)) {
                ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 1);
            }
            else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
        }
        if(listitem == 2) {
            if(IsPlayerInAnyVehicle(playerid)) {
                ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 2);
            }
            else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
        }
        if(listitem == 3) {
            if(IsPlayerInAnyVehicle(playerid)) {
                ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 3);
            }
            else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
        }
    }
}
Reply
#3

The command is working but it doesnt change the paintjob colors...
Reply
#4

Quote:
Originally Posted by dorperez
Посмотреть сообщение
The command is working but it doesnt change the paintjob colors...
It is changes only the paintjob not the color
For color use another command, like with ZCMD
pawn Код:
CMD:carcolor(playerid, params[])
{
    new vehicleid, color1, color2;
    if((vehicleid = GetPlayerVehicleID(playerid)))
    {
        if(sscanf(params, "dd", color1, color2)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}Usage: /carcolor [color 1] [color 2]");
        if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You' re not driver!");
        ChangeVehicleColor(vehicleid, color1, color2);
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
}
Or strcmp
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128];
    new idx;
    new tmp[256];
    if(strcmp(cmd, "/carcolor", true) == 0) {
        new color1, color2;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor [color1] [color2]");
        color1 = strval(tmp);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor [color1] [color2]");
        color2 = strval(tmp);
        ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
        return 1;
    }
    //More of your code
Also, may this is useful if you have errors. I don't remember it
pawn Код:
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' ')) {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#5

Dude...I want the color will change the paintjob deisgn...
Reply
#6

Where did you add the OnDialogResponse. On your gamemode or filterscript.
Moreover, is the dialogs appears in-game and when you click at one, it doesn't work?
Reply
#7

I put it on my gamemod.It doesn't work
Reply
#8

Quote:
Originally Posted by dorperez
Посмотреть сообщение
I put it on my gamemod.It doesn't work
Did you
pawn Код:
return 1;
at the end OnDialogResponse?
And the dialogs appears in-game yes or no
Reply
#9

Yes it appears.
Reply
#10

Check again if return 1;
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 90) {
        if(response) {
            if(listitem == 0) {
                if(IsPlayerInAnyVehicle(playerid)) {
                    ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 0);
                }
                else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
            }
            if(listitem == 1) {
                if(IsPlayerInAnyVehicle(playerid)) {
                    ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 1);
                }
                else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
            }
            if(listitem == 2) {
                if(IsPlayerInAnyVehicle(playerid)) {
                    ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 2);
                }
                else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
            }
            if(listitem == 3) {
                if(IsPlayerInAnyVehicle(playerid)) {
                    ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 3);
                }
                else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
            }
        }
    }
    return 1;
}
If it still, change the Dialog id. Maybe there is same id at another dialog
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)