Josh McArtin! Whats up man.
I am actually running a new server with Gmodder.
We already got the hosted tab, a game server, and domain name for our forums.
Anyways, heres the complete code.
Код:
new BeenOfferedWeapon[MAX_PLAYERS];
CMD:sellgun(playerid, params[])
{
new string[128], playerb, price, weapon[32];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pJob] != JOB_WDEALER && PlayerInfo[playerid][pVIPJob] != JOB_WDEALER) return SendClientMessage(playerid, COLOR_GREY, "You are not a weapons dealer.");
if(sscanf(params, "us[32]i", playerb, weapon, price))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellgun [playerid] [weapon] [price]");
SendClientMessage(playerid, COLOR_GREY, "LEVEL 1: Flowers (25) | GolfClub (50) | Shovel (50) | Bat (50) | Katana (50)");
SendClientMessage(playerid, COLOR_GREY, "LEVEL 1: SDPistol (100) | Shotgun (200)");
if(strval(RPJL(playerid, JOB_WDEALER)) >= 2) SendClientMessage(playerid, COLOR_GREY, "LEVEL 2: MP5 (500) | Rifle (750)");
if(strval(RPJL(playerid, JOB_WDEALER)) >= 3) SendClientMessage(playerid, COLOR_GREY, "LEVEL 3: Deagle (2000)");
if(strval(RPJL(playerid, JOB_WDEALER)) >= 4) SendClientMessage(playerid, COLOR_GREY, "LEVEL 4: AK47 (4000) | M4 (4500)");
if(strval(RPJL(playerid, JOB_WDEALER)) >= 5) SendClientMessage(playerid, COLOR_GREY, "LEVEL 5: SPAS12 (6500) | Sniper (7000)");
return 1;
}
if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't sell weapons to yourself, use /creategun.");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(PlayerInfo[playerid][pLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You must be at least level 2 to sell weapons.");
if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You are too far away from that player.");
if(!strcmp(weapon, "flowers", true, 7))
{
if(PlayerInfo[playerid][pMaterials] < 25) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 14;
}
else if(!strcmp(weapon, "golfclub", true, 8))
{
if(PlayerInfo[playerid][pMaterials] < 50) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 2;
}
else if(!strcmp(weapon, "shovel", true, 6))
{
if(PlayerInfo[playerid][pMaterials] < 50) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 6;
}
else if(!strcmp(weapon, "bat", true, 3))
{
if(PlayerInfo[playerid][pMaterials] < 50) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 5;
}
else if(!strcmp(weapon, "katana", true, 6))
{
if(PlayerInfo[playerid][pMaterials] < 50) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 8;
}
else if(!strcmp(weapon, "sdpistol", true, 7))
{
if(PlayerInfo[playerid][pMaterials] < 100) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 23, 300;
}
else if(!strcmp(weapon, "shotgun", true, 7))
{
if(PlayerInfo[playerid][pMaterials] < 200) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 25, 300;
}
else if(!strcmp(weapon, "rifle", true, 5))
{
if(strval(RPJL(playerid, JOB_WDEALER)) < 2) return SendClientMessage(playerid, COLOR_GREY, "Your Weapons Dealer level is too low to sell this weapon.");
if(PlayerInfo[playerid][pMaterials] < 750) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 33, 300;
}
else if(!strcmp(weapon, "mp5", true, 3))
{
if(strval(RPJL(playerid, JOB_WDEALER)) < 2) return SendClientMessage(playerid, COLOR_GREY, "Your Weapons Dealer level is too low to sell this weapon.");
if(PlayerInfo[playerid][pMaterials] < 500) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 29, 300;
}
else if(!strcmp(weapon, "deagle", true, 6))
{
if(strval(RPJL(playerid, JOB_WDEALER)) < 3) return SendClientMessage(playerid, COLOR_GREY, "Your Weapons Dealer level is too low to sell this weapon.");
if(PlayerInfo[playerid][pMaterials] < 2000) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 24;
}
else if(!strcmp(weapon, "ak47", true, 4))
{
if(strval(RPJL(playerid, JOB_WDEALER)) < 4) return SendClientMessage(playerid, COLOR_GREY, "Your Weapons Dealer level is too low to sell this weapon.");
if(PlayerInfo[playerid][pMaterials] < 4000) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 30,;
}
else if(!strcmp(weapon, "M4", true, 2))
{
if(strval(RPJL(playerid, JOB_WDEALER)) < 4) return SendClientMessage(playerid, COLOR_GREY, "Your Weapons Dealer level is too low to sell this weapon.");
if(PlayerInfo[playerid][pMaterials] < 4500) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 31,;
}
else if(!strcmp(weapon, "spas12", true, 6))
{
if(strval(RPJL(playerid, JOB_WDEALER)) < 5) return SendClientMessage(playerid, COLOR_GREY, "Your Weapons Dealer level is too low to sell this weapon.");
if(PlayerInfo[playerid][pMaterials] < 6500) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 27;
}
else if(!strcmp(weapon, "sniper", true, 6))
{
if(strval(RPJL(playerid, JOB_WDEALER)) < 5) return SendClientMessage(playerid, COLOR_GREY, "Your Weapons Dealer level is too low to sell this weapon.");
if(PlayerInfo[playerid][pMaterials] < 7000) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough materials for this weapon.");
BeenOfferedWeapon[playerb] = 34;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Invalid weapon name.");
return 1;
}
SellWeaponTo[playerid] = playerb;
BuyWeaponFrom[playerb] = playerid;
BuyWeaponPrice[playerb] = price;
format(string, sizeof(string), " You have offered %s to sell them a %s for $%d.", RPN(playerb), RWN(BeenOfferedWeapon[playerb]), price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s has offered to sell you a %s for $%d. (/accept weapon) (/cancel weapon)", RPN(playerid), RWN(BeenOfferedWeapon[playerb]), price);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
return 1;
}