CMD:spawncar(playerid,params[])
{
ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Cars:","Infernus\nElegy\nTurismo\n","Select","Cancel");
return 1;
}
if(strcmp("/spawncar", cmdtext, true) == 0)
{
ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Cars:","Infernus\nElegy\nTurismo\n","Select","Cancel");
return 1;
}
dcmd(spawncar,7,cmdtext);
dcmd_spawncar(playerid,params[])
{
#pragma unused params
ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Cars:","Infernus\nElegy\nTurismo\n","Select","Cancel");
return 1;
}
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);
}
}
}
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);
That code will not actually put the player in the vehicle because you are using GetVehicleID before you are putting the player in the vehicle.
You should do this: pawn Код:
![]() |
stock createVehForPlayer( playerid, vehmodel )
{
new
Float: pos[ 4 ]
;
GetPlayerPos( playerid, pos[ 0 ], pos[ 1 ], pos[ 2 ] );
GetPlayerFacingAngle( playerid, pos[ 3 ] );
new
iVeh = CreateVehicle( vehmodel, pos[ 0 ], pos[ 1 ], pos[ 2 ], pos[ 3 ], -1, -1, -1 )
;
SetVehicleVirtualWorld( iVeh, GetPlayerVirtualWorld( playerid ) );
LinkVehicleToInterior( iVeh, GetPlayerInterior( playerid ) );
PutPlayerInVehicle( playerid, iVeh, 0 );
return 1;
}
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
if ( dialogid == 12 )
{
if ( response )
{
new
iList[ ] = { 411, 562, 451 };
createVehForPlayer( playerid, iList[ listitem ] );
}
}
return 1;
}
D:\Allt\SAMP RPG\gamemodes\stunt.pwn(106) : warning 203: symbol is never used: "spawncar"
Код:
D:\Allt\SAMP RPG\gamemodes\stunt.pwn(106) : warning 203: symbol is never used: "spawncar" |
YCMD:spawncar(playerid, params[], help)
{
#pragma unused params
if (help) {SendClientMessage(playerid, 0xFFCC33AA, "/spawncar : Spawn a Car");}
else {ShowPlayerDialog(playerid,12,DIALOG_STYLE_LIST,"Cars:","Infernus\nElegy\nTurismo\n","Select","Cancel");}
return 1;
}
return 0;
}