I'm very nervous. This fucking sscanf gives me headaches.
I've problem with:
Код:
if(sscanf(params, "iiii", VehicleModel, Color1, Color2, Price)) return SendClientMessage(playerid, -1, "Type: /newbuycar [Model] [Color1] [Color2] [Price]");
I want to convert to strcmp (i don't understand sscanf).
Command:
Код:
if(strcmp(cmd, "/newbuycar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] != 0)
{
new CarString[128], Float:PosX, Float:PosY, Float:PosZ, Float:Angle, VehicleModel, Color1, Color2, Price, CAR;
if(PlayerInfo[playerid][pAdmin] < 1338) return SendClientMessage(playerid, -1, "Nu ai autorizatia sa folosesti aceasta comanda");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Trebuie sa fi logat ca si RCON sa creezi masini");
if(sscanf(params, "iiii", VehicleModel, Color1, Color2, Price)) return SendClientMessage(playerid, -1, "Type: /newbuycar [Model] [Color1] [Color2] [Price]");
GetPlayerPos(playerid, PosX, PosY, PosZ);
GetPlayerFacingAngle(playerid, Angle);
masinipersonale++;
PersonalCars[masinipersonale][CarModel] = VehicleModel;
PersonalCars[masinipersonale][CarPosX] = PosX;
PersonalCars[masinipersonale][CarPosY] = PosY;
PersonalCars[masinipersonale][CarPosZ] = PosZ;
PersonalCars[masinipersonale][CarAngle] = Angle;
PersonalCars[masinipersonale][CarColor1] = Color1;
PersonalCars[masinipersonale][CarColor2] = Color2;
PersonalCars[masinipersonale][CarPret] = Price;
PersonalCars[masinipersonale][CarPaintjob] = 255;
PersonalCars[masinipersonale][CarExploded] = 0;
strmid(PersonalCars[masinipersonale][CarOwner],"The State", 0, strlen("The State"), 128);
CAR = CreateVehicle(PersonalCars[masinipersonale][CarModel], PersonalCars[masinipersonale][CarPosX], PersonalCars[masinipersonale][CarPosY], PersonalCars[masinipersonale][CarPosZ], PersonalCars[masinipersonale][CarAngle], PersonalCars[masinipersonale][CarColor1], PersonalCars[masinipersonale][CarColor2], -1);
IDIS[CAR] = masinipersonale;
format(CarString, sizeof(CarString), "Aceasta masina este de vanzare. Pret: %s",PersonalCars[masinipersonale][CarPret], ".");
PersonalCars[masinipersonale][CarText] = Create3DTextLabel(CarString, -1, 0, 0, 0, 25, 0, 1);
Attach3DTextLabelToVehicle(PersonalCars[masinipersonale][CarText], CAR, 0.0, 0.0, 0.1);
SetVehicleNumberPlate(CAR, PersonalCars[GetCreatorID(masinipersonale)][CarOwner]);
SavePersonalCar();
}
else return SendClientMessage(playerid, -1, "Nu esti conectat !");
}
return 1;
}
Thanks. I will rep your help!