11.03.2011, 20:11
(
Last edited by bestr32; 12/03/2011 at 10:01 AM.
)
First of all. We won't need any includes :P Just a_samp.
Go to OnPlayerCommandText callback and type in:
// Don't type it :P
Than let's fill it with a dialog:
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:
Now lets add the dialog we ment:
Explains:
Go to OnPlayerCommandText callback and type in:
pawn Code:
if (strcmp("/cars", cmdtext, true) == 0)
{
return 1;
}
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
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;
}
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;
}
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