31.07.2011, 04:23
(
Последний раз редактировалось Shockey HD; 31.07.2011 в 06:28.
)
Hey SAMP users. Im going to show you how to create a Dialog Car Spawner and its pretty simple but it tends to take some time. Im going to start you off with the Basics of it, then you should be able to catch on. So here we go.
Im going to give you a little "Resource Table so you can grab these helpful post to help you out on this.
Vehicles
Car Colors (Optional)
ChangeVehicleColor(For Car Colors)
Okay, So lets get started
Were going to make a simple command for this.
ZCMD:
strcmp:
DCMD:
I will tell you what this does. This will get the coordinates of where you are X,Y,Z and it will get your faceing Angle.
This will create the vehicle desired and it will spawn it move you 3 time on the X axis. Then, this will put you into the vehicle.
Thanks pretty much it guys, pretty simple but great for a stunt or admin script. :]
Thanks for reading!
Im going to give you a little "Resource Table so you can grab these helpful post to help you out on this.
Vehicles
Car Colors (Optional)
ChangeVehicleColor(For Car Colors)
Okay, So lets get started
Were going to make a simple command for this.
ZCMD:
pawn Код:
CMD:spawncar(playerid,params[])
{
ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Cars:","Infernus\nElegy\nTurismo\n","Select","Cancel");
return 1;
}
pawn Код:
if(strcmp("/spawncar", cmdtext, true) == 0)
{
ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Cars:","Infernus\nElegy\nTurismo\n","Select","Cancel");
return 1;
}
pawn Код:
dcmd(spawncar,7,cmdtext);
pawn Код:
dcmd_spawncar(playerid,params[])
{
#pragma unused params
ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Cars:","Infernus\nElegy\nTurismo\n","Select","Cancel");
return 1;
}
Okay, these are the basic command. ShowPlayerDialog Is the dialog itself. It shows for the player (playerid). The Dialog ID is current 12 you can change that. and its a dialog_Style_List Format. Cars is the head of the Dialog and Infernus Elegy and Turismo are cars that we are going to add.
So, Now were going to go to OnDialogResponse.pawn Код:
if(dialogid == 12)
{
if(response == 1)
{
if(listitem == 0)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(411, x+3,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
}
if(listitem == 1)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(562, x+3,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
}
if(listitem == 2)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, a);
new vehicleid = CreateVehicle(451, x+3,y,z, a, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
}
}
}
This will create the vehicle desired and it will spawn it move you 3 time on the X axis. Then, this will put you into the vehicle.
Thanks pretty much it guys, pretty simple but great for a stunt or admin script. :]
Thanks for reading!