Problem with /sellgun
#1

Hello I have problem with command /sellgun when I try to sellgun its not take my materials and doesn't give weapons

Here is code:
pawn Код:
CMD:sellgun(playerid, params[])
{
    if(PlayerInfo[playerid][pJobID] == 1)
    {
        new target, weapons[28], gun, mats, string[128];
        if(sscanf(params, "us[20]", target, weapons))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Usage: /sellgun <playerid> <weapon>");
            SendClientMessage(playerid, COLOR_GREY, "Weapons: UZI(2500), AK47(1500), MP5(300)");
            SendClientMessage(playerid, COLOR_GREY, "Pistols: Colt45(100), SDpistol(150), Deagle(1000)");
            SendClientMessage(playerid, COLOR_GREY, "Gun: Shotgun(200), Spas-12(6500)");
            return 1;
        }
        if(strcmp(weapons, "uzi") == 0 && strcmp(weapons, "UZI") == 0)
        {
            if(PlayerInfo[playerid][pMaterials] > 2500)
            {
                gun = 28, mats = 2500;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials. (Materials needed: 2500)");
                return 1;
            }
        }
        if(strcmp(weapons, "ak47") == 0 && strcmp(weapons, "AK47") == 0)
        {
            if(PlayerInfo[playerid][pMaterials] > 15000)
            {
                gun = 30, mats = 400;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials. (Materials needed: 1500)");
                return 1;
            }
        }
        if(strcmp(weapons, "mp5") == 0 && strcmp(weapons, "MP5") == 0)
        {
            if(PlayerInfo[playerid][pMaterials] > 300)
            {
                gun = 29, mats = 300;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials. (Materials needed: 300)");
                return 1;
            }
        }
        if(strcmp(weapons, "colt45") == 0 && strcmp(weapons, "Colt45") == 0)
        {
            if(PlayerInfo[playerid][pMaterials] > 100)
            {
                gun = 22, mats = 100;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials. (Materials needed: 100)");
                return 1;
            }
        }
        if(strcmp(weapons, "sdpistol") == 0 && strcmp(weapons, "SDpistol") == 0)
        {
            if(PlayerInfo[playerid][pMaterials] > 150)
            {
                gun = 23, mats = 150;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials. (Materials needed: 150)");
                return 1;
            }
        }
        if(strcmp(weapons, "shotgun") == 0 && strcmp(weapons, "Shotgun") == 0)
        {
            if(PlayerInfo[playerid][pMaterials] > 200)
            {
                gun = 25, mats = 200;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials. (Materials needed: 200)");
                return 1;
            }
        }
        if(strcmp(weapons, "deagle") == 0 && strcmp(weapons, "Deagle") == 0)
        {
            if(PlayerInfo[playerid][pMaterials] > 300)
            {
                gun = 24, mats = 1000;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials. (Materials needed: 1000)");
                return 1;
            }
        }
        if(strcmp(weapons, "spas") == 0 && strcmp(weapons, "spas12") == 0)
        {
            if(PlayerInfo[playerid][pMaterials] > 6500)
            {
                gun = 27, mats = 6500;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials. (Materials needed: 6500)");
                return 1;
            }
        }
        if(ProxDetectorS(8.0, playerid, target))
        {
            if(target == playerid)
            {
                format(string, sizeof(string), "You have given yourself a %s.", weapons);
                SendClientMessage(playerid, COLOR_GREY, string);
                switch(PlayerInfo[playerid][pSex])
                {
                    case 1: format(string, sizeof(string), "* %s constructs a %s from materials and hands it to himself.", GetName(playerid), weapons);
                    case 2: format(string, sizeof(string), "* %s constructs a %s from materials and hands it to herself.", GetName(playerid), weapons);
                }
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                GivePlayerWeapon(target, gun, 50000);
                PlayerInfo[playerid][pMaterials] -= mats;
            }
            else
            {
                GivePlayerWeapon(target, gun, 50000);
                PlayerInfo[playerid][pMaterials] -= mats;
                format(string, sizeof(string), "* %s constructs a %s from materials and hands it to %s.", GetName(playerid), weapons, GetName(target));
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                format(string, sizeof(string), "%s has given you a %s", GetName(playerid), weapons);
                SendClientMessage(playerid, COLOR_GREY, string);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "This player isn't near you.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You aren't Arms Dealer");
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread
Problem with /sellgun - by RenSoprano - 10.04.2012, 12:59
Re: Problem with /sellgun - by BigD - 10.04.2012, 13:12
Re: Problem with /sellgun - by RenSoprano - 10.04.2012, 13:31
Re: Problem with /sellgun - by BigD - 10.04.2012, 13:41
Re: Problem with /sellgun - by RenSoprano - 10.04.2012, 13:55
Re: Problem with /sellgun - by BigD - 10.04.2012, 13:59
Re: Problem with /sellgun - by RenSoprano - 10.04.2012, 15:32
Re: Problem with /sellgun - by Lucian50 - 13.12.2014, 14:13

Forum Jump:


Users browsing this thread: 5 Guest(s)