CMD:vc(playerid,params[])
{
new color1, color2;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"UnKnwon Command! Type /cmds");
if(sscanf(params, "dd",color1,color2)) return SendClientMessage(playerid,Red,"Change vehicle color: /vc <color1> <color2>");
if(IsPlayerInAnyVehicle(playerid))
{
ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
}
else
{
SendClientMessage(playerid,Red,"You are not in vehicle");
}
return 1;
}
Hello i have this command to change the vehicle color its work fine but i want if the player didnt type the color2 it will just change the color1 how can i do that
PHP код:
|
CMD:vc(playerid,params[])
{
new color1, color2;
new vehicle = GetPlayerVehicleID(playerid);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"UnKnwon Command! Type /cmds");
if(sscanf(params, "dd",color1,color2)) return SendClientMessage(playerid,Red,"Change vehicle color: /vc <color1> <color2>");
if(IsPlayerInAnyVehicle(playerid))
{
ChangeVehicleColor(vehicle,color1,color2);
}
else
{
SendClientMessage(playerid,Red,"You are not in vehicle");
}
return 1;
}
i want if i leave color2 emptry it will change just the first color
|
CMD:vc(playerid,params[]) { new color1 = 0, color2 = 0; new c1, c2; if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid,Red,"You are not in vehicle"); return 1; } if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"UnKnwon Command! Type /cmds"); if(sscanf(params, "dd",color1,color2)) GetVehicleColor(GetPlayerVehicleID(playerid), c1, c2); if(color2 == 0) { ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, c2); } if(color1 == 0) ChangeVehicleColor(GetPlayerVehicleID(playerid), c1, color2); } if(color1 >= 1 && color2 >= 1){ ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2); } return 1; }
CMD:vc(playerid,params[])
{
new color1, color2;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,Red,"UnKnwon Command! Type /cmds");
if(sscanf(params, "dD(-1)",color1,color2)) return SendClientMessage(playerid,Red,"Change vehicle color: /vc <color1> <color2>");
if(IsPlayerInAnyVehicle(playerid))
{
ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
}
else
{
SendClientMessage(playerid,Red,"You are not in vehicle");
}
return 1;
}