I am busy with a weapondealer job. And i want to make that a normal player can do /weapons to show the shop from the closest weapondealer but i dont know how to make this. Here i have a command from the weapondealer but i just want that the normal player can show the shop from the weapondealler not that the weapondealler shows the shop to the player>
But how can i make more slots and how can i change the prices from the shop with a command?
pawn Код:
#define MAX_WEAPS 45
#define WEAPONSLOT 13
#define MAX_NAME 40
#define MAX_STRING 128
enum WeapInfo {
WeapName[MAX_NAME],
Ammu,
WeapID,
WeapModel,
WeapSlot,
WeapCost,
bool:banned,
}
new Weapons[MAX_WEAPS][WeapInfo] = {
//Name Ammo ID model slot cost banned
{"Brass Knuckles" ,1 ,1 ,331 ,0 ,1000 ,false},
{"Golf Club" ,1 ,2 ,333 ,1 ,1000 ,false},
{"Nite Stick" ,1 ,3 ,334 ,1 ,3000 ,false},
{"Knife" ,1 ,4 ,335 ,1 ,1000 ,false},
{"Baseball Bat" ,1 ,5 ,336 ,1 ,1000 ,false},
{"Shovel" ,1 ,6 ,337 ,1 ,1000 ,false},
{"Pool Cue" ,1 ,7 ,338 ,1 ,2000 ,false},
{"Katana" ,0 ,8 ,339 ,1 ,1000 ,true},
{"Chainsaw" ,1 ,9 ,341 ,1 ,5000 ,false},
{"Purple Dildo" ,1 ,10 ,321 ,10 ,1000 ,false},
{"Small Vibrator" ,1 ,11 ,322 ,10 ,1000 ,false},
{"Large Vibrator" ,1 ,12 ,321 ,10 ,1000 ,false},
{"Silver Vibrator" ,1 ,13 ,321 ,10 ,1000 ,false},
{"Flowers" ,1 ,14 ,325 ,10 ,1000 ,false},
{"Cane" ,1 ,15 ,326 ,10 ,10000 ,false},
{"Grenade" ,25 ,16 ,342 ,8 ,10000 ,false},
{"Tear Gas" ,0 ,17 ,343 ,8 ,10000 ,true},
{"Molotov" ,25 ,18 ,344 ,8 ,10000 ,false},
//{"Vehicle Missle" ,0 ,19 ,345 ,8 ,100 ,true},
{"Hydra Flare" ,0 ,20 ,354 ,-1 ,100 ,true},
{"Jetpack" ,1 ,21 ,370 ,-1 ,100 ,false},
{"9mm" ,75 ,22 ,346 ,2 ,500 ,false},
{"Silenced 9mm" ,75 ,23 ,347 ,2 ,500 ,false},
{"Desert Eagle" ,50 ,24 ,348 ,2 ,5000 ,false},
{"Shotgun" ,30 ,25 ,349 ,3 ,2000 ,false},
{"Sawnoff Shotgun" ,30 ,26 ,350 ,3 ,4000 ,false},
{"Combat Shotgun" ,30 ,27 ,351 ,3 ,3000 ,false},
{"Micro SMG" ,100 ,28 ,352 ,4 ,1500 ,false},
{"SMG" ,100 ,29 ,353 ,4 ,1500 ,false},
{"Kalashnikov" ,50 ,30 ,355 ,5 ,2000 ,false},
{"M4" ,50 ,31 ,356 ,5 ,5000 ,false},
{"Tech 9" ,100 ,32 ,372 ,4 ,5000 ,false},
{"Country Rifle" ,25 ,33 ,357 ,6 ,1500 ,false},
{"Sniper Rifle" ,25 ,34 ,358 ,6 ,5000 ,false},
{"Rocket Luncher" ,10 ,35 ,359 ,7 ,5000 ,false},
{"Heat Seeker" ,0 ,36 ,360 ,7 ,5000 ,true},
{"Flame Thrower" ,25 ,37 ,361 ,7 ,5000 ,false},
{"Minigun" ,0 ,38 ,362 ,7 ,5000 ,true},
{"Satchel Charge" ,0 ,39 ,363 ,8 ,10000 ,true},
{"Detonator" ,0 ,40 ,364 ,12 ,100 ,true},
{"Spray Can" ,150 ,41 ,365 ,9 ,100 ,false},
{"Fire Extinguisher" ,150 ,42 ,366 ,9 ,2500 ,false},
{"Camera" ,0 ,43 ,344 ,9 ,1000 ,true},
{"Night Vision" ,0 ,44 ,344 ,11 ,100 ,true},
{"Infrared" ,0 ,45 ,344 ,11 ,100 ,true},
{"Parachute" ,1 ,46 ,371 ,11 ,100 ,false}
};
new mtmp[MAX_STRING];
new Menu:SWeapons;
new Menu:SPistol;
new Menu:SShotgun;
new Menu:SAutomatic;
new Menu:SAssult;
new Menu:SRifle;
new Menu:SThrown;
new Menu:SMeelee;
new Menu:SOther;
//spawnweaps--------------------------------------------------------------------
stock CreateWeaponsMenu() {
SWeapons = CreateMenu("Spawn Weapons",1,75.0,75.0,250.0);
SetMenuColumnHeader(SWeapons,0,"Weapon type");
AddMenuItem(SWeapons,0,"Pistols");
AddMenuItem(SWeapons,0,"Shotguns");
AddMenuItem(SWeapons,0,"Automatic");
AddMenuItem(SWeapons,0,"Assualt");
AddMenuItem(SWeapons,0,"Rifle");
AddMenuItem(SWeapons,0,"Thrown");
AddMenuItem(SWeapons,0,"Meelee");
AddMenuItem(SWeapons,0,"Other");
AddMenuItem(SWeapons,0,"Exit");
CreatePistolsMenu();
CreateShotgunsMenu();
CreateAutomaticMenu();
CreateAssultMenu();
CreateRifleMenu();
CreateThrownMenu();
CreateMeeleeMenu();
CreateOtherMenu();
}
stock CreatePistolsMenu() {
SPistol = CreateMenu("Spawn Weapons",2,75.0,75.0,200.0,50.0);
SetMenuColumnHeader(SPistol,0,"Weapon type");
SetMenuColumnHeader(SPistol,1,"Cost");
new mrow;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapSlot] == 2) {
AddMenuItem(SPistol,0,Weapons[w][WeapName]);
format(mtmp,sizeof(mtmp),"$%d",Weapons[w][WeapCost]);
AddMenuItem(SPistol,1,mtmp);
if(Weapons[w][banned]) DisableMenuRow(SPistol,mrow);
mrow++;
}
}
AddMenuItem(SPistol,0,"Back");
}
stock CreateShotgunsMenu() {
SShotgun = CreateMenu("Spawn Weapons",2,75.0,75.0,200.0,50.0);
SetMenuColumnHeader(SShotgun,0,"Weapon type");
SetMenuColumnHeader(SShotgun,1,"Cost");
new mrow;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapSlot] == 3) {
AddMenuItem(SShotgun,0,Weapons[w][WeapName]);
format(mtmp,sizeof(mtmp),"$%d",Weapons[w][WeapCost]);
AddMenuItem(SShotgun,1,mtmp);
if(Weapons[w][banned]) DisableMenuRow(SShotgun,mrow);
mrow++;
}
}
AddMenuItem(SShotgun,0,"Back");
}
stock CreateAutomaticMenu() {
SAutomatic = CreateMenu("Spawn Weapons",2,75.0,75.0,200.0,50.0);
SetMenuColumnHeader(SAutomatic,0,"Weapon type");
SetMenuColumnHeader(SAutomatic,1,"Cost");
new mrow;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapSlot] == 4) {
AddMenuItem(SAutomatic,0,Weapons[w][WeapName]);
format(mtmp,sizeof(mtmp),"$%d",Weapons[w][WeapCost]);
AddMenuItem(SAutomatic,1,mtmp);
if(Weapons[w][banned]) DisableMenuRow(SAutomatic,mrow);
mrow++;
}
}
AddMenuItem(SAutomatic,0,"Back");
}
stock CreateAssultMenu() {
SAssult = CreateMenu("Spawn Weapons",2,75.0,75.0,200.0,50.0);
SetMenuColumnHeader(SAssult,0,"Weapon type");
SetMenuColumnHeader(SAssult,1,"Cost");
new mrow;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapSlot] == 5) {
AddMenuItem(SAssult,0,Weapons[w][WeapName]);
format(mtmp,sizeof(mtmp),"$%d",Weapons[w][WeapCost]);
AddMenuItem(SAssult,1,mtmp);
if(Weapons[w][banned]) DisableMenuRow(SAssult,mrow);
mrow++;
}
}
AddMenuItem(SAssult,0,"Back");
}
stock CreateRifleMenu() {
SRifle = CreateMenu("Spawn Weapons",2,75.0,75.0,200.0,50.0);
SetMenuColumnHeader(SRifle,0,"Weapon type");
SetMenuColumnHeader(SRifle,1,"Cost");
new mrow;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapSlot] == 6) {
AddMenuItem(SRifle,0,Weapons[w][WeapName]);
format(mtmp,sizeof(mtmp),"$%d",Weapons[w][WeapCost]);
AddMenuItem(SRifle,1,mtmp);
if(Weapons[w][banned]) DisableMenuRow(SRifle,mrow);
mrow++;
}
}
AddMenuItem(SRifle,0,"Back");
}
stock CreateThrownMenu() {
SThrown = CreateMenu("Spawn Weapons",2,75.0,75.0,200.0,50.0);
SetMenuColumnHeader(SThrown,0,"Weapon type");
SetMenuColumnHeader(SThrown,1,"Cost");
new mrow;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapSlot] == 8) {
AddMenuItem(SThrown,0,Weapons[w][WeapName]);
format(mtmp,sizeof(mtmp),"$%d",Weapons[w][WeapCost]);
AddMenuItem(SThrown,1,mtmp);
if(Weapons[w][banned]) DisableMenuRow(SThrown,mrow);
mrow++;
}
}
AddMenuItem(SThrown,0,"Back");
}
stock CreateMeeleeMenu() {
SMeelee = CreateMenu("Spawn Weapons",2,75.0,75.0,200.0,50.0);
SetMenuColumnHeader(SMeelee,0,"Weapon type");
SetMenuColumnHeader(SMeelee,1,"Cost");
new mrow;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapSlot] == 1) {
AddMenuItem(SMeelee,0,Weapons[w][WeapName]);
format(mtmp,sizeof(mtmp),"$%d",Weapons[w][WeapCost]);
AddMenuItem(SMeelee,1,mtmp);
if(Weapons[w][banned]) DisableMenuRow(SMeelee,mrow);
mrow++;
}
}
AddMenuItem(SMeelee,0,"Back");
}
stock CreateOtherMenu() {
SOther = CreateMenu("Spawn Weapons",2,75.0,75.0,200.0,50.0);
SetMenuColumnHeader(SOther,0,"Weapon type");
SetMenuColumnHeader(SOther,2,"Cost");
new mrow;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapSlot] == 9) {
AddMenuItem(SOther,0,Weapons[w][WeapName]);
format(mtmp,sizeof(mtmp),"$%d",Weapons[w][WeapCost]);
AddMenuItem(SOther,1,mtmp);
if(Weapons[w][banned]) DisableMenuRow(SOther,mrow);
mrow++;
}
}
AddMenuItem(SOther,0,"Back");
}
stock FindMenuWeapon(row,slot) {
new wrow,wid;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapSlot] == slot) {
if(row == wrow) {
wid = Weapons[w][WeapID];
break;
}
else wrow++;
}
}
return wid;
}
stock FindMenuWeaponCost(weapid) {
new wid;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapID] == weapid) {
wid = Weapons[w][WeapCost];
break;
}
}
return wid;
}
stock FindMenuWeaponAmmo(weapid) {
new wid;
for(new w=0;w<MAX_WEAPS;w++) {
if(Weapons[w][WeapID] == weapid) {
wid = Weapons[w][Ammu];
break;
}
}
return wid;
}
then go CreateWeaponsMenu() under ongame mode init and there is ya menus just have to show them
I have made a textdraw shop for every player who is weapondealler but you can i set the price of every weaponslot with a command
MadeMan have made a weaponshop command that if you are in range of a weapondealler you can see the shop of weapondealer.I made a shop with textdraw if you typ a number you buy the weapon.Here is my Code:
Код:
public OnPlayerText(playerid, text[])
{
new pname[24];
new string[128];
GetPlayerName(playerid,pname,sizeof(pname));
//new ID = GetClosestPlayerToPlayer(playerid);
if (text[0] == '@')
{
if(HasLawEnforcementRadio[playerid] != 1)
{
SendClientMessage(playerid,COLOR_RED,"You need to have a Law Enforcement radio in order to send a message down the police radio.");
return 0;
}
format(string,sizeof(string),"[POLICE RADIO] %s(%d): %s, over.",pname,playerid,text[1]);
SendClientMessageToAllCops(string);
format(string,sizeof(string),"12[POLICE RADIO] %s(%d): %s, over.",pname,playerid,text[1]);
return 0;
}
if(strval(text)==1) //Con Artist
{
if(armshop[playerid]==1)
{
if(IsPlayerConnected(GetPVarInt(playerid, "arm1")) && GetPVarType(playerid, "arm1") != 0) {
GivePlayerMoney(GetPVarInt(playerid, "arm1"), 2000);
format(string,sizeof(string),"You have sold an M4 with 500 Ammo to %s(%d) for $5000!",pname,(playerid));
SendClientMessage(GetPVarInt(playerid, "arm1"),COLOR_LIGHTBLUE,string);
DeletePVar(playerid, "arm1");
GivePlayerWeapon(playerid,31,500);
GivePlayerMoney(playerid,-2000);
}
armshop[playerid]=0;
TextDrawHideForPlayer(playerid,TextDraw4);
return 0;
}
if(CanChooseSkill[playerid]==0||adminshop[playerid]==0||armshop[playerid]==0)
{
return 1;
}
}
if(strval(text)==2) //drug dealer
{
if(armshop[playerid]==1)
{
if(IsPlayerConnected(GetPVarInt(playerid, "arm2")) && GetPVarType(playerid, "arm2") != 0) {
GivePlayerMoney(GetPVarInt(playerid, "arm2"), 2000);
format(string,sizeof(string),"You have sold an M4 with 500 Ammo to %s(%d) for $5000!",pname,(playerid));
SendClientMessage(GetPVarInt(playerid, "arm2"),COLOR_LIGHTBLUE,string);
DeletePVar(playerid, "arm2");
GivePlayerWeapon(playerid,31,500);
GivePlayerMoney(playerid,-2000);
}
armshop[playerid]=0;
TextDrawHideForPlayer(playerid,TextDraw4);
return 0;
}
if(CanChooseSkill[playerid]==0||adminshop[playerid]==0)
{
return 1;
}
}
if(strval(text)==3) //gun dealer
{
if(armshop[playerid]==1)
{
if(IsPlayerConnected(GetPVarInt(playerid, "arm3")) && GetPVarType(playerid, "arm3") != 0) {
GivePlayerMoney(GetPVarInt(playerid, "arm3"), 2000);
format(string,sizeof(string),"You have sold an M4 with 500 Ammo to %s(%d) for $5000!",pname,(playerid));
SendClientMessage(GetPVarInt(playerid, "arm3"),COLOR_LIGHTBLUE,string);
DeletePVar(playerid, "arm3");
GivePlayerWeapon(playerid,31,500);
GivePlayerMoney(playerid,-2000);
}
armshop[playerid]=0;
TextDrawHideForPlayer(playerid,TextDraw4);
return 0;
}
if(CanChooseSkill[playerid]==0||adminshop[playerid]==0)
{
return 1;
}
}
if(strval(text)==4) //hitman
{
if(armshop[playerid]==1)
{
if(IsPlayerConnected(GetPVarInt(playerid, "arm4")) && GetPVarType(playerid, "arm4") != 0) {
GivePlayerMoney(GetPVarInt(playerid, "arm4"), 2000);
format(string,sizeof(string),"You have sold an M4 with 500 Ammo to %s(%d) for $5000!",pname,(playerid));
SendClientMessage(GetPVarInt(playerid, "arm4"),COLOR_LIGHTBLUE,string);
DeletePVar(playerid, "arm4");
GivePlayerWeapon(playerid,31,500);
GivePlayerMoney(playerid,-2000);
}
armshop[playerid]=0;
TextDrawHideForPlayer(playerid,TextDraw4);
return 0;
}
if(CanChooseSkill[playerid]==0||adminshop[playerid]==0)
{
return 1;
}
}
if(strval(text)==5) //
{
if(armshop[playerid]==1)
{
if(IsPlayerConnected(GetPVarInt(playerid, "arm5")) && GetPVarType(playerid, "arm5") != 0) {
GivePlayerMoney(GetPVarInt(playerid, "arm5"), 2000);
format(string,sizeof(string),"You have sold an M4 with 500 Ammo to %s(%d) for $5000!",pname,(playerid));
SendClientMessage(GetPVarInt(playerid, "arm5"),COLOR_LIGHTBLUE,string);
DeletePVar(playerid, "arm5");
GivePlayerWeapon(playerid,31,500);
GivePlayerMoney(playerid,-2000);
}
armshop[playerid]=0;
TextDrawHideForPlayer(playerid,TextDraw4);
return 0;
}
if(CanChooseSkill[playerid]==0||adminshop[playerid]==0)
{
return 1;
}