Help Needed !!
#1

hey guys i wanted to ask that when i go in any menu checkpoint and buy stuff it works fine but when i leave the checkpoint/interior and are in open world if the menu is still open i can still buy so what i meant to say is that what should i do to stop that i mean ifplayerleavecheckpoint or something like that and also i use Mysql Database
Reply
#2

Show us the code.
Reply
#3

PHP код:
case TD_MENU_AMMUNATION:
        {
        if (
Option != -1)
        {
        if (
Option >= && Option <= Menu_Options[playerid] )
        {

        switch (
Option)
        {

            case 
1:
            {
            
Item 2;ItemAddon 1;ItemName "A Golf Club";
            }
            
            case 
2:
            {
            
Item 5;ItemAddon 1;ItemName "A Baseball Bat";
            }
            
            case 
3:
            {
            
Item 6;ItemAddon 1;ItemName "A Shovel";
            }
            
            case 
4:
            {
            
Item 7;ItemAddon 1;ItemName "A Pool Cue";
            }
            
            case 
5:
            {
            
Item 15;ItemAddon 1;ItemName "A Cane";
            }
            
            case 
6:
            {
            
Item 9;ItemAddon 1;ItemName "A Chainsaw";
            }
            
            case 
7:
            {
            
Item 22;ItemAddon 150;ItemName "A Pistol And 150 Ammo";
            }
            
            case 
8:
            {
            
Item 23;ItemAddon 150;ItemName "A Silenced Pistol And 150 Ammo";
            }
            
            case 
9:
            {
            
Item 24;ItemAddon 150;ItemName "A Desert Eagle And 150 Ammo";
            }
            
            case 
10:
            {
            
Item 25;ItemAddon 150;ItemName "A Shotgun And 150 Ammo";
            }
            
            case 
11:
            {
            
Item 26;ItemAddon 150;ItemName "A Sawn Off Shotgun And 150 Ammo";
            }
            
            case 
12:
            {
            
Item 27;ItemAddon 150;ItemName "A Combat Shotgun And 150 Ammo";
            }
            
            case 
13:
            {
            
Item 28;ItemAddon 200;ItemName "A Mac 10 And 200 Ammo";
            }
            
            case 
14:
            {
            
Item 32;ItemAddon 200;ItemName "A Tec9 And 200 Ammo";
            }
            
            case 
15:
            {
            
Item 29;ItemAddon 200;ItemName "A MP5 And 200 Ammo";
            }
            
            case 
16:
            {
            
Item 30;ItemAddon 200;ItemName "A AK47 And 200 Ammo";
            }
            
            case 
17:
            {
            
Item 31;ItemAddon 200;ItemName "A M4 And 200 Ammo";
            }
            
            case 
18:
            {
            
Item 33;ItemAddon 200;ItemName "A Rifle And 200 Ammo";
            }
            
            case 
19:
            {
            
Item 34;ItemAddon 200;ItemName "A Sniper Rifle And 200 Ammo";
            }
            
            case 
20:
            {
            
Item 99;ItemAddon 0;ItemName "Body Armour";
            }

        }

        if (
GetPlayerMoney(playerid) < Menu_Item_Price[playerid][Option])
        {
        
format(stringsizeof(string), "You Cannot Afford To Buy %s For $%i.",ItemName,Menu_Item_Price[playerid][Option]);
        
SendClientMessage(playeridCOLOR_ERRORstring);
        return 
1;
        }


        if (
Option >= && Option <= 6)
        {
        
SetPlayerWeapon(playerid,Item,ItemAddon);
        }


        if (
Option >= && Option <= 19)
        {
        if (
PlayerInfo[playerid][pTeam] != TEAM_LAW && PlayerInfo[playerid][pGunLic] == 0)
        return 
SendClientMessage(playeridCOLOR_ERROR"A Gun Permit is Required Before Purchasing This Weapon.  Visit City Hall to Purchase Permits.");

        
SetPlayerWeapon(playerid,Item,ItemAddon);
        }


        if (
Option == 20)
        {
        if (
Armour >= 99)
        {
        return 
SendClientMessage(playeridCOLOR_ERROR"Your Armor Is Already Full.  Transaction Cancelled.");
        }
        
SetPlayerArmour(playerid,100);
        }
        new 
Business;

        if (
GetPlayerVirtualWorld(playerid) > 0)
        {
        
Business PlayerInfo[playerid][pLastOutSideID];
        }else{
        
Business PlayerInfo[playerid][pCheckpoint];
        }
        
//HouseInfo[Business][h_Budget] += Menu_Item_Price[playerid][Option];
        
GivePlayerMoney(playeridMenu_Item_Price[playerid][Option]);
        
ApplyAnimation(playerid"INT_SHOP","shop_pay"3.0000001);

        
format(stringsizeof(string), "Purchased %s For $%d. Thankyou For Shopping At %s.",ItemName,Menu_Item_Price[playerid][Option],HouseInfo[Business][h_HouseIntName]);
        
SendClientMessage(playeridCOLOR_SERVER_HELP_MSGstring);


        }else{
        
//format(string, sizeof(string), "Enter A Number 1 - %d",Menu_Options[playerid]);
        
SendClientMessage(playeridCOLOR_ERROR"Selection Cancelled.");
        
HideTextDrawMenu(playerid);
        }
        }else{
        
SendClientMessage(playeridCOLOR_ERROR"Selection Cancelled.");
        
HideTextDrawMenu(playerid);
        }
        } 
Reply
#4

