Drug system
#1

Ok, so I made a place to buy drugs, but only id 0 can buy, id 1 can't, there are no messages popping up or cash going lower. How can I get it working for all id's?

Код:
  else if(dialogid == drugsdialog) // drugs
  {
  	if(response)
  		{
    	if(listitem == 0)// Weed
      {
      		if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
      		GivePlayerMoney(playerid, -50);
      	GameTextForPlayer(playerid, "~w~] You Just Bought A Gram Of Weed For $50 ]", 5000, 5);
      	weed[playerid]+= 1;
     		return 1;
      }
      if(listitem == 1)// Coke
      {
      	if(GetPlayerMoney(playerid) < 150) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
      		GivePlayerMoney(playerid, -150);
      	GameTextForPlayer(playerid, "~w~] You Just Bought A Gram Of Coke For $150 ]", 5000, 5);
      	coke[playerid]+= 1;
      	return 1;
     	}
      if(listitem == 2)// Crack
      {
      	if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
      		GivePlayerMoney(playerid, -100);
      	GameTextForPlayer(playerid, "~w~] You Just Bought A Gram Of Crack For $100 ]", 5000, 5);
      	crack[playerid]+= 1;
      	return 1;
      }
      if(listitem == 3)// Hash
      {
      		if(GetPlayerMoney(playerid) < 50) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
      		GivePlayerMoney(playerid, -50);
      	GameTextForPlayer(playerid, "~w~] You Just Bought A Gram Of Hash For $50 ]", 5000, 5);
      	hash1[playerid]+= 1;
      	return 1;
     	}
      if(listitem == 4)// Heroin
      {
      	if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
      		GivePlayerMoney(playerid, -200);
      	GameTextForPlayer(playerid, "~w~] You Just Bought A Gram Of Heroin For $200 ]", 5000, 5);
      	heroin[playerid]+= 1;
      	return 1;
     	}
		}
    return 1;
  }
Reply
#2

btw im the id 1 ^^ :P
Reply
#3

Could you show us your ShowPlayerDialog?(is it in a timer?)
Reply
#4

Quote:
Originally Posted by Dark_Kostas
Could you show us your ShowPlayerDialog?(is it in a timer?)
It's not in timer.
Код:
  else if(streamid == drugscp) 
	{
    ShowPlayerDialog(playerid, drugsdialog+playerid, DIALOG_STYLE_LIST, "Welcome at the drugs alley, what do you want?", "Weed [$50]\nCoke [$1150]\nCrack [$100]\nHash [$50]\nHeroin [$200]", "Select", "Cancel");
		return 1;
	}
Reply
#5

Why do you use +playerid?

Try to change the OnPlayerDialogResponse
pawn Код:
else if(dialogid == drugsdialog)
to
pawn Код:
else if(dialogid == drugsdialog+playerid)
Reply
#6

Quote:
Originally Posted by Dark_Kostas
Why do you use +playerid?

Try to change the OnPlayerDialogResponse
pawn Код:
else if(dialogid == drugsdialog)
to
pawn Код:
else if(dialogid == drugsdialog+playerid)
Changed it, but still doesn't work.
Reply
#7

***Update***

Problem is fixed, thnx for help
Reply
#8

http://forum.sa-mp.com/index.php?top...msg1071206#new
Reply
#9

Quote:
Originally Posted by lolzer
Ehm, what does this have to do with my problem?
Reply


Forum Jump:


Users browsing this thread: