How to make this into strcmp?
#3

Like this?

pawn Код:
new cmd[35];
    sscanf(cmdtext, "s[35]", cmd);
    if (!strcmp(cmd, "/parkingticket", true))
    {
            if(PlayerInfo[playerid][pMember] != 3)
                return SendClientMessage(playerid, COLOR_GREY, "You are not a Traffic Cop.");
            new vehicleid = GetVehicleIDNearPlayer(playerid);
            if(vehicleid == INVALID_VEHICLE) return SendClientMessage(playerid, COLOR_GREY, "No vehicles found within your range.");
            if(VehicleSanctionStats[vehicleid][Sanctioned] == true) return SendClientMessage(playerid, COLOR_GREY, "This vehicle already have a sanction");
            new sPrice, sReason[128];
            if(sscanf(cmdtext, "ds[128]", sPrice, sReason)) return SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /parkingticket [price] [reason]");
            if(sPrice < 1 || sPrice > 1500) { SendClientMessage(playerid, COLOR_GREY, "The sanction can't be below $1 or higher then $1,500."); return 1; }
            VehicleSanctionStats[vehicleid][Sanctioned] = true;
            format(VehicleSanctionStats[vehicleid][PTReason], 128, "%s", sReason);
            VehicleSanctionStats[vehicleid][PTPrice] = sPrice;
            if(IsAnOwnableCar(vehicleid))
            {
                CarInfo[VehicleOwned[vehicleid]][cPTicket] = 1;
                CarInfo[VehicleOwned[vehicleid]][cPTPrice] = VehicleSanctionStats[vehicleid][PTPrice];
                format(sReason, sizeof(sReason), VehicleSanctionStats[vehicleid][PTReason]);
                strmid(CarInfo[VehicleOwned[vehicleid]][cPTReason], sReason, 0, strlen(sReason), 255);
                SaveCars();
            }
            new str[128];
            format(str, sizeof(str), "Sanctioned: vID: %d | Price: $%d | Reason: %s", vehicleid, VehicleSanctionStats[vehicleid][PTPrice], VehicleSanctionStats[vehicleid][PTReason]);
            SendClientMessage(playerid, 0x6464FF00, str);
            format(str, sizeof(str), "* %s writes down a vehicle sanction, and places it on the %s's windshield wiper.", RemoveUnderScore(playerid),vehName[GetVehicleModel(vehicleid)-400]);
            ProxDetector(30.0, playerid, str, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

            format(str, sizeof(str), ""COL_BIZ"Vehicle Sanction\nPrice: $%d\nReason: %s",VehicleSanctionStats[vehicleid][PTPrice], VehicleSanctionStats[vehicleid][PTReason]);
            VehicleSanctionStats[vehicleid][sText3d] = Create3DTextLabel(str, COLOR_BIZ, 0.0, 0.0, 0.0, TD_DISTANCE, 0, 0);
            Attach3DTextLabelToVehicle(VehicleSanctionStats[vehicleid][sText3d], vehicleid, 0.0, 0.0, 0.0);
            return 1;
    }
Reply


Messages In This Thread
How to make this into strcmp? - by MayaEU - 10.07.2016, 00:08
Re: How to make this into strcmp? - by Gammix - 10.07.2016, 00:45
Re: How to make this into strcmp? - by MayaEU - 10.07.2016, 13:50

Forum Jump:


Users browsing this thread: 1 Guest(s)