[Tutorial] Car Menu
#1

First of all. We won't need any includes :P Just a_samp.
Go to OnPlayerCommandText callback and type in:
pawn Code:
if (strcmp("/cars", cmdtext, true) == 0)
    {
        return 1;
    }
// Don't type it :P

Than let's fill it with a dialog:
pawn Code:
if (strcmp("/cars", cmdtext, true) == 0)
    {
        ShowPlayerDialog(playerid, 110, DIALOG_STYLE_LIST, "Car Menu", "NRG-500\nAndromada\nPCJ-600\nInfernus", "Select", "Cancel");
        return 1;
    }
pawn Code:
// Add more if u wan't
Anyway enough with that let's find OnDialogResponse And define the X Y Z positions(coordinates) from the player
First define the X Y Z position:

new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid,X,Y,Z);

So it will look like this:
pawn Code:
public OnDialogResponse(playerid, dialogid, style, dunno, info, button1, button2) // Just something like this
                   {
                    new Float:X, Float:Y, Float:Z;
                    GetPlayerPos(playerid,X,Y,Z);
                    return 1;
                    }
Now lets add the dialog we ment:
pawn Code:
if(dialogid == 110 && response)
    {
                 switch(listitem)
               {
                case 0: PutPlayerInVehicle(playerid, CreateVehicle(522,X,Y,Z,0,-1,-1,-1),0); // Puting P in veh, and
            case 1: PutPlayerInVehicle(playerid, CreateVehicle(592, X, Y, Z, 0, -1, -1, -1), 0); // creating new
            case 2: PutPlayerInVehicle(playerid, CreateVehicle(461, X, Y, Z, 0, -1, -1, -1), 0); // vehicle :P
                case 3: PutPlayerInVehicle(playerid, CreateVehicle(411, X, Y, Z, 0, -1, -1, -1), 0);
            }
        return 1;
    }
Explains:
pawn Code:
new Float:X, Float:Y, Float:Z; //Here we are defining the float x float y and float z from the CreateVehicle(modelid,X, Y ,Z= From here
pawn Code:
GetPlayerPos(playerid,X,Y,Z); //This is to get the player coordinates with the new X Y and Z coords
Reply


Messages In This Thread
Car Menu - by bestr32 - 11.03.2011, 20:11
Respuesta: Car Menu - by leaNN! - 11.03.2011, 21:27
Re: Car Menu - by alpha500delta - 11.03.2011, 21:28
Re: Car Menu - by bestr32 - 12.03.2011, 09:59
Re: Car Menu - by alpha500delta - 12.03.2011, 11:07
Re: Car Menu - by Stigg - 12.03.2011, 11:09

Forum Jump:


Users browsing this thread: 1 Guest(s)