Drug cmd -
sscarface - 26.06.2015
I need a cmd for drugs
Like you will get $50 per gram.
And you have to type /selldrugs [grams]
If you type /selldrugs 2 so you will get 100k
and if you type /selldrugs 1 so you will get 50k
and if you type /selldrugs 4 so you will get 200k
and so on.
something like this. someone ?
Re: Drug cmd -
Prokill911 - 26.06.2015
Okay..
Firstly...
You said * $50 per gram..
Yet you want them to get 100k == $100,000...
Make your mind up.
Secondly..
It's not that hard..
Just make an if statement to +50,000 each time
Example
for example....
new money = 50000;
/selldrugs [playerid] [grams]
money *= grams;
giveplayermoney(playerid, money);
Re: Drug cmd -
sscarface - 26.06.2015
oops i mean,
And you have to type /selldrugs [grams]
If you type /selldrugs 2 so you will get $100
and if you type /selldrugs 1 so you will get $50
and if you type /selldrugs 4 so you will get $200
Well. i m asking here cuz i want the code. not just tell me what to do. Thanks!
Re: Drug cmd -
J0sh... - 26.06.2015
PHP код:
CMD:selldrugs(playerid, params[])
{
new grams;
if(sscanf(params, "i", grams)) return SCM(playerid, -1, "/selldrugs [grams]");
switch(grams)
{
case ..: code
deafult: SCM(playerid, -1, "/selldrugs [grams]");
}
return 1;
}
#define SCM SendClientMessage
Re: Drug cmd -
sscarface - 26.06.2015
I know how to make cmd but im just confused about that function where you can sell 1 gram and get $50. and 2 grams $100. I want that function. Anyone?
Re: Drug cmd -
DarkLored - 26.06.2015
Check if the player has the amount of grams in an "if" statement and continue everything from there.
Re: Drug cmd -
sscarface - 26.06.2015
As i said i know how does it work but i have no any idea about codes . I want to see some codes here of function.
Like if player sells 1 grams so give him $50 or if he sells 2 grams so give him $100. I want this function.
Re: Drug cmd -
sscarface - 27.06.2015
anyone#?
Re: Drug cmd -
X337 - 27.06.2015
Код:
CMD:selldrugs(playerid, params[])
{
if(strlen(params))
{
if(strval(params) > 0)
{
if(Player drug variable > strval(params))
GivePlayerMoney(playerid, strval(params) * 50000);
}
}
else
SendClientMessage(playerid, -1, "Usage : /selldrugs <grams>");
return 1;
}
Re: Drug cmd -
sscarface - 27.06.2015
Well, THis help me. BUt it doens't remove drugs from player
PHP код:
CMD:selldrugs(playerid, params[])
{
if(strlen(params))
{
if(strval(params) > 0)
{
if(pInfo[playerid][pDrugs] > strval(params))
GivePlayerCashEx(playerid, strval(params) * 325);
SendClientMessage(playerid, GREEN, "You have sell drug grams");
}
}
else
SendClientMessage(playerid, -1, "Usage : /selldrugs <grams>");
return 1;
}
This is my code.
pInfo[playerid][pDrugs] -;? how does it work?