This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Create buy zone on aim fy maps


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
v120kaaimcfg
Member
Join Date: Apr 2024
Old 05-06-2024 , 07:01   Re: Create buy zone on aim fy maps
Reply With Quote #1

Quote:
Originally Posted by SaraAki View Post
Thanks,but this two solution didnt help me.
Bullshit. Both links provided by @Cheap_Suit for buyzone plugins in the link I gave you work. Tested both of them out. Search more carefully next time:
https://forums.alliedmods.net/showthread.php?p=358059
https://forums.alliedmods.net/showthread.php?p=365040
v120kaaimcfg is offline
DeMNiX
Veteran Member
Join Date: Nov 2011
Location: Russia
Old 05-12-2024 , 01:59   Re: Create buy zone on aim fy maps
Reply With Quote #2

Quote:
Originally Posted by v120kaaimcfg View Post
Bullshit. Both links provided by @Cheap_Suit for buyzone plugins in the link I gave you work. Tested both of them out. Search more carefully next time:
https://forums.alliedmods.net/showthread.php?p=358059
https://forums.alliedmods.net/showthread.php?p=365040
maybe on that map spawned "info_map_parameters" entity, that can blocks buyzones
__________________
My channel with test codes
https://www.youtube.com/user/demnix03

Zombie Riot [Scenario & bots-zombie 11.11.2023]
https://youtu.be/8ZZan-aq2sc
DeMNiX is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old 05-12-2024 , 11:13   Re: Create buy zone on aim fy maps
Reply With Quote #3

Quote:
Originally Posted by DeMNiX View Post
maybe on that map spawned "info_map_parameters" entity, that can blocks buyzones
True. My bad. Tested with fy_infernos and accounted for that in VEN's plugin:
PHP Code:
/* AMX Mod X
*   Buyzone Range
*
* (c) Copyright 2006 by VEN
*
* This file is provided as is (no warranties)
*
*     DESCRIPTION
*       Plugin allows to set buyzone range: everywhere/nowhere/default
*       Note: AMX Mod X v1.75+ required
*
*     CVARs
*       bz_range (0: Nowhere, 1: Default, 2: Everywhere, default: 1)
*       Note: CVAR change is accepted every new round and player spawn
*/

#include <amxmodx>
#include <fakemeta>
#include <engine>

// plugin's main information
#define PLUGIN_NAME "Buyzone Range"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "VEN"

// OPTIONS BELOW

// CVAR name and its default value
#define CVAR_NAME "bz_range"
#define CVAR_DEF "1"

// uncomment to disable automatic 32/64bit processor detection
// possible values is <0: 32bit | 1: 64bit>
//#define PROCESSOR_TYPE 0

// OPTIONS ABOVE

// mapzone player's private data offset
#define OFFSET_32BIT 235
#define OFFSET_64BIT 268

// offset's linux difference
#define OFFSET_LINUX_DIFF 5

// buyzone bit
#define BIT_BUYZONE (1<<0)

// determination of actual offsets
#if !defined PROCESSOR_TYPE // is automatic 32/64bit processor detection?
    #if cellbits == 32 // is the size of a cell 32 bits?
        // then considering processor as 32 bit
        #define OFFSET OFFSET_32BIT
    #else // in other case considering the size of a cell as 64 bits
        // and then considering processor as 64 bit
        #define OFFSET OFFSET_64BIT
    #endif
#else // processor type is specified by PROCESSOR_TYPE define
    #if PROCESSOR_TYPE == 0 // 32bit processor defined
        #define OFFSET OFFSET_32BIT
    #else // considering that defined 64bit processor
        #define OFFSET OFFSET_64BIT
    #endif
#endif

// get/set mapzone bits
#define CS_GET_USER_MAPZONES(%1) get_pdata_int(%1, OFFSET, OFFSET_LINUX_DIFF)
#define CS_SET_USER_MAPZONES(%1,%2) set_pdata_int(%1, OFFSET, %2, OFFSET_LINUX_DIFF)

// fake buyzone absmin and absmax
new Float:g_buyzone_min[3] = {-8192.0, -8192.0, -8192.0}
new 
Float:g_buyzone_max[3] = {-8191.0, -8191.0, -8191.0}

new 
g_buyzone
new g_pcvar

new bool:g_enabled
new g_bit

new bool:g_new_round
new g_maxplayers

#define MAX_PLAYERS 32
new bool:g_alive[MAX_PLAYERS 1]

new 
g_msgid_icon
new g_icon_name[] = "buyzone"

#define ICON_R 0
#define ICON_G 160
#define ICON_B 0

new pfn_classname[20], pfn_keyname[7], pfn_value[1]

public 
plugin_init() {
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)

    
g_pcvar register_cvar(CVAR_NAMECVAR_DEF)

    
register_clcmd("buy""menu_block")
    
register_clcmd("buyequip""menu_block")
    
register_clcmd("fullupdate""clcmd_fullupdate")

    
register_clcmd("create_buyzone""create_buyzonef")

    
register_event("HLTV""event_new_round""a""1=0""2=0")
    
register_event("ResetHUD""event_player_alive""be")
    
