if(sscanf(params, "s[64]I(-1)I(Color1)", aVehicle, Color1, Color2)) return SendClientMessage(playerid,COLOR_ERROR, "USAGE: /veh (Vehicle Name/ID) (color) (color)");
[18:39:15] sscanf warning: Unclosed default value. [18:39:15] sscanf warning: Format specifier does not match parameter count.
if(sscanf(params, "s[64]I()I()", aVehicle, Color1, Color2)) return SendClientMessage(playerid,COLOR_ERROR, "USAGE: /veh (Vehicle Name/ID) (color) (color)");
if (sscanf(params, "s[64]ii" , aVehicle, Color1, Color2)) // The player will type color id in numbers, so numeric texts are integers.
CMD:veh(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 1) return SCM(playerid, COLOR_ERROR, ""ERROR_MESSAGE"");
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_ERROR, "You can not use this command from an vehicle");
new aVehicle[64], Color1, Color2,string[100];
if(sscanf(params, "s[64]I(-1)I(Color1)", aVehicle, Color1, Color2)) return SendClientMessage(playerid,COLOR_ERROR, "USAGE: /veh (Vehicle Name/ID) (color) (color)");
new veh = GetVehicleModelIDFromName(aVehicle);
if(veh < 400 || veh > 611) return SendClientMessage(playerid,COLOR_ERROR, "Invalid Vehicle Name.");
new Float:Pos[4];
GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]); GetPlayerFacingAngle(playerid, Pos[3]);
pVeh = cVeh = CreateStaticVehicle(VEHICLE_TYPE_CIVILIAN,veh, Pos[0], Pos[1], Pos[2]+10, Pos[3]+90, Color1, Color2);
LinkVehicleToInterior(pVeh, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(pVeh, GetPlayerVirtualWorld(playerid));
format(string,sizeof(string),"You have spawned %s - id %d with color %d - %d type normal.",VehicleNames[veh - 400],veh,Color1,Color2);
SCM(playerid,COLOR_SKYBLUE,string);
GameTextForPlayer(playerid, "~y~Enjoy your new ~r~ride", 2000, 1);
return 1;
}
Posting more code doesn't help - we already told you the issue. Yes, the errors coming from sscanf are a little cryptic, but that doesn't change the solution.
|
but that was an guess and i didn't meant to post whole code i wanted to show that it is Integer
|