Help with a /sellgun command
#1

Look at this cmd

Код:
dcmd_sellgun(playerid, params[])
{
  new pName[24], PlayerFile[50], Buyer, Weapon, BuyerName[24], str[128], str2[256];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(PlayerFile, sizeof(PlayerFile), "/LVRP/users/%s.ini", pName);
	
	if(PlayerInfo[playerid][Job] != 1) return 1;
 	if(sscanf(params, "us",Buyer,Weapon)) return SCM(playerid, COLOR_WHITE, "Usage: /sellgun [playerid/Partofname]");
 	if(!IsPlayerConnected(Buyer)) return SendClientMessage(playerid, COLOR_RED, "They are not online.");
 	GetPlayerName(Buyer,BuyerName, sizeof(BuyerName));
 	
 	if(PlayerInfo[playerid][GunLevel] >= 1)
 	{
179	  if(Weapon == shotgun)
 	  {
 	    GivePlayerWeapon(Buyer, 25, 300000);
 	    format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
 	    format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
 	    SCM(playerid, COLOR_WHITE, str);
 	    SCM(Buyer, COLOR_WHITE, str2);
		}
	}
	return 1;
}
error:

Код:
C:\Users\Administrator\Documents\SA-MP Server\filterscripts\Jobs.pwn(179) : error 017: undefined symbol "shotgun"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Please help
Reply
#2

Код:
new shotgun = 27;
Reply
#3

Thank you
It worked.
Reply
#4

Actually it won't work IG, because there is nothing there that determines which gun you are selling, therefore you should PROBABLY put (instead of if(shotgun..)

pawn Код:
if(GetPlayerWeapon(playerid) == 25)
Reply
#5

Ok ive enlarged it ive fixed everything kinda now it wont work cuz your too low a level, in my file im lvl 3

