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;
}