24.05.2012, 00:09
pawn Код:
command(veh, playerid, params[])
{
new sCar;
new str[128];
new VehicleID;
new Float:X, Float:Y, Float:Z, Float:Ang;
new Int;
new colour1, colour2;
colour1 = 86;
colour2 = -1;
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0x66666666, "You need to be on foot to spawn a vehicle.");
if(unformat(params, "k<vehicles>DD", sCar, colour1, colour2)) return SendClientMessage(playerid, 0x66666666, "Usage: /veh(icle) [Vehicle ID / Name] [Colour 1(Optional)] [Colour 2(Optional)]");
if(sCar == -1) return SendClientMessage(playerid, 0x66666666, "That vehicle model or ID doesn't exist.");
if(colour2 == -1) return colour2 = colour1;
GetPlayerPos(playerid,X, Y, Z);
GetPlayerFacingAngle(playerid, Ang);
Int = GetPlayerInterior(playerid);
VehicleID = CreateVehicle(sCar, X, Y, Z, Ang, colour1, colour2, -1);
SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, VehicleID, 0);
LinkVehicleToInterior(VehicleID, Int);
format(str, sizeof(str), "You have spawned a: %s [ID %d]", VehicleNames[sCar - 400], sCar);
SendClientMessage(playerid, 0x66CCFFFF, str);
return 1;
}
Basically I want the colour ID of the vehicle to be 86 if no colour ID is input, and if the first colour ID is input then the second is the same colour as the first.
The script in theory should work, but it doesn't.. Any tips?