Код:
dcmd_sellgun(playerid, params[])
{
  new pName[24], PlayerFile[50], Buyer, Weapon, BuyerName[24], str[128], str2[256];
	GetPlayerName(playerid, pName, sizeof(pName));
	format(PlayerFile, sizeof(PlayerFile), "/LVRP/users/%s.ini", pName);
	
	new shotgun = 25;
	new colt = 22;
	new silencer = 23;
	new bat = 5;
	new brassknuckles = 1;
	new MP5 = 29;
	new Tec9 = 32;
	new Uzi = 28;
	new M4 = 31;
	new AK47 = 30;
	new rifle = 33;
	new SPAS12 = 27;
	new sniper = 34;
	
	if(PlayerInfo[playerid][Job] != 1) return 1;
 	if(sscanf(params, "ds",Buyer,Weapon)) return SCM(playerid, COLOR_WHITE, "Usage: /sellgun [playerid/Partofname] [Weapon name]");
 	if(IsPlayerConnected(Buyer)) return SendClientMessage(playerid, COLOR_RED, "They are not online.");
 	
 	GetPlayerName(Buyer,BuyerName, sizeof(BuyerName));

	if(PlayerInfo[playerid][GunLevel] <= 1) return SCM(playerid, COLOR_RED, "You are not high enough level.");
 	if(Weapon == shotgun)
 	{
 	if(PlayerInfo[playerid][Mats] < 400) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
 	GivePlayerWeapon(Buyer, shotgun, 300000);
 	format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
 	format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
 	PlayerInfo[playerid][GunSold] ++;
 	dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
 	PlayerInfo[playerid][Mats] -= 400;
 	dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
 	SCM(playerid, COLOR_WHITE, str);
 	SCM(Buyer, COLOR_WHITE, str2);
	}
	if(Weapon == colt)
 	{
 	if(PlayerInfo[playerid][Mats] < 250) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
 	GivePlayerWeapon(Buyer, colt, 300000);
 	format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
  	format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
 	PlayerInfo[playerid][GunSold] ++;
 	dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
 	PlayerInfo[playerid][Mats] -= 250;
 	dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
 	SCM(playerid, COLOR_WHITE, str);
 	SCM(Buyer, COLOR_WHITE, str2);
	}
	if(Weapon == silencer)
 	{
 	if(PlayerInfo[playerid][Mats] < 300) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
 	GivePlayerWeapon(Buyer, silencer, 300000);
 	format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
 	format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
 	PlayerInfo[playerid][GunSold] ++;
 	dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
 	PlayerInfo[playerid][Mats] -= 300;
 	dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
 	SCM(playerid, COLOR_WHITE, str);
 	SCM(Buyer, COLOR_WHITE, str2);
 	}
	if(Weapon == brassknuckles)
  {
  if(PlayerInfo[playerid][Mats] < 75) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, brassknuckles, 300000);
  format(str, sizeof str, "You gave %s to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived %s from %s.", Weapon, pName);
  PlayerInfo[playerid][Mats] -= 75;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}
	if(Weapon == bat)
  {
  if(PlayerInfo[playerid][Mats] < 75) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, bat, 300000);
  format(str, sizeof str, "You gave a %s to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s from %s.", Weapon, pName);
  PlayerInfo[playerid][Mats] -= 75;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}
	if(PlayerInfo[playerid][GunLevel] <= 2) return SCM(playerid, COLOR_RED, "You are not high enough level.");
  if(Weapon == Tec9)
  {
  if(PlayerInfo[playerid][Mats] < 1500) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, Tec9, 300000);
  format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 1500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}
	if(Weapon == Uzi)
  {
  if(PlayerInfo[playerid][Mats] < 1500) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, Uzi, 300000);
  format(str, sizeof str, "You gave an %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived an %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 1500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}
	if(Weapon == MP5)
  {
  if(PlayerInfo[playerid][Mats] < 2000) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, MP5, 300000);
  format(str, sizeof str, "You gave an %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived an %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 2000;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}
  	if(PlayerInfo[playerid][GunLevel] <= 3) return SCM(playerid, COLOR_RED, "You are not high enough level.");
  if(Weapon == rifle)
  {
  if(PlayerInfo[playerid][Mats] < 2500) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, rifle, 300000);
  format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 2500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}
	if(Weapon == M4)
 	{
 	if(PlayerInfo[playerid][Mats] < 6500) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
 	GivePlayerWeapon(Buyer, M4, 300000);
 	format(str, sizeof str, "You gave an %s and ammo to %s.", Weapon, Buyer);
 	format(str2, sizeof str2, "You recived an %s and ammo from %s.", Weapon, pName);
	PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 6500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}
	if(Weapon == AK47)
  {
  if(PlayerInfo[playerid][Mats] < 6000) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, AK47, 300000);
  format(str, sizeof str, "You gave an %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived an %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 2500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}
	if(PlayerInfo[playerid][GunLevel] <= 4)
  if(Weapon == SPAS12)
  {
  if(PlayerInfo[playerid][Mats] < 8000) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, SPAS12, 300000);
  format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 8000;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}
	if(Weapon == sniper)
  {
  if(PlayerInfo[playerid][Mats] < 8000) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, sniper, 300000);
  format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 8000;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
	}

	if(PlayerInfo[playerid][GunSold] == 50)
	{
	  if(PlayerInfo[playerid][GunLevel] != 1) return 1;
	  PlayerInfo[playerid][GunLevel] = 2;
	  PlayerInfo[playerid][GunSold] = 0;
	  SCM(playerid, COLOR_GREEN, "Congradulation, you are now a level 2 Gun Dealer.");
	}
	if(PlayerInfo[playerid][GunSold] == 75)
	{
	  if(PlayerInfo[playerid][GunLevel] != 2) return 1;
	  PlayerInfo[playerid][GunLevel] = 3;
	  PlayerInfo[playerid][GunSold] = 0;
	  SCM(playerid, COLOR_GREEN, "Congradulation, you are now a level 3 Gun Dealer.");
	}
	if(PlayerInfo[playerid][GunSold] == 150)
	{
	  if(PlayerInfo[playerid][GunLevel] != 3) return 1;
	  PlayerInfo[playerid][GunLevel] = 4;
	  SCM(playerid, COLOR_GREEN, "Congradulation, you are now a level 4 Gun Dealer.");
	}
	return 1;
}
sorry for it being messy i tried so many things......
Reply
#6

