[TUT]How to create a vehicle dialog menu -
Toni - 15.07.2010
Creating Dialog Vehicle Menu
Hello,
This is a tutorial on how to create a dialog, that spawns vehicles at your location.
First off lets assign a ID to the dialog:
Then next we are gonna make our dialog list (of course with a command):
pawn Код:
if(!strcmp(cmdtext, "/vmenu", true))
{
ShowPlayerDialog(playerid, vmenu, DIALOG_STYLE_LIST, "Vehicle Menu", "Andromada \nDodo \nSultan \nInfernus", "Spawn", "Cancel");
return 1;
}
Now that we have a list of vehicles (you can add more later, and into categories by adding more dialog lists).
Now lets create a declaration, and make it global so we don't have to keep creating more.
pawn Код:
new Float:X, Float:Y, Float:Z, Float:Angle, pInt;
Now that we have all that, lets go create the vehicles (we add it to the callback OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) )
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
pInt = GetPlayerInterior(playerid);
switch(dialogid) {
case: vmenu
{
if(response)
{
if(listitem == 0) // The Andromada
{
CreateVehicle(592, X+5, Y, Z+1, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
}
if(listitem == 1) // Dodo
{
CreateVehicle(593, X+5, Y, Z+1, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
}
if(listitem == 2) // Sultan
{
CreateVehicle(560, X+5, Y, Z+1, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
}
if(listitem == 3) // Infernus
{
CreateVehicle(411, X+5, Y, Z+1, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
}
}
return 1;
}
return 0;
}
Now, lets cut it down into sections.
GetPlayerPos(playerid, X, Y, Z); - That function gets the player's X, Y, Z position, so the script knows where to create the vehicle.
GetPlayerFacingAngle(playerid, Angle); - That function will get your angle so it can spawn the vehicle the same angle as your angle.
pInt = GetPlayerInterior(playerid); - That function will get your interior so if you are somewhere else, it may be spawned there as well.
switch(dialogid) { }
case: vmenu - That function will check if the menu is the vehicle dialog.
if(response) - will check if the player responded to the dialog or not.
if(listitem == 0) - Will check the item id on the list (as the andromada is now the first one on the list, so it is item 0.
CreateVehicle(); - Will create the vehicle at your position. (The parameters are below)
pawn Код:
592 = Vehicle Model
X+5 = The Player's X position, + 5 X unit's
Y = The Player's Y position.
Z+1 = The Player's Z position, + 1 Z Unit
Angle = The Player's Angle.
random(100) = Vehicle Color 1, but random colors 0 through 100
random(100) = Vehicle Color 2, but random colors 0 through 100
-1 = Never Respawn again
LinkVehicleToInterior = that one is self explanatory.
GetPlayerVehicleID(playerid) = Get the players vehicle id that they spawned
pInt = The declaration that gets the player's interior
Thats it! Just repeat those if(listitem == ) id's the item's ID
and the Create vehicle function!
Hoped that help a lot
- Toni
Updated recently, I didn't have an editor to actually format it so it's a little derp and out dated. This is not a recommended tutorial for first off beginners that don't know basic coding.
Re: [TUT]How to create a vehicle dialog menu -
zSuYaNw - 15.07.2010
Nice,Tut,Congratulations!
Re: [TUT]How to create a vehicle dialog menu -
Toni - 15.07.2010
Quote:
Originally Posted by [Full]Garfield[XDB]
Nice,Tut,Congratulations!
|
Thanks its my first
Re: [TUT]How to create a vehicle dialog menu -
Vampiruue - 09.08.2010
i get erros can u help me out?
Re: [TUT]How to create a vehicle dialog menu -
Toni - 09.08.2010
Quote:
Originally Posted by Vampiruue
i get erros can u help me out?
|
Can you show me the errors ?
Re: [TUT]How to create a vehicle dialog menu -
Vampiruue - 09.08.2010
Quote:
Originally Posted by The Toni
Can you show me the errors ?
|
i can and here they r idk awt happen i just copyed from the thing and followed the instructions
heres my errors
Код:
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(2) : error 010: invalid function or declaration
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(4) : error 010: invalid function or declaration
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(7) : error 010: invalid function or declaration
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(11) : warning 235: public function lacks forward declaration (symbol "OnDialogResponse")
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(13) : error 017: undefined symbol "GetPlayerPos"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(14) : error 017: undefined symbol "GetPlayerFacingAngle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(15) : error 017: undefined symbol "GetPlayerInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(23) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(23) : error 017: undefined symbol "LinkVehicleToInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(27) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(27) : error 017: undefined symbol "LinkVehicleToInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(31) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(31) : error 017: undefined symbol "LinkVehicleToInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(35) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(35) : error 017: undefined symbol "LinkVehicleToInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(39) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(39) : error 017: undefined symbol "LinkVehicleToInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(41) : warning 217: loose indentation
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(43) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(43) : error 017: undefined symbol "LinkVehicleToInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(47) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(47) : error 017: undefined symbol "LinkVehicleToInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(51) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(51) : error 017: undefined symbol "LinkVehicleToInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(55) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(55) : error 017: undefined symbol "LinkVehicleToInterior"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(59) : error 017: undefined symbol "CreateVehicle"
D:\downloads\GTA\samp 0.3 server\filterscripts\Carmenu.pwn(59) : error 017: undefined symbol "LinkVehicleToInterior"
Re: [TUT]How to create a vehicle dialog menu -
Hiddos - 09.08.2010
Download the new SA-MP server version.
Few things:
Random(bla) starts at 0 and ends at bla-1, so if you'd the random(100), the minimum would be 0 and the maximum would be 99.
Other to that, use '-1' for a default random color (A colour San Andreas randomly gives to its cars, not pink to trucks or something but just darkgreen etc. etc.)
One last suggestion: Use switch(listitem) with cases, instead of if(listitem == 0)
Looks nice, good job.
Re: [TUT]How to create a vehicle dialog menu -
[XST]O_x - 09.08.2010
You may want to get the XY in front of the player in order the car to spawn in the front

Nice tut anyway.
Re: [TUT]How to create a vehicle dialog menu -
Hiddos - 09.08.2010
Quote:
Originally Posted by [XST]O_x
You may want to get the XY in front of the player in order the car to spawn in the front 
Nice tut anyway.
|
You might also want to put the player in the vehicle :P
Re: [TUT]How to create a vehicle dialog menu -
hab2ever - 09.08.2010
Nice work
Re: [TUT]How to create a vehicle dialog menu -
jpboy1 - 18.08.2010
i have 1 problem.
as i spawn the car and drive and it explodes and then i go back to the spawnpoint of the vehicle the car is back.
but i want as the car explodes that the vehicle is gone.
please help me!
srry for bad English. it's cause i'm Dutch
Re: [TUT]How to create a vehicle dialog menu -
Shockey - 06.09.2010
Nice work but for beginners they wouldn't know where to put like the
#define vmenu 159156
and the
new Float:X, Float:Y, Float:Z, Float:Angle, pInt
other than that great tut
suggestion:
make a car dialog exactly Luke this but how to make categories like cars planes etc...
Coz I wanna know how to make categories so I can make a full vehicle menu with every vehicle
-Thankyou
Re: [TUT]How to create a vehicle dialog menu -
Scenario - 06.09.2010
Not bad. Simple, but useful.
Re: [TUT]How to create a vehicle dialog menu -
Toni - 06.09.2010
Quote:
Originally Posted by Shockey
Nice work but for beginners they wouldn't know where to put like the
#define vmenu 159156
and the
new Float:X, Float:Y, Float:Z, Float:Angle, pInt
other than that great tut
suggestion:
make a car dialog exactly Luke this but how to make categories like cars planes etc...
Coz I wanna know how to make categories so I can make a full vehicle menu with every vehicle
-Thankyou
|
Yeah...ermm I'll do that when I have a little free time
Quote:
Originally Posted by RealCop228
Not bad. Simple, but useful.
|
Thanks.
Re: [TUT]How to create a vehicle dialog menu -
Shockey - 06.09.2010
plz have free time fast

coz I need to know in a hurry or could u just tell mr how to with just the listitem part and don't explain anything just post a category say cars
and then just do the listitem part plzz and with only 2"1 vehicle and dint explain anything
just fof Now so I can make my menu pllllzzzz
Re: [TUT]How to create a vehicle dialog menu -
Toni - 06.09.2010
I'll make it 2morrow, I just spent a day playing The Sims 3 <3333
that game is addicting O.O I bought it 3 hr's ago, and I already am married and have 1 million $$'s
Re: [TUT]How to create a vehicle dialog menu -
Shockey - 06.09.2010
Wow already , and ty but I know how now
Re: [TUT]How to create a vehicle dialog menu -
[BC]mrblonde - 19.09.2010
Sorry but where does this go again?
if(!strcmp(cmdtext, "/vmenu", true))
{
if(!strcmp(cmdtext, "/vmenu", true))
{
ShowPlayerDialog(playerid, vmenu, DIALOG_STYLE_LIST, "Vehicle Menu", "Andromada \nDodo \nSultan \nInfernus", "Spawn", "Cancel");
return 1;
}
}
Re: [TUT]How to create a vehicle dialog menu -
Toni - 19.09.2010
Quote:
Originally Posted by [BC]mrblonde
Sorry but where does this go again?
if(!strcmp(cmdtext, "/vmenu", true))
{
ShowPlayerDialog(playerid, vmenu, DIALOG_STYLE_LIST, "Vehicle Menu", "Andromada \nDodo \nSultan \nInfernus", "Spawn", "Cancel");
return 1;
}
|
OnPlayerCommandText.
Re: [TUT]How to create a vehicle dialog menu -
ExeC - 13.11.2010
Nice

, but when i click on, for example, Infernus, it doesn't spawn anything

. Any ideas?