Raised This Month: $12 Target: $400
 3% 

Only purchase on base


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.ThePro
Member
Join Date: Aug 2011
Location: Brazil
Old 04-23-2012 , 20:00   Only purchase on base
Reply With Quote #1

I would by this plugin to just buy the base ..
Because with it you can buy anywhere in the map.
But I just want to buy at the bottom (where it appears the shopping cart).

Code:
#include <amxmodx>
#include <fun>
#include <cstrike>

#define PLUGIN "Buy Weapon"
#define VERSION "1.0"
#define AUTHOR ".ThePro" //not remove


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_clcmd("say /weapon", "Buy_Weapon")
}

public Buy_Weapon(id){

            give_item(id, "weapon_knife")
            give_item(id, "weapon_hegrenade")
            give_item(id, "weapon_flashbang")
            give_item(id, "weapon_flashbang")
            give_item(id, "weapon_smokegrenade")
            give_item(id, "item_assaultsuit")
            give_item(id, "item_thighpack")
            give_item(id, "weapon_deagle")
            give_item(id, "weapon_m4a1")

            cs_set_user_bpammo(id, CSW_M4A1, 100)
            cs_set_user_bpammo(id, CSW_DEAGLE, 100)
}
__________________
Of Developer to apprentice.

.ThePro is offline
Send a message via MSN to .ThePro
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-24-2012 , 04:25   Re: Only purchase on base
Reply With Quote #2

you could do this ,
PHP Code:
client_cmd(id"m4a1"
EpicMonkey is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 04-24-2012 , 06:13   Re: Only purchase on base
Reply With Quote #3

If you want to only *give* the weapons in the buyzone, you need to check if player is in the buyzone... you can do that in 2 ways, hook "StatusIcon" and check for the buyzone icon (I'm doing that in my jCTF plugin if you want example code) or you can check a player flag... I don't remember which one was it, in any case, you need to SEARCH :}

But if you want to make players buy certain weapons, using client_cmd("weapon") would make the player buy it as if he bought it using the buy menu... it will check for money and if in buyzone.
I belive all weapon buy commands available are in cstrike/autobuy.txt.
__________________

Last edited by Hunter-Digital; 04-24-2012 at 06:14.
Hunter-Digital is offline
.ThePro
Member
Join Date: Aug 2011
Location: Brazil
Old 04-24-2012 , 20:19   Re: Only purchase on base
Reply With Quote #4

EpicMonkey, this way I know it's possible, but I want to do is MAKE SURE THE PLAYER IS IN BUYZONE, as Hunter said the friend.

Hunter-Digital, is this friend, you said it right.
I want to check if the player is in buyzone tell me example how to do?!
by the way, is a nice CTF game mode.
__________________
Of Developer to apprentice.


Last edited by .ThePro; 04-24-2012 at 20:20.
.ThePro is offline
Send a message via MSN to .ThePro
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-25-2012 , 02:04   Re: Only purchase on base
Reply With Quote #5

its already there in scripting help , ive seen lots of threads , just search for it and it will show up
EpicMonkey is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 04-25-2012 , 02:07   Re: Only purchase on base
Reply With Quote #6

cs_get_user_buyzone(Index)
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-25-2012 , 02:13   Re: Only purchase on base
Reply With Quote #7

I can think of a couple of ways:

A simple check:
PHP Code:
cs_get_user_buyzoneid 
Or

PHP Code:
register_messageget_user_msgid"StatusIcon" ), "msg_StatusIcon" );

public 
msg_StatusIconmsgidmsgdestid 

    static 
szMsg]; 
    
get_msg_arg_string2szMsgcharsmaxszMsg ) ); 
    
    if( 
equalszMsg"buyzone" ) && get_msg_arg_int) ) 
    { 
        
//buy here
    


Rak beat me to it
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 04-25-2012 at 02:16.
hornet is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 04-25-2012 , 02:22   Re: Only purchase on base
Reply With Quote #8

in this case is better use cs_get_user_buyzone
__________________

www.amxmodx-es.com

Steam: Luchokoldo

Last edited by rak; 04-25-2012 at 02:22.
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
.ThePro
Member
Join Date: Aug 2011
Location: Brazil
Old 04-28-2012 , 12:34   Re: Only purchase on base
Reply With Quote #9

thank you very much
Friends, that was it.
__________________
Of Developer to apprentice.

.ThePro is offline
Send a message via MSN to .ThePro
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

Forum Jump


All times are GMT -4. The time now is 06:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode