05.06.2014, 23:08
OP, you could try the custom vehicle specifier built-in the sscanf include as an example: it'll shorten your code a lot. Think something like this:
See the code of the vehicle specifier in sscanf.inc to see how it works and you'll soon be on... well, not necessarily the right track, but most certainly an easier one.
pawn Код:
new pVeh[MAX_PLAYERS];
CMD:v(playerid, params[]) {
new modelid, color[2], fPos[4];
if(sscanf(params, "k<vehicle>D(1)D(1)", modelid, color[0], color[1]))
return SendClientMessage(playerid, -1, "USAGE: /v <vehicle id/name> <optional: color1> <optional: color2>");
if(pVeh[playerid]) DestroyVehicle(pVeh[playerid]);
GetPlayerPos(playerid, fPos[0], fPos[1], fPos[2]);
GetPlayerFacingAngle(playerid, fPos[3]);
pVeh[playerid] = CreateVehicle(playerid, fPos[0], fPos[1], fPos[2], fPos[3], color[0], color[1], 0);
LinkVehicleToInterior(pVeh[playerid], GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, pVeh[playerid], 0);
return true;
}