Change

Код:
if(PlayerInfo[playerid][GunLevel] >= 1) return SCM(playerid, COLOR_RED, "You are not high enough level.");
to

Код:
if(PlayerInfo[playerid][GunLevel] <= 1) return SCM(playerid, COLOR_RED, "You are not high enough level.");
Reply
#7

I did the change but it still says level not high enough. What else could I do?
Reply
#8

Which gun are you trying to sell?
Reply
#9

all of them, depending on which they say eg:

/sellgun [id] shotgun

or

/sellgun [id] MP5

then it gives them that gun at gives both players that message.
Reply
#10

I read over.. this should fix it

pawn Код:
dcmd_sellgun(playerid, params[])
{
  new pName[24], PlayerFile[50], Buyer, Weapon, BuyerName[24], str[128], str2[256];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(PlayerFile, sizeof(PlayerFile), "/LVRP/users/%s.ini", pName);
   
    new shotgun = 25;
    new colt = 22;
    new silencer = 23;
    new bat = 5;
    new brassknuckles = 1;
    new MP5 = 29;
    new Tec9 = 32;
    new Uzi = 28;
    new M4 = 31;
    new AK47 = 30;
    new rifle = 33;
    new SPAS12 = 27;
    new sniper = 34;
   
    if(PlayerInfo[playerid][Job] != 1) return 1;
    if(sscanf(params, "ds",Buyer,Weapon)) return SCM(playerid, COLOR_WHITE, "Usage: /sellgun [playerid/Partofname] [Weapon name]");
    if(IsPlayerConnected(Buyer)) return SendClientMessage(playerid, COLOR_RED, "They are not online.");
   
    GetPlayerName(Buyer,BuyerName, sizeof(BuyerName));

    if(PlayerInfo[playerid][GunLevel] < 3) return SCM(playerid, COLOR_RED, "You are not high enough level.");
    if(Weapon == shotgun)
    {
    if(PlayerInfo[playerid][Mats] < 400) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
    GivePlayerWeapon(Buyer, shotgun, 300000);
    format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
    format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
    PlayerInfo[playerid][GunSold] ++;
    dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
    PlayerInfo[playerid][Mats] -= 400;
    dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
    SCM(playerid, COLOR_WHITE, str);
    SCM(Buyer, COLOR_WHITE, str2);
    }
    if(Weapon == colt)
    {
    if(PlayerInfo[playerid][Mats] < 250) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
    GivePlayerWeapon(Buyer, colt, 300000);
    format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
    format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
    PlayerInfo[playerid][GunSold] ++;
    dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
    PlayerInfo[playerid][Mats] -= 250;
    dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
    SCM(playerid, COLOR_WHITE, str);
    SCM(Buyer, COLOR_WHITE, str2);
    }
    if(Weapon == silencer)
    {
    if(PlayerInfo[playerid][Mats] < 300) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
    GivePlayerWeapon(Buyer, silencer, 300000);
    format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
    format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
    PlayerInfo[playerid][GunSold] ++;
    dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
    PlayerInfo[playerid][Mats] -= 300;
    dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
    SCM(playerid, COLOR_WHITE, str);
    SCM(Buyer, COLOR_WHITE, str2);
    }
    if(Weapon == brassknuckles)
  {
  if(PlayerInfo[playerid][Mats] < 75) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, brassknuckles, 300000);
  format(str, sizeof str, "You gave %s to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived %s from %s.", Weapon, pName);
  PlayerInfo[playerid][Mats] -= 75;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }
    if(Weapon == bat)
  {
  if(PlayerInfo[playerid][Mats] < 75) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, bat, 300000);
  format(str, sizeof str, "You gave a %s to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s from %s.", Weapon, pName);
  PlayerInfo[playerid][Mats] -= 75;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }
    if(PlayerInfo[playerid][GunLevel] < 3) return SCM(playerid, COLOR_RED, "You are not high enough level.");
  if(Weapon == Tec9)
  {
  if(PlayerInfo[playerid][Mats] < 1500) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, Tec9, 300000);
  format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 1500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }
    if(Weapon == Uzi)
  {
  if(PlayerInfo[playerid][Mats] < 1500) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, Uzi, 300000);
  format(str, sizeof str, "You gave an %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived an %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 1500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }
    if(Weapon == MP5)
  {
  if(PlayerInfo[playerid][Mats] < 2000) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, MP5, 300000);
  format(str, sizeof str, "You gave an %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived an %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 2000;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }
    if(PlayerInfo[playerid][GunLevel] < 3) return SCM(playerid, COLOR_RED, "You are not high enough level.");
  if(Weapon == rifle)
  {
  if(PlayerInfo[playerid][Mats] < 2500) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, rifle, 300000);
  format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 2500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }
    if(Weapon == M4)
    {
    if(PlayerInfo[playerid][Mats] < 6500) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
    GivePlayerWeapon(Buyer, M4, 300000);
    format(str, sizeof str, "You gave an %s and ammo to %s.", Weapon, Buyer);
    format(str2, sizeof str2, "You recived an %s and ammo from %s.", Weapon, pName);
    PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 6500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }
    if(Weapon == AK47)
  {
  if(PlayerInfo[playerid][Mats] < 6000) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, AK47, 300000);
  format(str, sizeof str, "You gave an %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived an %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 2500;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }
    if(PlayerInfo[playerid][GunLevel] <= 4)
  if(Weapon == SPAS12)
  {
  if(PlayerInfo[playerid][Mats] < 8000) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, SPAS12, 300000);
  format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 8000;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }
    if(Weapon == sniper)
  {
  if(PlayerInfo[playerid][Mats] < 8000) return SCM(playerid, COLOR_YELLOW, "You do not have enough materials.");
  GivePlayerWeapon(Buyer, sniper, 300000);
  format(str, sizeof str, "You gave a %s and ammo to %s.", Weapon, Buyer);
  format(str2, sizeof str2, "You recived a %s and ammo from %s.", Weapon, pName);
  PlayerInfo[playerid][GunSold] ++;
  dini_IntSet(PlayerFile, "GunSold", PlayerInfo[playerid][GunSold]);
  PlayerInfo[playerid][Mats] -= 8000;
  dini_IntSet(PlayerFile, "Mats", PlayerInfo[playerid][Mats]);
  SCM(playerid, COLOR_WHITE, str);
  SCM(Buyer, COLOR_WHITE, str2);
    }

    if(PlayerInfo[playerid][GunSold] == 50)
    {
      if(PlayerInfo[playerid][GunLevel] != 1) return 1;
      PlayerInfo[playerid][GunLevel] = 2;
      PlayerInfo[playerid][GunSold] = 0;
      SCM(playerid, COLOR_GREEN, "Congradulation, you are now a level 2 Gun Dealer.");
    }
    if(PlayerInfo[playerid][GunSold] == 75)
    {
      if(PlayerInfo[playerid][GunLevel] != 2) return 1;
      PlayerInfo[playerid][GunLevel] = 3;
      PlayerInfo[playerid][GunSold] = 0;
      SCM(playerid, COLOR_GREEN, "Congradulation, you are now a level 3 Gun Dealer.");
    }
    if(PlayerInfo[playerid][GunSold] == 150)
    {
      if(PlayerInfo[playerid][GunLevel] != 3) return 1;
      PlayerInfo[playerid][GunLevel] = 4;
      SCM(playerid, COLOR_GREEN, "Congradulation, you are now a level 4 Gun Dealer.");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)