Using ZCMD:
pawn Код:
CMD:car(playerid,params[])
{
new vID[32],modelid,color1,color2;
if(sscanf(params,"s[128]dd",vID,color1,color2)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /car <vehiclename/id> <color1> <color2>");
if(IsNumeric(vID)) modelid = strval(vID);
else modelid = GetVehicleModelIDFromName(vID);
if(modelid < 400 || modelid > 611) return SendClientMessage(playerid,COLOR_RED, "Invalid Vehiclename/ID!");
new Float:pVposX, Float:pVposY, Float:pVposZ, Float:pVposFA;
GetPlayerPos(playerid, pVposX, pVposY, pVposZ);
GetPlayerFacingAngle(playerid, pVposFA);
if(IsPlayerInAnyVehicle(playerid))
{
new VID = GetPlayerVehicleID(playerid);
GetVehicleZAngle(VID, pVposFA);
}
new CVID, pVW, pINT;
pVW = GetPlayerVirtualWorld(playerid);
pINT = GetPlayerInterior(playerid);
CVID = CreateVehicle(modelid, pVposX, pVposY, pVposZ+0.6, pVposFA,color1,color2,0);
SetVehicleVirtualWorld(CVID, pVW);
LinkVehicleToInterior(CVID, pINT);
PutPlayerInVehicle(playerid,CVID,0);
new string[128];
format(string,sizeof string,"VEHICLE: "yellow"%s (model id: %i) "green"has been spawned!",VehicleNames[modelid-400],modelid);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}