help with drug dealing system
#1

ok so i started to make a drug dealing system for my server that works like this .Players do /drughouse to go to the drughouse then once inside i have a pickup icon you walk into and it brings you to the drug menu where you buy drugs im wondering how i could make a /stash command to see how many grams you got and a /sell id amount price to sell the drugs after you bought them for more. Here is what i got so far i code in dcmd so if you could help me that would be great

new weed[MAX_PLAYERS];
new coke[MAX_PLAYERS];
new crack[MAX_PLAYERS];
new hash1[MAX_PLAYERS];
new heroin[MAX_PLAYERS];
new tobbacco[MAX_PLAYERS];
new extacy[MAX_PLAYERS];
new lsd[MAX_PLAYERS];
new acid[MAX_PLAYERS];

new weedpickup;

weedpickup = CreatePickup(1241, 2, 319.5118,1120.9940,1083.882;

if (pickupid ==weedpickup)
{
ShowPlayerDialog(playerid, DIALOGID+100, DIALOG_STYLE_LIST, "Drugs", "Weed\nCoke\nCrack\nHash\nHeroin\nTobbacco\nExtacy \nLsd\nAcid", "Select", "Cancel");
}

if(dialogid == DIALOGID+100) // drugs
{
if(response)
{
if(listitem == 0)// Weed
{
if(GetPlayerMoney(playerid) >= 2600){
GivePlayerMoney(playerid, -2600);
GameTextForPlayer(playerid, "~w~] You Just Bought A Pound Of Weed For $2600 ]", 5000, 5);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0, 0,0,0,0);
weed[playerid] = 453;
}
else return SendClientMessage(playerid, blue, "You do not have enough money, Weed cost $2600 A Pound");
return 1;
}
if(listitem == 1)// Coke
{
if(GetPlayerMoney(playerid) >= 4600){
GivePlayerMoney(playerid, -4600);
GameTextForPlayer(playerid, "~w~] You Just Bought A Pound Of Coke For $4600 ]", 5000, 5);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0, 0,0,0,0);
coke[playerid] = 453;
}
else return SendClientMessage(playerid, blue, "You do not have enough money, Coke cost $4600 A Pound");
return 1;
}
if(listitem == 2)// Crack
{
if(GetPlayerMoney(playerid) >= 5600){
GivePlayerMoney(playerid, -5600);
GameTextForPlayer(playerid, "~w~] You Just Bought A Pound Of Crack For $5600 ]", 5000, 5);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0, 0,0,0,0);
crack[playerid] = 453;
}
else return SendClientMessage(playerid, blue, "You do not have enough money, Crack cost $5600 A Pound");
return 1;
}
if(listitem == 3)// Hash
{
if(GetPlayerMoney(playerid) >= 3000){
GivePlayerMoney(playerid, -3000);
GameTextForPlayer(playerid, "~w~] You Just Bought A Pound Of Hash For $3000 ]", 5000, 5);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0, 0,0,0,0);
hash1[playerid] = 453;
}
else return SendClientMessage(playerid, blue, "You do not have enough money, Hash cost $3000 A Pound");
return 1;
}
if(listitem == 4)// Heroin
{
if(GetPlayerMoney(playerid) >= 7000){
GivePlayerMoney(playerid, -7000);
GameTextForPlayer(playerid, "~w~] You Just Bought A Pound Of Heroin For $7000 ]", 5000, 5);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0, 0,0,0,0);
heroin[playerid] = 500;
}
else return SendClientMessage(playerid, blue, "You do not have enough money, Heroin cost $7000 A Pound");
return 1;
}
if(listitem == 5)// Tobbacco
{
if(GetPlayerMoney(playerid) >= 400){
GivePlayerMoney(playerid, -400);
GameTextForPlayer(playerid, "~w~] You Just Bought A Pound Of Tobbacco For $400 ]", 5000, 5);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0, 0,0,0,0);
tobbacco[playerid] = 453;
}
else return SendClientMessage(playerid, blue, "You do not have enough money, Tobbacco cost $400 A Pound");
return 1;
}
if(listitem == 6)// Extacy
{
if(GetPlayerMoney(playerid) >= 2000){
GivePlayerMoney(playerid, -2000);
GameTextForPlayer(playerid, "~w~] You Just Bought 200 Pills Of Extacy For $2000 ]", 5000, 5);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0, 0,0,0,0);
extacy[playerid] = 200;
}
else return SendClientMessage(playerid, blue, "You do not have enough money, Extacy cost $2000 For 200 Pills");
return 1;
}
if(listitem == 7)// Lsd
{
if(GetPlayerMoney(playerid) >= 6500){
GivePlayerMoney(playerid, -6500);
GameTextForPlayer(playerid, "~w~] You Just Bought A Pound Of Lsd For $6500 ]", 5000, 5);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0, 0,0,0,0);
lsd[playerid] = 453;
}
else return SendClientMessage(playerid, blue, "You do not have enough money, Lsd cost $6500 A Pound");
return 1;
}
if(listitem == // Acid
{
if(GetPlayerMoney(playerid) >= 1000){
GivePlayerMoney(playerid, -1000);
GameTextForPlayer(playerid, "~w~] You Just Bought A Sheet Of Acid For $1000 ]", 5000, 5);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0, 0,0,0,0);
acid[playerid] = 500;
}
else return SendClientMessage(playerid, blue, "You do not have enough money, Acid cost $1000 A Sheet");
return 1;
}
return 1;
}
}
Reply
#2

