Drug cmd
#1

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 ?
Reply
#2

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);
Reply
#3

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!
Reply
#4

PHP код:
CMD:selldrugs(playeridparams[])
{
      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 
Reply
#5

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?
Reply
#6

Check if the player has the amount of grams in an "if" statement and continue everything from there.
Reply
#7

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.
Reply
#8

anyone#?
Reply
#9

Код:
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;
}
Reply
#10

Well, THis help me. BUt it doens't remove drugs from player

PHP код:
CMD:selldrugs(playeridparams[])
{
    if(
strlen(params))
    {
        if(
strval(params) > 0)
        {
            if(
pInfo[playerid][pDrugs] > strval(params))
            
GivePlayerCashEx(playeridstrval(params) * 325);
            
SendClientMessage(playeridGREEN"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?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)