SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/02/2014, 07:06 PM   #1
Crazydriver
Big Clucker
 
Crazydriver's Avatar
 
Join Date: Jan 2014
Location: Germany
Posts: 125
Reputation: 5
Default Help Needed !!

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
__________________
Crazydriver is offline   Reply With Quote
Old 08/02/2014, 07:41 PM   #2
Twizted
High-roller
 
Join Date: Feb 2011
Location: Portugal
Posts: 1,475
Reputation: 289
Default Re: Help Needed !!

Show us the code.
Twizted is offline   Reply With Quote
Old 08/02/2014, 07:46 PM   #3
Crazydriver
Big Clucker
 
Crazydriver's Avatar
 
Join Date: Jan 2014
Location: Germany
Posts: 125
Reputation: 5
Default AW: Help Needed !!

PHP Code:
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);
        }
        } 
__________________
Crazydriver is offline   Reply With Quote
Old 08/02/2014, 08:56 PM   #4
Crypto20
Little Clucker
 
Join Date: Dec 2012
Posts: 42
Reputation: 0
Default Re: Help Needed !!

Try this:
PHP Code:
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;

Crypto20 is offline   Reply With Quote
Old 09/02/2014, 05:24 AM   #5
Crazydriver
Big Clucker
 
Crazydriver's Avatar
 
Join Date: Jan 2014
Location: Germany
Posts: 125
Reputation: 5
Default AW: Help Needed !!

@Crypto You copy pasted my own Code again /sigh
__________________
Crazydriver is offline   Reply With Quote
Old 09/02/2014, 06:08 AM   #6
_Mohit_
Big Clucker
 
Join Date: Sep 2012
Location: India
Posts: 83
Reputation: 5
Default Re: Help Needed !!

he didnt copy and paste it.He added this

PHP Code:
        if(!IsPlayerInCheckpoint(playerid))  
        { 
        
SendClientMessage(playeridCOLOR_ERROR"Selection Cancelled."); 
        
HideTextDrawMenu(playerid);     
        } 
which prevents the menu from showing if player is not in a Checkpoint!
_Mohit_ is offline   Reply With Quote
Old 09/02/2014, 06:25 AM   #7
Crazydriver
Big Clucker
 
Crazydriver's Avatar
 
Join Date: Jan 2014
Location: Germany
Posts: 125
Reputation: 5
Default AW: Help Needed !!

Nope still didn't work but thanks for pointing that out bro
__________________
Crazydriver is offline   Reply With Quote
Old 10/02/2014, 03:39 PM   #8
Crazydriver
Big Clucker
 
Crazydriver's Avatar
 
Join Date: Jan 2014
Location: Germany
Posts: 125
Reputation: 5
Default AW: Help Needed !!

Bump
__________________
Crazydriver is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 04:26 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.