23.05.2011, 04:20
Try this:
I'm sleepy, so I might of missed some code.
Cheers.
pawn Код:
// You might need this, if so, add it onto of your gamemode
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
public OnPlayerCommandText(playerid, cmdtext[]) // Use ZCMD and save yourself from using this lines
{
dcmd(vspawn, 6, cmdtext);
return 0;
}
dcmd_vspawn(playerid, params[])
{
if(!isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /VSpawn < Vehicle ID >"); // If the player didn't typed anything after /vspawn
new
i_Vehicle = strval(params),
Float:v_Pos[4]; // We will get the player's pos and create the vehicle at that same spot.
GetPlayerPos(playerid, v_Pos[0], v_Pos[1], v_Pos[2]); // Getting X, Y, Z and storing it in v_Pos
GetPlayerFacingAngle(playerid, v_Pos[3]); // Getting the facing angle
new
iVehicle = CreateVehicle(i_Vehicle, v_Pos[0], v_Pos[1], v_Pos[2], v_Pos[3], -1, -1, (60*30)); // Create our vehicle
PutPlayerInVehicle(playerid, iVehicle, 0); // Putting the player inside the vehicle as a driver
return 1;
}
Cheers.