SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 08/02/2010, 10:00 PM   #1
[SF]RobMob
Big Clucker
 
Join Date: Oct 2009
Location: Canada
Posts: 154
Reputation: 0
Default help with drug dealing system

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;
}
}
[SF]RobMob is offline  
Old 09/02/2010, 02:25 PM   #2
(Jeff)
Huge Clucker
 
Join Date: Sep 2009
Posts: 242
Reputation: 0
Default Re: help with drug dealing system

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;
    }
(Jeff) is offline  
Old 09/02/2010, 07:31 PM   #3
[SF]RobMob
Big Clucker
 
Join Date: Oct 2009
Location: Canada
Posts: 154
Reputation: 0
Default Re: help with drug dealing system

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 ?
[SF]RobMob is offline  
Old 09/02/2010, 07:47 PM   #4
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: help with drug dealing system

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;
Joe Staff is offline  
Old 10/02/2010, 11:43 PM   #5
[SF]RobMob
Big Clucker
 
Join Date: Oct 2009
Location: Canada
Posts: 154
Reputation: 0
Default Re: help with drug dealing system

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;
}
[SF]RobMob is offline  
Old 10/02/2010, 11:45 PM   #6
Onyx09
Huge Clucker
 
Join Date: Dec 2009
Posts: 264
Reputation: 0
Default Re: help with drug dealing system

well do the same thing with every drug name weed crack e.t.c if they all have the same function it should work
Onyx09 is offline  
Old 10/02/2010, 11:56 PM   #7
[SF]RobMob
Big Clucker
 
Join Date: Oct 2009
Location: Canada
Posts: 154
Reputation: 0
Default Re: help with drug dealing system

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 ....
[SF]RobMob is offline  
Old 11/02/2010, 06:26 PM   #8
[SF]RobMob
Big Clucker
 
Join Date: Oct 2009
Location: Canada
Posts: 154
Reputation: 0
Default Re: help with drug dealing system

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
[SF]RobMob is offline  
Old 18/03/2010, 07:12 AM   #9
liljon0101
Little Clucker
 
Join Date: Mar 2010
Posts: 16
Reputation: 0
Default Re: help with drug dealing system

So does this work? Can we get a .pwn of this? :P
liljon0101 is offline  
Old 18/03/2010, 10:35 AM   #10
SfPwns
Huge Clucker
 
Join Date: Jan 2010
Posts: 320
Reputation: 0
Default Re: help with drug dealing system

Quote:
Originally Posted by liljon0101
So does this work? Can we get a .pwn of this? :P
Of course not
__________________
HostName: $::Optima Freeroam::$
Address: 85.76.202.245:7777
Mode: Drift/RP/Stunts/Freeroam/DM/Race
Map: San Andreas
SfPwns is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drug System Newbz0r Scripting Help 4 28/06/2012 05:39 AM
Drug system Geso Help Archive 8 12/06/2010 08:05 AM
[HELP]Drug system ! cedryk_cedryk Help Archive 7 11/06/2010 11:18 PM
Car Dealing System Jo1Nt Help Archive 3 14/03/2010 10:13 PM


All times are GMT. The time now is 05:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.