SA-MP Forums Archive
Please help, something regarding the vehicle colors. - 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)
+--- Thread: Please help, something regarding the vehicle colors. (/showthread.php?tid=536864)



Please help, something regarding the vehicle colors. - Biggy54 - 12.09.2014

Alright, I want to create a command to change the vehicle's first/second color.

Example: /vcolor [color1][color2]
/vcolor [1] [2]

this should change the vehicle's first color to 1 and second color to 2
Thanks, please help.
Note:Click on the below link for a list of the SA:MP vehicle colors.
SA:MP vehicle colors


Re: Please help, something regarding the vehicle colors. - SanAndreasMP - 12.09.2014

pawn Код:
CMD:vehcolor(playerid, params[])
{
      new
             col1, col2; // assigning variables
      if(sscanf(params, "ii" col1, col2)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage : /vehcolor (col1) (col2)"); // I hope you get this
       ChangeVehicleColor(GetPlayerVehicleID(playerid), col1, col2); // Changing the color as per the player's choice.
      return true;
}
This is very simple command, so i hope no explanation is needed.


EDIT : i forgot col1 and col2. Added.


Re: Please help, something regarding the vehicle colors. - Biggy54 - 12.09.2014

Can you please create another one for me, but not using ZCMD i only use a_samp

Thanks, appreciated


Re: Please help, something regarding the vehicle colors. - SanAndreasMP - 12.09.2014

There you go.


pawn Код:
if(strcmp(cmdtext, "/vehcolor", true) == 0)
{
     new
           col1, col2;
     if(sscanf(params, "ii", col1, col2)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage : /vehcol [col1] [col2]");
      ChangeVehicleColor(GetPlayerVehicleID(playerid), col1, col2);
     return true;
}
I've never worked with a_samp commabd function. So i don't know if sscanf is usable in it or not. Correct me if I'm wrong.


Re: Please help, something regarding the vehicle colors. - Biggy54 - 12.09.2014

I got this error

undefined symbol "sscanf"


Re: Please help, something regarding the vehicle colors. - CutX - 12.09.2014

Quote:
Originally Posted by Biggy54
Посмотреть сообщение
I got this error

undefined symbol "sscanf"
get it here


Re: Please help, something regarding the vehicle colors. - Biggy54 - 12.09.2014

sorry, i dont understand?


Re : Please help, something regarding the vehicle colors. - Chipardeur - 12.09.2014

pawn Код:
if(strcmp(cmd, "/vcolor", true) == 0)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new color1, color2;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor >color1< >color2<");
        color1 = strval(tmp);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor >color1< >color2<");
        color2 = strval(tmp);
        ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
    }
    else
    {
        SendClientMessage(playerid, -1, "You're not in a vehicle.");
    }
    return 1;
}



Re: Please help, something regarding the vehicle colors. - Biggy54 - 12.09.2014

Код:
error 017: undefined symbol "cmd"
 error 017: undefined symbol "tmp"
 error 017: undefined symbol "strtok"
 error 017: undefined symbol "tmp"
 error 017: undefined symbol "tmp"
 error 017: undefined symbol "tmp"
 error 017: undefined symbol "strtok"
 error 017: undefined symbol "tmp"
error 017: undefined symbol "tmp"



Re: Please help, something regarding the vehicle colors. - KayJ - 13.09.2014

pawn Код:
if(!strcmp(cmdtext,"/carcolor",true,9)==0)
{
  new tmp[24],tmp2[24],Index, color1,color2;
  if(!IsPlayerInAnyVehicle(playerid) return SendClientMessage(playerid,oxffffffaa,"You mst be in car to use this command");
  if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid,0xffffffaa,"Usage: /carcolor color1 color2");
  tmp=strtok(cmdtext,Index);
  tmp2=strtok(cmdtext,Index);

  color1=strval(tmp);
  color2=strval(tmp2);

  ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
  return 1;
}