SA-MP Forums Archive
Simple question: /vehcolor - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Simple question: /vehcolor (/showthread.php?tid=241949)



Simple question: /vehcolor - anumaz - 19.03.2011

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?


Re: Simple question: /vehcolor - admantis - 19.03.2011

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.