/drink doesn't work
#1

I have a problem with /drink command.
I type /drink and nothing happened.

Here are the command source:



Код:
if(strcmp(cmd, "/drink", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(IsAtBar(playerid))
	        {
	            if(PlayerDrunk[playerid] < 10)
	            {
	                ShowPlayerDialog(playerid, 10, DIALOG_STYLE_LIST, "Drink Menu", "Beer($6)\nVodka($10)\nWhiskey($15)\nWine($10)\nTequila($20)\nWather($2)\nSoda($2)\nCoca-Cola($5)\nSchweppes($5)\nPrigat($7)\nFanta($7)\nSprite($7)\nCaffe($3)\nCocktail($7)","Buy", "Cancel");
	                return 1;
                }
	            else
	            {
	                SendClientMessage(playerid, COLOR_WHITE, " You can't drink anymore, you will throw up !");
	                return 1;
	            }
 			}
 			else
			{
   				SendClientMessage(playerid, COLOR_WHITE,"You are not at bar");
				return 1;
			}
		}
	}
When I use /drink at bar it doesn't show me the Drink Dialog and when i'm not at the bar not tell me: You are not at bar", You type /drink and nothing happens.
Any suggestions ?
Reply
#2

Try to change this number few times:

pawn Код:
ShowPlayerDialog(playerid, 391,............
Because, sometimes dialogid 10 might interfere with other dialog ids on this/another script.

Show us "IsAtBar(playerid)"..
Reply
#3

IsAtBar? Do you set it when they enter the interior or whatever?
Reply
#4

Код:
public IsAtBar(playerid)
{
    if(IsPlayerConnected(playerid))
	{
		if(PlayerToPoint(4.0,playerid,495.7801,-76.0305,998.7578) || PlayerToPoint(4.0,playerid,499.9654,-20.2515,1000.6797) || PlayerToPoint(4.0,playerid,-8.64,16.17,973.31)  || PlayerToPoint(4.0,playerid, -1968.7980,103.9036,27.6875))
		{//In Alpha bar (with girlfriend), and in Havanna
		    return 1;
		}
		else if(PlayerToPoint(4.0,playerid,1215.9480,-13.3519,1000.9219) || PlayerToPoint(10.0,playerid,-2658.9749,1407.4136,906.2734) || PlayerToPoint(10.0,playerid,861.0741,-2279.7566,3.4358))
		{//PIG Pen
		    return 1;
		}
		else if(PlayerToPoint(4.0,playerid,1955.37,1017.33,992.47) || PlayerToPoint(4.0,playerid,1946.24,1018.49,992.47))
		{//Casino
		    return 1;
		}
	}
	return 0;
}
I try change id from 10 in 391, but the command doesn't work anyway, when I type /drink it not show me any message !
Reply
#5

Show us the part from OnDialogResponse, maybe you didn't set the dialogid correctly or forgot to add it.
Reply
#6

Instead of a stock (PlayerToPoint), try IsPlayerInRangeOfPoint:

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

pawn Код:
IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z);
Reply
#7

