[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
#2

This isn't tutorial.
A tutorial, is when you explain the functions that u have used, not when u just say "do this, do that".
But... nice.

Sorry my bad english.
Reply
#3

I'm sorry, but this is not really a tutorial... please explain more of your code and use [pawn ] [/pawn ] (without the spaces) instead
Reply
#4

Is it gooder now :P?
Reply
#5

No.

Code:
The message you have entered is too short. Please lengthen your message to at least 4 characters.
omg
Reply
#6

It think this will confuse more that teach. Sorry but it's a poor effort.
Try reading this before your next attempt.

https://sampforum.blast.hk/showthread.php?tid=65567
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)