/buy Command help
#1

Alright, So I made a post the other day saying i needed help on this command, I found the help I needed and thought it was fixed, However! I went to all the stores /buy command was active in, and found it wasn't working correctly.


Here's what happened, I go into the Hardware store, and lo and behold, It shows the Hardware store menu.
I go into the electronics shop, And that works fine.
I go into the 24/7 and that show the Hardware store menu, I am not sure why It shows this. Any thoughts?

pawn Код:
CMD:buy(playerid, params[])
{
    if(!IsAt247(playerid) && !IsAtElecShop(playerid) && !IsAtHardShop(playerid))
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "   You are not in a Store!");
        return 1;
    }
    if(IsAt247(playerid))
    {
        /*if(Showing[playerid] == 1)
        {
            Showing[playerid] = 0;
            for(new i = 0; i < 39; i++)
            {
                TextDrawHideForPlayer(playerid, Textdraw[i]);
                TogglePlayerControllable(playerid,1);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREEN, "The /buy menu may have some bugs. If you find any report them at www.ug-gaming.tk/forums");
            Showing[playerid] = 1;
            SelectTextDraw(playerid, 0xFF4040AA);
            for(new i = 0; i < 39; i++)
            {
                TextDrawShowForPlayer(playerid, Textdraw[i]);
                TogglePlayerControllable(playerid,0);
            }
        }*/

        if(PlayerInfo[playerid][pDonateRank] >= 1)
        {
            ShowPlayerDialog(playerid, STOREMENU, DIALOG_STYLE_LIST, "24/7", "Phone Book        $4000\nDice         $400\nCondom        $40\nSpraycan       $160\nRope          $800\nCigar         $40\nSprunk         $8\nCheckbook       $400\nBag           $5000\nPapers           $400", "Buy", "Cancel");
        }
        else
        {
            ShowPlayerDialog(playerid, STOREMENU, DIALOG_STYLE_LIST, "24/7", "Cell Phone        $500\nDice          $500\nCondom        $50\nSpraycan       $200\nRope          $1000\nCigar            $50\nSprunk         $10\nCheckbook      $500\nBag           $6000\nPapers           $500", "Buy", "Cancel");
        }
    }
    if(IsAtElecShop(playerid))
    {
        if(PlayerInfo[playerid][pDonateRank] >= 1)
        {
            ShowPlayerDialog(playerid, STOREMENU2, DIALOG_STYLE_LIST, "Electronic's Shop", "Cell Phone      $400\nCD Player     $40\nVehicle Lock       $4000\nPortable Radio       $40000\nCamera          $160", "Buy", "Cancel");
        }
        else
        {
            ShowPlayerDialog(playerid, STOREMENU2, DIALOG_STYLE_LIST, "Electronic's Shop", "Cell Phone      $500\nCD Player     $50\nVehicle Lock       $5000\nPortable Radio       $50000\nCamera          $200", "Buy", "Cancel");
        }
    }
    if(IsAtHardShop(playerid))
    {
        if(PlayerInfo[playerid][pDonateRank] >= 1)
        {
            ShowPlayerDialog(playerid, STOREMENU3, DIALOG_STYLE_LIST, "Hardware Store", "Screwdriver        $400\nHammer        $300\nFuelcan       $4000", "Buy", "Cancel");
        }
        else
        {
            ShowPlayerDialog(playerid, STOREMENU3, DIALOG_STYLE_LIST, "Hardware Store", "Screwdriver        $500\nHammer        $400\nFuelcan       $5000", "Buy", "Cancel");
        }
    }
    return 1;
}
pawn Код:
stock IsAt247(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 100.0, -30.875, -88.9609, 1004.53))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 10.0, -2654.2300,1526.3693,907.1797))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 50.0, 890.66, 1429.08, -82.34))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 50.0, -29.2035, -185.1285, 1003.5469))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 50.0, 2.0450,-29.0116,1003.5494))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 50.0, -28.1463,-89.9533,1003.5469))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 50.0, -22.0699,-138.6297,1003.5469))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 50.0, -22.0699,-138.6297,1003.5469))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 50.0, -30.9772,-29.0228,1003.5573))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 50.0, -23.4488,-55.6319,1003.5469))
        {
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 500, -1044.0193,1342.7756,1306.9235)) // VIP Lounge
        {
            return 1;
        }
    }
    return 0;
}
pawn Код:
stock IsAtElecShop(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 100.0, 1007.2590,52.3136,55.3221))
        {
            return 1;
        }
    }
    return 0;
}
pawn Код:
stock IsAtHardShop(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 100.0, -17.6717,-56.6201,1042.2156))
        {
            return 1;
        }
    }
    return 0;
}
Reply
#2