Код:
if(dialogid == 10)
		{
			if(response)
			{
				if(listitem==0)
				{
					if(PlayerInfo[playerid][pAge] < 16)
					{
					    SendClientMessage(playerid, COLOR_WHITE, "Bartender: Sorry, you need to be 16 years to get this drink.");
					    return 1;
					}
					new Float:health;
				    GivePlayerMoney(playerid, - 6);
				    PlayerDrunk[playerid] += 1;
				    SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid)+2000);
					if(PlayerDrunk[playerid] >= 5)
					{
						GameTextForPlayer(playerid, "~w~You are~n~~p~Drunk", 3500, 1);
					}
					if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0)
						{
							PlayerDrunk[playerid] += 1;
							new hp = 2 * PlayerInfo[playerid][pAlcoholPerk];
							hp += 15;
							SetPlayerHealth(playerid, health + hp);
						}
						else
						{
							SetPlayerHealth(playerid, health + 15.0);
						}
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
						BizzInfo[2][bTill] += 6;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a beer.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==1)
				{
				    if(PlayerInfo[playerid][pAge] < 18)
					{
					    SendClientMessage(playerid, COLOR_WHITE, "Bartender: Sorry, you need to be 16 years to get this drink.");
					    return 1;
					}
					new Float:health;
				    GivePlayerMoney(playerid, - 15);
				    PlayerDrunk[playerid] += 3;
				    SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid)+2000);
					if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~You are~n~~p~Drunk", 3500, 1); }
					if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 27.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 15;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a vodka.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
                if(listitem==2)
				{
				    if(PlayerInfo[playerid][pAge] < 18)
					{
					    SendClientMessage(playerid, COLOR_WHITE, "Bartender: Sorry, you need to be 16 years to get this drink.");
					    return 1;
					}
					new Float:health;
				    GivePlayerMoney(playerid, - 15);
				    PlayerDrunk[playerid] += 3;
				    SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid)+2000);
					if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~You are~n~~p~Drunk", 3500, 1); }
					if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 27.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 15;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a whiskey.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==3)
				{
				    if(PlayerInfo[playerid][pAge] < 18)
					{
	    				SendClientMessage(playerid, COLOR_WHITE, "Bartender: Sorry, you need to be 16 years to get this drink.");
					    return 1;
					}
					new Float:health;
				    GivePlayerMoney(playerid, - 10);
				    PlayerDrunk[playerid] += 3;
				    SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid)+2000);
					if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~You are~n~~p~Drunk", 3500, 1); }
					if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 30.0); }
												}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 10;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a wine.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==4)
				{
				    if(PlayerInfo[playerid][pAge] < 18)
					{
					    SendClientMessage(playerid, COLOR_WHITE, "Bartender: Sorry, you need to be 16 years to get this drink.");
					    return 1;
					}
					new Float:health;
	    			GivePlayerMoney(playerid, - 20);
				    PlayerDrunk[playerid] += 5;
				    SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid)+2000);
					if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~You are~n~~p~Drunk", 3500, 1); }
					if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 10.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 20;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a tequila.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==5)
				{
				    new Float:health;
                    ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.0999, 0, 1, 1, 1, 1);
    				GivePlayerMoney(playerid, - 2);
				    if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 5.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 2;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a wather.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==6)
				{
				    new Float:health;
                    ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.0999, 0, 1, 1, 1, 1);
    				GivePlayerMoney(playerid, - 2);
				    if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 5.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 2;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a soda.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==7)
				{
				    new Float:health;
                    ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.0999, 0, 1, 1, 1, 1);
    				GivePlayerMoney(playerid, - 5);
				    if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 5.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 5;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a coca-cola.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==8)
				{
				    new Float:health;
                    ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.0999, 0, 1, 1, 1, 1);
    				GivePlayerMoney(playerid, - 5);
	   				if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 5.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 5;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a schweppes.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==9)
				{
				    new Float:health;
                    ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.0999, 0, 1, 1, 1, 1);
    				GivePlayerMoney(playerid, - 7);
			    	if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 10.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 7;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a prigat.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==10)
				{
				    new Float:health;
                    ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.0999, 0, 1, 1, 1, 1);
    				GivePlayerMoney(playerid, - 7);
			    	if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 10.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 7;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a fanta.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==11)
				{
				    new Float:health;
    				ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.0999, 0, 1, 1, 1, 1);
				    GivePlayerMoney(playerid, - 7);
				    if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 10.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 7;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a sprite.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==12)
				{
				    new Float:health;
                    ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.0999, 0, 1, 1, 1, 1);
    				GivePlayerMoney(playerid, - 3);
			    	if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 10.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 3;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a caffe.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
				if(listitem==13)
				{
				    new Float:health;
                    ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.0999, 0, 1, 1, 1, 1);
    				GivePlayerMoney(playerid, - 7);
				    if(GetPlayerHealth(playerid, health) < 100)
					{
					    if(PlayerInfo[playerid][pAlcoholPerk] > 0) { new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 5; SetPlayerHealth(playerid, health + hp); }
						else { SetPlayerHealth(playerid, health + 15.0); }
					}
					if(PlayerToPoint(3.0,playerid,-783.4417,500.1744,1371.7422) || PlayerToPoint(3.0,playerid,-788.3983,500.4243,1371.7422))
					{
					BizzInfo[2][bTill] += 7;
					}
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "* %s drinks a cocktail.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				}
			}
		}
Reply
#8

try this...

pawn Код:
if(strcmp(cmd, "/drink", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsAtBar(playerid))
            {
                if(PlayerDrunk[playerid] < 10)
                {
                    ShowPlayerDialog(playerid, 10, DIALOG_STYLE_LIST, "Drink Menu", "Beer($6)\nVodka($10)\nWhiskey($15)\nWine($10)\nTequila($20)\nWather($2)\nSoda($2)\nCoca-Cola($5)\nSchweppes($5)\nPrigat($7)\nFanta($7)\nSprite($7)\nCaffe($3)\nCocktail($7)","Buy", "Cancel");
                    return 1;
                    }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, " You can't drink anymore, you will throw up !");
                    return 1;
                }
            }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE,"You are not at bar");
            return 1;
        }
    }
       return 1;
    }
Reply
#9

I will try, thanks !
Reply
#10

Not.. I type /drink and nothing happened . It's very frustrating
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)