if (strcmp(cmdtext,"/va",true) ==0) { ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Adm in cars","1. Sultan\r\n2. NRG\r\n3. Infernus\r\n4. Buffalo","Valider", "Annuler"); return 1; } |
switch(dialogid) // Lookup the dialogid { case 1: { switch(listitem) // This is far more efficient than using an if-elseif-else structure { case 0: // Listitems start with 0, not 1 { new Float:X,Float:Y,Float:Z,Float:Angle; new veh; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); veh = CreateVehicle(560,X,Y,Z,Angle,158,1,-0); PutPlayerInVehicle(playerid,veh, 0); } case 1: { new Float:X,Float:Y,Float:Z,Float:Angle; new veh; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); veh = CreateVehicle(522,X,Y,Z,Angle,158,1,-0); PutPlayerInVehicle(playerid,veh, 0); } case 2: { new Float:X,Float:Y,Float:Z,Float:Angle; new veh; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); veh = CreateVehicle(411,X,Y,Z,Angle,158,1,-0); PutPlayerInVehicle(playerid,veh, 0); } case 3: { new Float:X,Float:Y,Float:Z,Float:Angle; new veh; GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle); veh = CreateVehicle(402,X,Y,Z,Angle,158,1,-0); PutPlayerInVehicle(playerid,veh, 0); } // Add the rest of your listitems for dialog 1 here } } // Add the rest of your dialogs here } |
switch(dialogid) // Lookup the dialogid
{
case 1:
{
if(response)
{
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
if(dialogid == DIALOG_VEHICLES)
{
new Float:x,Float:y,Float:z;
if(response == 1)// They pressed the first button.
{
switch(listitem)// Checking which listitem was selected
{
case 0:// Elegy - First item in the Dialog
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(562,x+3.0,y,z,0,-1,-1,5);
}
case 1: //Sultan - Second Item in the Dialog
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(560,x+3.0,y,z,0,-1,-1,5);
}
case 2://Infernus - Third Item in the Dialog
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(411,x+3.0,y,z,0,-1,-1,5);
}
case 3://Turismo - Fourth Item in the Dialog
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(451,x+3.0,y,z,0,-1,-1,5);
}
case 4://Hotring - Fifth Item in the Dialog
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(494,x+3.0,y,z,0,-1,-1,5);
}
case 5://Hotring A - Sixth Item in the Dialog
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(502,x+3.0,y,z,0,-1,-1,5);
}
case 6://Hotring B - Seventh Item in the Dialog
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(503,x+3.0,y,z,0,-1,-1,5);
}
case 7://NRG - Eigth Item in the Dialog
{
GetPlayerPos(playerid,x,y,z);
CreateVehicle(522,x+3.0,y,z,0,-1,-1,5);
}
}
}
}
Heres my vehicle dialog from my blank gamemode I made.
pawn Код:
|