Please help, something regarding the vehicle colors.
#1

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
Reply
#2

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.
Reply
#3

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

Thanks, appreciated
Reply
#4

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.
Reply
#5

I got this error

undefined symbol "sscanf"
Reply
#6

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

undefined symbol "sscanf"
get it here
Reply
#7

sorry, i dont understand?
Reply
#8

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;
}
Reply
#9

Код:
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"
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)