sscanf problem..
#10

pawn Код:
CMD:confiscate(playerid, params[])
{
    if(IsACop(playerid))
    {
        new item[32],string[128], sendername[MAX_PLAYER_NAME], house;
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params,"s[32]", item))
        {
            SCM(playerid, COLOR_GREY, "USAGE: /confiscate [item]");
            SCM(playerid, COLOR_GREY,"Available items: drugs, mats, weapon, weapon2, weapon3, weapon4");
        }
        else
        {
            if(!strcmp(item, "drugs", true))
            {
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    HouseInfo[house][hDrugs] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects drugs.", sendername); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects drugs.", sendername); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate drugs",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "mats", true))
            {
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    HouseInfo[house][hMaterials] = 0;
                    if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects materials.", sendername); }
                    else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects materials.", sendername); }
                    Prox(5.0, playerid, string, COLOR_CHAT1);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate mats",d,m,y1,h,mi,s,sendername);
                    CommandLog(string);
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "weapon", true))
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon1];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon1] != 0)
                    {
                        HouseInfo[house][hAmmo1] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "weapon2", true))
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon2];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon2] != 0)
                    {
                        HouseInfo[house][hAmmo2] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon2",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "weapon3", true))
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon3];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon3] != 0)
                    {
                        HouseInfo[house][hAmmo3] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon3",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
            else if(!strcmp(item, "weapon4", true))
            {
                new gunname[24];
                new weapon = HouseInfo[house][hWeapon4];
                GetWeaponName(weapon,gunname, sizeof(gunname));
                if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
                {
                    if(HouseInfo[house][hWeapon4] != 0)
                    {
                        HouseInfo[house][hAmmo4] = 0;
                        if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        else { format(string, sizeof(string), " Law Enforcer %s confiscates the suspects %s.", sendername,gunname); }
                        Prox(5.0, playerid, string, COLOR_CHAT1);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /confiscate weapon4",d,m,y1,h,mi,s,sendername);
                        CommandLog(string);
                    }
                    else return SCM(playerid, COLOR_GREY," There is nothing on this slot!");
                }
                else return SCM(playerid, COLOR_GREY," You're not at any House!");
            }
    }
    else return SCM(playerid, COLOR_GREY, "You are not a Law member!");
    return 1;
}
EDIT: If you still have issues with it, I could probably re-do this command but not this way. It is using too much else return statements.
Reply


Messages In This Thread
sscanf problem.. - by Don_Cage - 02.02.2014, 08:07
Re: sscanf problem.. - by CuervO - 02.02.2014, 08:20
Re: sscanf problem.. - by Don_Cage - 02.02.2014, 08:25
Re: sscanf problem.. - by CuervO - 02.02.2014, 08:28
Re: sscanf problem.. - by PAF - 02.02.2014, 08:54
Re: sscanf problem.. - by iZN - 02.02.2014, 09:00
Re: sscanf problem.. - by Don_Cage - 02.02.2014, 09:13
Re: sscanf problem.. - by iZN - 02.02.2014, 09:25
Re: sscanf problem.. - by Don_Cage - 02.02.2014, 09:40
Re: sscanf problem.. - by iZN - 02.02.2014, 09:59

Forum Jump:


Users browsing this thread: 1 Guest(s)