Making a Car colour choose with Dialog - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Making a Car colour choose with Dialog (
/showthread.php?tid=160521)
Making a Car colour choose with Dialog -
RizoR - 17.07.2010
Okey, So i just got into scripting and starting to understand a little bit, Now.. I can't think of how to get a vehicle ID into a place where its not defined.. So what i need here is for the script to find out what vehicle it should spray, I'm having a hard time finding this out, I have no clue why..
Could anyone help me and tell me whats wrong here please?
What i want from this script, I want to change car colour using Dialog, and have it secured so that you can't use it when you're not in a vehicle, but it would be fine if you could just fix that vehicleid..
Thanks a lot!
Okey, here is what i made so far:
Код:
#include <a_samp>
#define car_colors
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Car Colour Script by Rizor.org ");
print(" Status = ON ");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
print("\n--------------------------------------");
print(" Car Colour Script by Rizor.org ");
print(" Status = OFF ");
print("--------------------------------------\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/carcolor", true))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST,"car_colors","Red \n Blue \n Green \n Yellow \n White \n Black \n Purple \n Dark Blue \n Pink \n Grey","SPRAY", "Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new car = GetVehicleModel(vehicleid);
if(dialogid == car_colors)
{
if(response)
{
if(listitem == 0) // Color Red
{
ChangeVehicleColor(car, 3, 0);
}
if(listitem == 1) // Color Blue
{
ChangeVehicleColor(car, 2, 0);
}
if(listitem == 2) // Color Green
{
ChangeVehicleColor(car, 86, 0);
}
if(listitem == 3) // Color Yellow
{
ChangeVehicleColor(car, 6, 0);
}
if(listitem == 4) // Color White
{
ChangeVehicleColor(car, 1, 0);
}
if(listitem == 5) // Color Black
{
ChangeVehicleColor(car, 0, 0);
}
if(listitem == 6) // Color Purple
{
ChangeVehicleColor(car, 149, 0);
}
if(listitem == 7) // Color Dark Blue
{
ChangeVehicleColor(car, 53, 0);
}
if(listitem == 8) // Color Pink
{
ChangeVehicleColor(car, 126, 0);
}
if(listitem == 9) // Color Grey
{
ChangeVehicleColor(car, 15, 0);
}
}
return 1;
}
return 0;
}
Re: Making a Car colour choose with Dialog -
Carlton - 17.07.2010
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
new car = GetPlayerVehicleID(playerid);
if(dialogid == car_colors) {
if(response && IsPlayerInAnyVehicle(playerid)) {
if(listitem == 0) // Color Red
{
ChangeVehicleColor(car, 3, 0);
}
if(listitem == 1) // Color Blue
{
ChangeVehicleColor(car, 2, 0);
}
if(listitem == 2) // Color Green
{
ChangeVehicleColor(car, 86, 0);
}
if(listitem == 3) // Color Yellow
{
ChangeVehicleColor(car, 6, 0);
}
if(listitem == 4) // Color White
{
ChangeVehicleColor(car, 1, 0);
}
if(listitem == 5) // Color Black
{
ChangeVehicleColor(car, 0, 0);
}
if(listitem == 6) // Color Purple
{
ChangeVehicleColor(car, 149, 0);
}
if(listitem == 7) // Color Dark Blue
{
ChangeVehicleColor(car, 53, 0);
}
if(listitem == 8) // Color Pink
{
ChangeVehicleColor(car, 126, 0);
}
if(listitem == 9) // Color Grey
{
ChangeVehicleColor(car, 15, 0);
}
}
return 1;
}
return 0;
}
Re: Making a Car colour choose with Dialog -
RizoR - 17.07.2010
Thanks a lot mate! Can't believe i didn't figure that out!