AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Only purchase on base (https://forums.alliedmods.net/showthread.php?t=183601)

.ThePro 04-23-2012 20:00

Only purchase on base
 
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)
}


EpicMonkey 04-24-2012 04:25

Re: Only purchase on base
 
you could do this ,
PHP Code:

client_cmd(id"m4a1"


Hunter-Digital 04-24-2012 06:13

Re: Only purchase on base
 
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.

.ThePro 04-24-2012 20:19

Re: Only purchase on base
 
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.

EpicMonkey 04-25-2012 02:04

Re: Only purchase on base
 
its already there in scripting help , ive seen lots of threads , just search for it and it will show up

rak 04-25-2012 02:07

Re: Only purchase on base
 
cs_get_user_buyzone(Index)

hornet 04-25-2012 02:13

Re: Only purchase on base
 
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 :(

rak 04-25-2012 02:22

Re: Only purchase on base
 
in this case is better use cs_get_user_buyzone

.ThePro 04-28-2012 12:34

Re: Only purchase on base
 
thank you very much
Friends, that was it.


All times are GMT -4. The time now is 05:45.

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