Try this:
PHP код:
case TD_MENU_AMMUNATION:
        {
        if (
IsPlayerInCheckpoint(playerid)) 
        {
        
SendClientMessage(playeridCOLOR_ERROR"Selection Cancelled.");
        
HideTextDrawMenu(playerid);    
        }
        if (
Option != -1)
        {
        if (
Option >= && Option <= Menu_Options[playerid] )
        {
        switch (
Option)
        {
            case 
1:
            {
            
Item 2;ItemAddon 1;ItemName "A Golf Club";
            }
            
            case 
2:
            {
            
Item 5;ItemAddon 1;ItemName "A Baseball Bat";
            }
            
            case 
3:
            {
            
Item 6;ItemAddon 1;ItemName "A Shovel";
            }
            
            case 
4:
            {
            
Item 7;ItemAddon 1;ItemName "A Pool Cue";
            }
            
            case 
5:
            {
            
Item 15;ItemAddon 1;ItemName "A Cane";
            }
            
            case 
6:
            {
            
Item 9;ItemAddon 1;ItemName "A Chainsaw";
            }
            
            case 
7:
            {
            
Item 22;ItemAddon 150;ItemName "A Pistol And 150 Ammo";
            }
            
            case 
8:
            {
            
Item 23;ItemAddon 150;ItemName "A Silenced Pistol And 150 Ammo";
            }
            
            case 
9:
            {
            
Item 24;ItemAddon 150;ItemName "A Desert Eagle And 150 Ammo";
            }
            
            case 
10:
            {
            
Item 25;ItemAddon 150;ItemName "A Shotgun And 150 Ammo";
            }
            
            case 
11:
            {
            
Item 26;ItemAddon 150;ItemName "A Sawn Off Shotgun And 150 Ammo";
            }
            
            case 
12:
            {
            
Item 27;ItemAddon 150;ItemName "A Combat Shotgun And 150 Ammo";
            }
            
            case 
13:
            {
            
Item 28;ItemAddon 200;ItemName "A Mac 10 And 200 Ammo";
            }
            
            case 
14:
            {
            
Item 32;ItemAddon 200;ItemName "A Tec9 And 200 Ammo";
            }
            
            case 
15:
            {
            
Item 29;ItemAddon 200;ItemName "A MP5 And 200 Ammo";
            }
            
            case 
16:
            {
            
Item 30;ItemAddon 200;ItemName "A AK47 And 200 Ammo";
            }
            
            case 
17:
            {
            
Item 31;ItemAddon 200;ItemName "A M4 And 200 Ammo";
            }
            
            case 
18:
            {
            
Item 33;ItemAddon 200;ItemName "A Rifle And 200 Ammo";
            }
            
            case 
19:
            {
            
Item 34;ItemAddon 200;ItemName "A Sniper Rifle And 200 Ammo";
            }
            
            case 
20:
            {
            
Item 99;ItemAddon 0;ItemName "Body Armour";
            }
        }
        if (
GetPlayerMoney(playerid) < Menu_Item_Price[playerid][Option])
        {
        
format(stringsizeof(string), "You Cannot Afford To Buy %s For $%i.",ItemName,Menu_Item_Price[playerid][Option]);
        
SendClientMessage(playeridCOLOR_ERRORstring);
        return 
1;
        }
        if (
Option >= && Option <= 6)
        {
        
SetPlayerWeapon(playerid,Item,ItemAddon);
        }
        if (
Option >= && Option <= 19)
        {
        if (
PlayerInfo[playerid][pTeam] != TEAM_LAW && PlayerInfo[playerid][pGunLic] == 0)
        return 
SendClientMessage(playeridCOLOR_ERROR"A Gun Permit is Required Before Purchasing This Weapon.  Visit City Hall to Purchase Permits.");
        
SetPlayerWeapon(playerid,Item,ItemAddon);
        }
        if (
Option == 20)
        {
        if (
Armour >= 99)
        {
        return 
SendClientMessage(playeridCOLOR_ERROR"Your Armor Is Already Full.  Transaction Cancelled.");
        }
        
SetPlayerArmour(playerid,100);
        }
        new 
Business;
        if (
GetPlayerVirtualWorld(playerid) > 0)
        {
        
Business PlayerInfo[playerid][pLastOutSideID];
        }else{
        
Business PlayerInfo[playerid][pCheckpoint];
        }
        
//HouseInfo[Business][h_Budget] += Menu_Item_Price[playerid][Option];
        
GivePlayerMoney(playeridMenu_Item_Price[playerid][Option]);
        
ApplyAnimation(playerid"INT_SHOP","shop_pay"3.0000001);
        
format(stringsizeof(string), "Purchased %s For $%d. Thankyou For Shopping At %s.",ItemName,Menu_Item_Price[playerid][Option],HouseInfo[Business][h_HouseIntName]);
        
SendClientMessage(playeridCOLOR_SERVER_HELP_MSGstring);
        }else{
        
//format(string, sizeof(string), "Enter A Number 1 - %d",Menu_Options[playerid]);
        
SendClientMessage(playeridCOLOR_ERROR"Selection Cancelled.");
        
HideTextDrawMenu(playerid);
        }
        }else{
        
SendClientMessage(playeridCOLOR_ERROR"Selection Cancelled.");
        
HideTextDrawMenu(playerid);
        }
        }
    return 
1;

Reply
#5

@Crypto You copy pasted my own Code again /sigh
Reply
#6

he didnt copy and paste it.He added this

PHP код:
        if(!IsPlayerInCheckpoint(playerid))  
        { 
        
SendClientMessage(playeridCOLOR_ERROR"Selection Cancelled."); 
        
HideTextDrawMenu(playerid);     
        } 
which prevents the menu from showing if player is not in a Checkpoint!
Reply
#7

Nope still didn't work but thanks for pointing that out bro
Reply
#8

Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)