pawn Code:
if(strcmp(cmd, "/stash", true) == 0) {
       new string[67];
       format(string, sizeof(string),"You have: %d grams of weed", weed[playerid]);
     SendClientMessage(playerid,COLOR_HERE,string);
       return 1;
    }
Reply
#3

Quote:
Originally Posted by Noob1337
pawn Code:
if(strcmp(cmd, "/stash", true) == 0) {
      new string[67];
      format(string, sizeof(string),"You have: %d grams of weed", weed[playerid]);
     SendClientMessage(playerid,COLOR_HERE,string);
      return 1;
    }
Thanks but i code in dcmd i could transfer it over but if im correct wouldnt that only show for weed and not all the other drugs ?
Reply
#4

You should note, that you're setting your drugamounts, and not adding to them
pawn Code:
weed[playerid] = 453;
Even if you have 452 'weed', you would pay all of that money to have your 'weed'

Should change all of your codes to
pawn Code:
weed[playerid]+= 453;
Reply
#5

Quote:
Originally Posted by Joe Staff
You should note, that you're setting your drugamounts, and not adding to them
pawn Code:
weed[playerid] = 453;
Even if you have 452 'weed', you would pay all of that money to have your 'weed'

Should change all of your codes to
pawn Code:
weed[playerid]+= 453;
I done thins thanks

I made my /stash command to go with the drug dealing menu but i cant get it to work and how to make it work for all the other drugs to ?

dcmd_stash(playerid,params[])
{
#pragma unused params
new string[67];
format(string, sizeof(string),"You have: %d grams of weed", weed[playerid]);
return 1;
}
Reply
#6

well do the same thing with every drug name weed crack e.t.c if they all have the same function it should work
Reply
#7

Quote:
Originally Posted by [GM
LeGenDy ]
well do the same thing with every drug name weed crack e.t.c if they all have the same function it should work
....I said i couldnt get it to work lol when im in game and type /stash nothing happens ....
Reply
#8

I also need help with a dcmd sell command that the drug dealer will use but im wondering if there is a may i can make so it`s /sell [id] [amount in grams] [price] so example /sell 6 100g 1000 but the part i dont know if it will work is when you use the command the player you try to sell the drugs to a dialog comes up on there screen and asks the yes or no to agree to buying .....please can someone help or if you know a better way please feel free im open to suggestions
Reply
#9

So does this work? Can we get a .pwn of this? :P
Reply
#10

Quote:
Originally Posted by liljon0101
So does this work? Can we get a .pwn of this? :P
Of course not
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)