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
#2

Youve got to do
pawn Код:
if(PlayerInfo[playerid][pMaterials] > 100)
}
PlayerInfo[Target][pMaterials] =+ 2500;
GivePlayerWeapon(playerid, 28);
ect
Reply
#3

Didn't work
Reply
#4

pawn Код:
CMD:sellgun(playerid, params[])
{
    new weapon;

    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)
            {
               PlayerInfo[target][pMaterials] += 2500;
               GivePlayerWeapon(target, weapon, 28);

            }
            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)
            {
               PlayerInfo[target][pMaterials] += 15000;
               GivePlayerWeapon(target, weapon, 30);
            }
            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)
            {
                PlayerInfo[target][pMaterials] += 300
                GivePlayerWeapon(target, weapon, 29);
            }
            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)
            {
                 PlayerInfo[target][pMaterials] += 100;
                GivePlayerWeapon(target, weapon, 22);
            }
            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)
            {
                PlayerInfo[target][pMaterials] += 150;
                GivePlayerWeapon(target, weapon, 23);
            }
            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)
            {
                 PlayerInfo[target][pMaterials] += 200;
                GivePlayerWeapon(target, weapon, 25);;
            }
            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)
            {
                 PlayerInfo[target][pMaterials] += 1000;
                GivePlayerWeapon(target, weapon, 24);
            }
            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)
            {
                 PlayerInfo[target][pMaterials] += 6500;
                GivePlayerWeapon(target, weapon, 27);
            }
            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;
}
Try that.
Reply
#5

Without error in Pawn but when I go in game and I try to give me weapon but didn't work look this image

Reply
#6

Remove the "GivePlayerWeapon(playerid, gun, ect)
Reply
#7

Didn't work man please I need help
Reply
#8

CMDellgun(playerid, params[])
{
new weapon;

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)
{
PlayerInfo[target][pMaterials] += 2500;
GivePlayerWeapon(target, weapon, 2;

}
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)
{
PlayerInfo[target][pMaterials] += 15000;
GivePlayerWeapon(target, weapon, 30);
}
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)
{
PlayerInfo[target][pMaterials] += 300
GivePlayerWeapon(target, weapon, 29);
}
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)
{
PlayerInfo[target][pMaterials] += 100;
GivePlayerWeapon(target, weapon, 22);
}
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)
{
PlayerInfo[target][pMaterials] += 150;
GivePlayerWeapon(target, weapon, 23);
}
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)
{
PlayerInfo[target][pMaterials] += 200;
GivePlayerWeapon(target, weapon, 25);;
}
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)
{
PlayerInfo[target][pMaterials] += 1000;
GivePlayerWeapon(target, weapon, 24);
}
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)
{
PlayerInfo[target][pMaterials] += 6500;
GivePlayerWeapon(target, weapon, 27);
}
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_PURPL E,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_PURPL E,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


Forum Jump:


Users browsing this thread: 1 Guest(s)