register_event("Health""event_player_dead""bd""1=0")

    
register_forward(FM_PlayerPostThink"forward_player_postthink")

    
g_msgid_icon get_user_msgid("StatusIcon")
    
register_message(g_msgid_icon"message_status_icon")

    
g_maxplayers get_maxplayers()

    
g_buyzone engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"func_buyzone"))
    
dllfunc(DLLFunc_Spawng_buyzone)
    
engfunc(EngFunc_SetSizeg_buyzoneg_buyzone_ming_buyzone_max)

    
update_state_vars()
}

public 
pfn_keyvalue(ent)
{
    
copy_keyvalue(pfn_classnamecharsmax(pfn_classname), pfn_keynamecharsmax(pfn_keyname), pfn_valuecharsmax(pfn_value))
    if(
equali(pfn_classname"info_map_parameters") && equali(pfn_keyname"buying"))
    {
        
DispatchKeyValue("buying""0")
    }
}

public 
create_buyzonef(id)
{
    if(
is_valid_ent(g_buyzone))
    {
        
remove_entity(g_buyzone)
    }
    
g_buyzone engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"func_buyzone"))
    
dllfunc(DLLFunc_Spawng_buyzone)


    
// your current position
    
new Float:origin[3]
    
pev(idpev_originorigin)

    
// size of the buyzone around you
    
new Float:mins[3] = {-100.0, -100.0, -16.0// x,y,z(z = -16.0 -> height starts at player's feet) 
    
new Float:maxs[3] = {100.0100.0100.0}

    
//sets the buyzone's position to yours and sets it's size
    
set_pev(g_buyzonepev_originorigin)
    
engfunc(EngFunc_SetSizeg_buyzoneminsmaxs)
    
update_state_vars()

    
client_print(idprint_chat"buyzone created at %f|%f|%f"origin[0], origin[1], origin[2])
}

public 
forward_player_postthink(id) {
    if (
g_alive[id] && g_enabled) {
        switch (
g_bit) {
            case 
BIT_BUYZONEdllfunc(DLLFunc_Touchg_buyzoneid)
            default: 
CS_SET_USER_MAPZONES(idCS_GET_USER_MAPZONES(id) & ~BIT_BUYZONE)
        }
    }
}

public 
event_new_round() {
    
g_new_round true
    set_task
(0.1"task_unset_var")
    
update_state_vars()
}

public 
task_unset_var() {
    
g_new_round false
}

public 
event_player_alive(id) {
    
g_alive[id] = true

    
if (g_new_round) {
        if (
g_enabled)
            
draw_buyzone_icon(idg_bit)
    }
    else {
        
update_state_vars()
        if (
g_enabled) {
            for (new 
1<= g_maxplayers; ++i) {
                if (
g_alive[i])
                    
draw_buyzone_icon(ig_bit)
            }
        }
    }
}

public 
event_player_dead(id) {
    
g_alive[id] = false
}

public 
client_disconnect(id) {
    
g_alive[id] = false
}

public 
message_status_icon(msg_idmsg_destid) {
    if (!
g_alive[id] || !g_enabled)
        return 
PLUGIN_CONTINUE

    
new icon[8]
    
get_msg_arg_string(2icon7)
    if (
equal(icong_icon_name))
        return 
PLUGIN_HANDLED

    
return PLUGIN_CONTINUE
}

public 
menu_block(id) {
    if (
g_alive[id] && g_enabled && !g_bit)
        return 
PLUGIN_HANDLED

    
return PLUGIN_CONTINUE
}

public 
clcmd_fullupdate() {
    return 
PLUGIN_HANDLED
}

update_state_vars() {
    new 
cvar_value get_pcvar_num(g_pcvar)
    
g_enabled true
    
switch (cvar_value) {
        case  
0g_bit 0
        
case  1g_enabled false
        
default: g_bit BIT_BUYZONE
    
}
}

draw_buyzone_icon(iddraw) {
    
message_begin(MSG_ONEg_msgid_icon_id)
    
write_byte(draw)
    
write_string(g_icon_name)
    if (
draw) {
        
write_byte(ICON_R)
        
write_byte(ICON_G)
        
write_byte(ICON_B)
    }
    
message_end()

You can create a buyzone around you with create_buyzone with mins,maxs size. You can edit that to suit your needs. And if you need more than one buyzone delete this code:
PHP Code:
    if(is_valid_ent(g_buyzone))
    {
        
remove_entity(g_buyzone)
    } 
Buyzones will exist till map change or server restart. If you want multiple zones for different maps to spawn at the start of the map you'll have predefine the spots you want them to cover along with checks for different maps you'll be using. To spawn them adapt the code from plugin_init:
PHP Code:
    g_buyzone engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"func_buyzone"))
    
dllfunc(DLLFunc_Spawng_buyzone)
    
engfunc(EngFunc_SetSizeg_buyzoneg_buyzone_ming_buyzone_max)

    
update_state_vars() 

Last edited by v120kaaimcfg; 05-12-2024 at 11:15.
v120kaaimcfg is offline
Reply



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 01:40.


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