Simple question: /vehcolor
#1

Hi!

This is what I have so far, though it only sets one color, not both.

pawn Код:
CMD:vehcolor( playerid, params[ ] )
{
    if ( sscanf( params, "ui", params[ 1 ], params[ 2 ] ) )
    {
        return SendClientMessage(playerid, -1, "Syntax: /vehcolor <color 1> <color 2>");
    }
    else
    {
    new stringone = params[ 1 ];
    new stringtwo = params[ 2 ];
    ChangeVehicleColor(GetPlayerVehicleID(playerid), stringone, stringtwo);
    }
    return 1;
}
What is wrong?
Reply
#2

Use new variables for easier reference. By the way, 'u' is a playerid OR a player name, not a integer.
pawn Код:
CMD:vehcolor( playerid, params[ ] )
{
    new c1, c2;
    if ( sscanf( params, "ii", c1, c2 ) )
    {
        return SendClientMessage(playerid, -1, "Syntax: /vehcolor <color 1> <color 2>");
    }
    else
    {
    ChangeVehicleColor(GetPlayerVehicleID(playerid), c1, c2);
    }
    return 1;
}
Also remember to check for invalid colors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)