Default Parameters (Colour issue)
#1

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;
}
The script above is a vehicle spawning script..

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?
Reply


Messages In This Thread
Default Parameters (Colour issue) - by vIBIENNYx - 24.05.2012, 00:09
Re: Default Parameters (Colour issue) - by [ABK]Antonio - 24.05.2012, 00:10
Re: Default Parameters (Colour issue) - by vIBIENNYx - 24.05.2012, 00:14
Re: Default Parameters (Colour issue) - by Jonny5 - 24.05.2012, 00:18
Re: Default Parameters (Colour issue) - by vIBIENNYx - 24.05.2012, 00:31
Re: Default Parameters (Colour issue) - by Jonny5 - 24.05.2012, 00:35
Re: Default Parameters (Colour issue) - by vIBIENNYx - 24.05.2012, 00:37
Re: Default Parameters (Colour issue) - by Jonny5 - 24.05.2012, 00:40

Forum Jump:


Users browsing this thread: 2 Guest(s)