I have created this a couple of months ago; You can use /veh [id] to create a vehicle. It puts you automaticly in the vehicle so..
Also, this will delete the old vehicle automaticly.
Код:
#include <a_samp>
#define dcmd(%1,%2,%3) \
if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new
pVehicleID[MAX_PLAYERS],
pVehCreated[MAX_PLAYERS]
;
dcmd_veh(playerid, params[])
{
if(!strlen(params)) return SendClientMessage(playerid, 0xE60000FF, "/veh [400 - 611]");
if(strval(params) < 400 || strval(params) > 611) return SendClientMessage(playerid, 0xE60000FF, "Only ID's between 400 and 611!");
new
Float: pX,
Float: pY,
Float: pZ,
Float: pA
;
GetPlayerPos(playerid, pX, pY, pZ);
if(!IsPlayerInAnyVehicle(playerid)) GetPlayerFacingAngle(playerid, pA);
else
GetVehicleZAngle(GetPlayerVehicleID(playerid), pA);
pVehCreated[playerid] = (pVehCreated[playerid] = 1) ? (DestroyVehicle(pVehicleID[playerid])) : (DestroyVehicle(pVehicleID[playerid]));
pVehicleID[playerid] = CreateVehicle(strval(params), pX, pY, pZ, pA, random(126), random(126), (30 * 60));
PutPlayerInVehicle(playerid, pVehicleID[playerid], 0);
pVehCreated[playerid] = 1;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(veh, 3, cmdtext);
return 0;
}
public OnPlayerConnect(playerid)
{
pVehCreated[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid)
{
pVehCreated[playerid] = (pVehCreated[playerid] = 1) ? (DestroyVehicle(pVehicleID[playerid])) : (DestroyVehicle(pVehicleID[playerid]));
pVehCreated[playerid] = 0;
return 1;
}
For hydra for example use: /veh 520 and you are in a hydra. Have fun
Edit: Indentitation is fucked up :S