My /sellgun cmd not working properly
#1

pawn Код:
dcmd_sellgun(playerid, params[])
{
    new giveplayerid, string[128];
    if(PlayerInfo[playerid][pJob] != 9)
    {
        SendClientMessage(playerid, -1, "You're not a gun dealer!");
        return 1;
    }
    if(sscanf(params,"us[128]", giveplayerid, string))
    {
        new skill = PlayerInfo[playerid][pArmsSkill];
        if(skill >= 0 && skill <= 49)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------|Available Weapons|----------------»");
            SendClientMessage(playerid, COLOR_WHITE, "Weapons-:                 | Items-:");
            SendClientMessage(playerid, COLOR_GRAD3, "SDPistol - [200 Gun Part] | Brass Knuckles - [25 Gun Part]");
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------------------------------------------»");
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid] [weapon]");
        }
        else if(skill >= 50 && skill <= 99)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------|Available Weapons|----------------»");
            SendClientMessage(playerid, COLOR_WHITE, "Weapons-:                 | Items-:");
            SendClientMessage(playerid, COLOR_GRAD3, "SDPistol - [200 Gun Part] | Brass knuckles - [25 Gun Part]");
            SendClientMessage(playerid, COLOR_GRAD3, "Shotgun - [350 Gun Part]  | Baseball Bat - [25 Gun Part]");
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------------------------------------------»");
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid] [weapon]");
        }
        else if(skill >= 100 && skill <= 199)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------|Available Weapons|----------------»");
            SendClientMessage(playerid, COLOR_GRAD3, "Weapons-:                 | Items-:");
            SendClientMessage(playerid, COLOR_GRAD3, "SDPistol - [200 Gun Part] | Brass Knuckles - [25 Gun Part]");
            SendClientMessage(playerid, COLOR_GRAD3, "Shotgun - [350 Gun Part]  | Baseball Bat - [25 Gun Part]");
            SendClientMessage(playerid, COLOR_GRAD3, "MP5 - [700 Gun Part]      | No New Items Avaliable");
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------------------------------------------»");
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid] [weapon]");
        }
        else if(skill >= 200 && skill <= 399)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------|Available Weapons|----------------»");
            SendClientMessage(playerid, COLOR_WHITE, "Weapons-:                 | Items:");
            SendClientMessage(playerid, COLOR_GRAD3, "SDPistol -  [200 Gun Part | Brass knuckles (25)");
            SendClientMessage(playerid, COLOR_GRAD3, "Shotgun - [350 Gun Part]  | Baseball Bat (25)");
            SendClientMessage(playerid, COLOR_GRAD3, "Mp5 - [700 Gun Part]      | No New Items Avaliable");
            SendClientMessage(playerid, COLOR_GRAD3, "Ak 47 - [1350 Gun Part]   | No New Items Avaliable");
            SendClientMessage(playerid, COLOR_GRAD3, "M4A1 - [1500 Gun Part]    | No New Items Avaliable");
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------------------------------------------»");
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid] [weapon]");
        }
        else if(skill >= 400)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------|Available Weapons|----------------»");
            SendClientMessage(playerid, COLOR_WHITE, "Weapons-:                 | Items:");
            SendClientMessage(playerid, COLOR_GRAD3, "SDPistol - [200 Gun Part] | Brass knuckles (25)");
            SendClientMessage(playerid, COLOR_GRAD3, "Shotgun - [350 Gun Part]  | Baseball Bat (25)");
            SendClientMessage(playerid, COLOR_GRAD3, "Mp5 - [700 Gun Part]      | No New Items Avaliable");
            SendClientMessage(playerid, COLOR_GRAD3, "Ak47 - [1350 Gun Part]    | No New Items Avaliable");
            SendClientMessage(playerid, COLOR_GRAD3, "M4A1 - [1500 Gun Part]    | No New Items Avaliable");
            SendClientMessage(playerid, COLOR_GRAD3, "Spas12 - [3000 Gun Part]  | No New Items Avaliable");
            SendClientMessage(playerid, COLOR_YELLOW, "«----------------------------------------------------»");
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid] [weapon]");
        }
        if(SellGunTimer[playerid]) return SendClientMessage(playerid,COLOR_GREY,"   You must wait 10 seconds before selling another weapon !");
        new weapon,price,loggun;
        if(strcmp(string,"SDPistol",true) == 0)
        {
            if(PlayerInfo[playerid][pMats] > 199)
            {
                weapon = 23;
                price = 200;
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"   Not enough Gun parts for that Weapon !");
                return 1;
            }
        }
        else if(strcmp(string,"MP5",true) == 0)
        {
            if(PlayerInfo[playerid][pMats] > 699)
            {
                weapon = 29;
                price = 700;
            }
            else
            {
                SendClientMessage(playerid,COLOR_GREY,"   Not enough Gun parts for that Weapon !");
                return 1;
            }
        }
        else if(strcmp(string,"Brass Knuckles",true) == 0) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 1; price = 25; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Gun parts for that Weapon !"); return 1; } }
        else if(strcmp(string,"M4A1",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 200) { if(PlayerInfo[playerid][pMats] > 1499) { weapon = 31; price = 1500; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Gun parts for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY,"   You are not the required level to create that !"); return 1; } }
        else if(strcmp(string,"Ak47",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 200) { if(PlayerInfo[playerid][pMats] > 1349) { weapon = 30; price = 1350; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Gun parts for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY,"   You are not the required level to create that !"); return 1; } }
        else if(strcmp(string,"Shotgun",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 50) { if(PlayerInfo[playerid][pMats] > 349) { weapon = 25; price = 350; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Gun parts for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY,"   You are not the required level to create that !"); return 1; } }
        else if(strcmp(string,"Baseball Bat",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 50) { if(PlayerInfo[playerid][pMats] > 24) { weapon = 5; price = 25; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Gun parts for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY,"   You are not the required level to create that !"); return 1; } }
        else if(strcmp(string,"Spas12",true) == 0) { new level = PlayerInfo[playerid][pArmsSkill]; if(level >= 400) { if(PlayerInfo[playerid][pMats] > 2999) { weapon = 27; price = 3000; } else { SendClientMessage(playerid,COLOR_GREY,"   Not enough Gun parts for that Weapon !"); return 1; } } else { SendClientMessage(playerid,COLOR_GREY,"   You are not the required level to create that !"); return 1; } }
        else { SendClientMessage(playerid,COLOR_GREY,"   Invalid weapon name !"); return 1; }
        if(weapon==28||weapon==29||weapon==32||weapon==30||weapon==24||weapon==33||weapon==29||weapon==25||weapon==23)
        {
            if(weapon != 23 || weapon != 29)
            {
                loggun = 1;
            }
            PlayerInfo[playerid][pArmsSkill] ++;
        }
        new sendername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
        format(string, sizeof(string), "Created Weapon Stats - Kind : %s | Ammo : unlimited.", string);
        PlayerInfo[playerid][pMats] += 25;
        SendClientMessage(playerid, COLOR_GRAD1, string);
        format(string, sizeof(string), "%s assembles a weapon from their gun parts.", sendername);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        if(weapon != 0)
        {
            GivePlayerGun(giveplayerid, weapon);
        }
        if(loggun == 1)
        {
            format(string, sizeof(string), "%s has made a %s", sendername,string);
            PayLog(string);
        }
        PlayerInfo[playerid][pMats] -= price;
        SellGunTimer[playerid] = 1;
        SetTimerEx("SellGun",10*1000,0,"i",playerid);
        if(PlayerInfo[playerid][pArmsSkill] == 25)
        { SendClientMessage(playerid, COLOR_WHITE, "Stranger Says : Alright, I'll teach you to make some new firearms today."); }
        else if(PlayerInfo[playerid][pArmsSkill] == 50)
        { SendClientMessage(playerid, COLOR_WHITE, "Stranger Says : Okay, you're ready to make some new weaponry."); }
        else if(PlayerInfo[playerid][pArmsSkill] == 100)
        { SendClientMessage(playerid, COLOR_WHITE, "Stranger Says : Time to learn to make some new guns."); }
        else if(PlayerInfo[playerid][pArmsSkill] == 200)
        { SendClientMessage(playerid, COLOR_WHITE, "Stranger Says : I think you're ready to make some high-powered shit."); }
    }
    return 1;
}
The problem is. when i type /sellgun without completing the parameters ingame, it gives me SDPistol immediatly instead of printing the gun dealer menu which is in my skill level and show the correct usage and weapons.
Reply
#2

Bump.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)