PHP код:
else        
{           
 
ShowPlayerDialog(playeridSTOREMENUDIALOG_STYLE_LIST"24/7""Cell Phone        $500\nDice          $500\nCondom        $50\nSpraycan       $200\nRope          $1000\nCigar            $50\nSprunk         $10\nCheckbook      $500\nBag           $6000\nPapers           $500""Buy""Cancel");        

Isn't Cell Phone supposed to be Phone book?
Reply
#3

Quote:
Originally Posted by Stu1
Посмотреть сообщение
PHP код:
else        
{           
 
ShowPlayerDialog(playeridSTOREMENUDIALOG_STYLE_LIST"24/7""Cell Phone        $500\nDice          $500\nCondom        $50\nSpraycan       $200\nRope          $1000\nCigar            $50\nSprunk         $10\nCheckbook      $500\nBag           $6000\nPapers           $500""Buy""Cancel");        

Isn't Cell Phone supposed to be Phone book?
Yes but that doesn't mean anything. That wouldn't help me at all.
Reply
#4

pawn Код:
if(!IsAt247(playerid) || !IsAtElecShop(playerid) || !IsAtHardShop(playerid))
Reply
#5

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
pawn Код:
if(!IsAt247(playerid) || !IsAtElecShop(playerid) || !IsAtHardShop(playerid))
Thats the exact thing we talked about in this one
https://sampforum.blast.hk/showthread.php?tid=387523
Reply
#6

Anyone? Any Ideas?
Reply
#7

Your problem is when you go into another store it shows the incorrect dialog?
Reply
#8

This should work all good, would be very weird if it doesn't.

pawn Код:
CMD:buy(playerid, params[])
{
    if(IsAt247(playerid))
        {
        if(PlayerInfo[playerid][pDonateRank] >= 1)
            {
            ShowPlayerDialog(playerid, STOREMENU, DIALOG_STYLE_LIST, "24/7", "Phone Book        $4000\nDice         $400\nCondom        $40\nSpraycan       $160\nRope          $800\nCigar         $40\nSprunk         $8\nCheckbook       $400\nBag           $5000\nPapers           $400", "Buy", "Cancel");
            return 1;
            }
        else
            {
            ShowPlayerDialog(playerid, STOREMENU, DIALOG_STYLE_LIST, "24/7", "Phone Book        $500\nDice          $500\nCondom        $50\nSpraycan       $200\nRope          $1000\nCigar            $50\nSprunk         $10\nCheckbook      $500\nBag           $6000\nPapers           $500", "Buy", "Cancel");
            return 1;
            }
        }
    else if(IsAtElecShop(playerid))
        {
        if(PlayerInfo[playerid][pDonateRank] >= 1)
            {
            ShowPlayerDialog(playerid, STOREMENU2, DIALOG_STYLE_LIST, "Electronic's Shop", "Cell Phone      $400\nCD Player     $40\nVehicle Lock       $4000\nPortable Radio       $40000\nCamera          $160", "Buy", "Cancel");
            return 1;
            }
        else
            {
            ShowPlayerDialog(playerid, STOREMENU2, DIALOG_STYLE_LIST, "Electronic's Shop", "Cell Phone      $500\nCD Player     $50\nVehicle Lock       $5000\nPortable Radio       $50000\nCamera          $200", "Buy", "Cancel");
            return 1;
            }
        }
    else if(IsAtHardShop(playerid))
        {
        if(PlayerInfo[playerid][pDonateRank] >= 1)
            {
            ShowPlayerDialog(playerid, STOREMENU3, DIALOG_STYLE_LIST, "Hardware Store", "Screwdriver        $400\nHammer        $300\nFuelcan       $4000", "Buy", "Cancel");
            return 1;
            }
        else
            {
            ShowPlayerDialog(playerid, STOREMENU3, DIALOG_STYLE_LIST, "Hardware Store", "Screwdriver        $500\nHammer        $400\nFuelcan       $5000", "Buy", "Cancel");
            return 1;
            }
        }
    else
        {
        SendClientMessageEx(playerid, COLOR_GRAD2, "   You are not in any store!");
        return 1;
        }
}
Jesse
Reply
#9

Quote:
Originally Posted by jessejanssen
Посмотреть сообщение
This should work all good, would be very weird if it doesn't.

pawn Код:
CMD:buy(playerid, params[])
{
    if(IsAt247(playerid))
        {
        if(PlayerInfo[playerid][pDonateRank] >= 1)
            {
            ShowPlayerDialog(playerid, STOREMENU, DIALOG_STYLE_LIST, "24/7", "Phone Book        $4000\nDice         $400\nCondom        $40\nSpraycan       $160\nRope          $800\nCigar         $40\nSprunk         $8\nCheckbook       $400\nBag           $5000\nPapers           $400", "Buy", "Cancel");
            return 1;
            }
        else
            {
            ShowPlayerDialog(playerid, STOREMENU, DIALOG_STYLE_LIST, "24/7", "Phone Book        $500\nDice          $500\nCondom        $50\nSpraycan       $200\nRope          $1000\nCigar            $50\nSprunk         $10\nCheckbook      $500\nBag           $6000\nPapers           $500", "Buy", "Cancel");
            return 1;
            }
        }
    else if(IsAtElecShop(playerid))
        {
        if(PlayerInfo[playerid][pDonateRank] >= 1)
            {
            ShowPlayerDialog(playerid, STOREMENU2, DIALOG_STYLE_LIST, "Electronic's Shop", "Cell Phone      $400\nCD Player     $40\nVehicle Lock       $4000\nPortable Radio       $40000\nCamera          $160", "Buy", "Cancel");
            return 1;
            }
        else
            {
            ShowPlayerDialog(playerid, STOREMENU2, DIALOG_STYLE_LIST, "Electronic's Shop", "Cell Phone      $500\nCD Player     $50\nVehicle Lock       $5000\nPortable Radio       $50000\nCamera          $200", "Buy", "Cancel");
            return 1;
            }
        }
    else if(IsAtHardShop(playerid))
        {
        if(PlayerInfo[playerid][pDonateRank] >= 1)
            {
            ShowPlayerDialog(playerid, STOREMENU3, DIALOG_STYLE_LIST, "Hardware Store", "Screwdriver        $400\nHammer        $300\nFuelcan       $4000", "Buy", "Cancel");
            return 1;
            }
        else
            {
            ShowPlayerDialog(playerid, STOREMENU3, DIALOG_STYLE_LIST, "Hardware Store", "Screwdriver        $500\nHammer        $400\nFuelcan       $5000", "Buy", "Cancel");
            return 1;
            }
        }
    else
        {
        SendClientMessageEx(playerid, COLOR_GRAD2, "   You are not in any store!");
        return 1;
        }
}
Jesse
Forget about OnDialogResponse ?
Reply
#10

Quote:
Originally Posted by verlaj
Посмотреть сообщение
Forget about OnDialogResponse ?
He never said he had issues with his OnDialogResponse, that might be perfectly scripted, he just said the wrong dialog was being showed, which would be fixed by my code.

Jesse
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)