sscanf help
#1

//Edit: Fixed the old problem -- Onto a new one..

Why isn't this working? The parameters work correctly, and as a seperate command, the icon gets added to the file - but it doesn't seem to be working all-together for some reason.

pawn Код:
COMMAND:add(playerid, params[])
{
    new
        parameters[35],
        mapicon_id,
        mapicon_color,
        Float:MapIconX,
        Float:MapIconY,
        Float:MapIconZ,
        vModel,
        Float:VX,
        Float:VY,
        Float:VZ,
        Float:VA,
        vColor1,
        vColor2;

    if(sscanf(params, "s[35]", parameters)) {
        SendClientMessage(playerid, c_white, "[USAGE] /Add [Parameters]");
        SendClientMessage(playerid, c_orange, "[PARAMETERS] MapIcon, Vehicle, Pickup, 3DTextLabel");
        return 1;
    }
   
    if(strcmp(parameters, "MapIcon", true) == 0) { //Created by [L3th4l]
        new MType, Float:MX, Float:MY, Float:MZ, MColor;
        if(unformat(params, "ih", MType, MColor)) return SendClientMessage(playerid, c_white,"[USAGE] /AddIcon <Icon ID> <Icon Color>");
        GetPlayerPos(playerid, MX, MY, MZ);

        AddMapIconToFile(ICON_FILE_NAME, MX, MY, MZ, MType, MColor);

        for(new PID; PID < MAX_PLAYERS; PID++) if(IsPlayerConnected(PID))
        {
            CreateDynamicMapIcon(MX, MY, MZ, MType, MColor, -1, -1, -1, 100.0);
        }
        /*if(sscanf(params, "ih", mapicon_id, mapicon_color)) {
            SendClientMessage(playerid, c_white, "[USAGE] /Add MapIcon [Icon ID] [Icon Colour]");
            SendClientMessage(playerid, c_orange, "[FUNCTION] Creates a permanent Map Icon viewable by all players at your position.");
            return 1;
        }
        GetPlayerPos(playerid, MapIconX, MapIconY, MapIconZ);
        AddMapIconToFile(ICON_FILE_NAME, MapIconX, MapIconY, MapIconZ, mapicon_id, mapicon_color);
        for(new PID; PID < MAX_PLAYERS; PID++) if(IsPlayerConnected(PID))
        {
            CreateDynamicMapIcon(MapIconX, MapIconY, MapIconZ, mapicon_id, mapicon_color, -1, -1, -1, 100.0);
        }*/

        printf("[+] Pickup created at %f, %f, %f | ID: %d | Color: %h", MapIconX, MapIconY, MapIconZ, mapicon_id, mapicon_color);
        return 1;
    }
   
    else if(strcmp(parameters, "Vehicle", true) == 0) {
        if(IsPlayerInAnyVehicle(playerid)) {
            GetPlayerPos(playerid, VX, VY, VZ);
            GetVehicleZAngle(GetPlayerVehicleID(playerid), VA);
            vModel = GetVehicleModel(GetPlayerVehicleID(playerid));
            GetVehicleColor(GetPlayerVehicleID(playerid), vColor1, vColor2);
            AddVehicleToFile(VEHICLE_FILE_NAME, VX, VY, VZ, VA, vModel, vColor1, vColor2);
            printf("[+] Vehicle created at %f, %f, %f | Model: %d | Color1: %d, Color2: %d", VX, VY, VZ, vColor1, vColor2);
            return 1;
        }
    }
    return 1;
}
Command that works:

pawn Код:
CMD:addicon(playerid, params[])
{
        new MType, Float:MX, Float:MY, Float:MZ, MColor;
        if(unformat(params, "ih", MType, MColor)) return SendClientMessage(playerid, c_white,"[USAGE] /AddIcon <Icon ID> <Icon Color>");
        GetPlayerPos(playerid, MX, MY, MZ);

        AddMapIconToFile(ICON_FILE_NAME, MX, MY, MZ, MType, MColor);

        for(new PID; PID < MAX_PLAYERS; PID++) if(IsPlayerConnected(PID))
        {
            CreateDynamicMapIcon(MX, MY, MZ, MType, MColor, -1, -1, -1, 100.0);
        }
        return 1;
}
Reply


Messages In This Thread
sscanf help - by Skylar Paul - 15.04.2011, 05:43
Re: sscanf help - by Skylar Paul - 15.04.2011, 16:01
Re: sscanf help - by Max_Coldheart - 15.04.2011, 16:35
Re: sscanf help - by Skylar Paul - 15.04.2011, 18:42
Re: sscanf help - by Skylar Paul - 16.04.2011, 03:06
Re: sscanf help - by Max_Coldheart - 16.04.2011, 04:48
Re: sscanf help - by Skylar Paul - 16.04.2011, 12:25
Re: sscanf help - by playbox12 - 16.04.2011, 13:06
Re: sscanf help - by Skylar Paul - 16.04.2011, 13:14
Re: sscanf help - by playbox12 - 16.04.2011, 13:22

Forum Jump:


Users browsing this thread: 1 Guest(s)