AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Completely hide buyzone icon. (https://forums.alliedmods.net/showthread.php?t=247813)

yokomo 09-08-2014 08:33

[Solved] Completely hide buyzone icon.
 
Hi, i found this code:
PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("Sekat Zon Beli-belah""0.0.1""wbyokomo")
    
register_message(get_user_msgid("StatusIcon"), "OnStatusIcon")
}

public 
OnStatusIcon(msgidmsgdestid
{  
    static 
szMsg[8]; get_msg_arg_string(2szMsg7);
    if(
equal(szMsg"buyzone") && get_msg_arg_int(1)) 
    {
        
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0))
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;


This code will hide buyzone from appear, but any other efficient method to hide buyzone? I mean using Orpheu.

zmd94 09-08-2014 08:38

Re: [Help] Completely hide buyzone icon.
 
LOL, "Sekat Zon Beli-belah".

By the way, in English:
Quote:

Restrict the Buy Zone.
Please don't angry with me. ;)

yokomo 09-08-2014 08:46

Re: [Help] Completely hide buyzone icon.
 
Quote:

Originally Posted by zmd94 (Post 2195378)
LOL, "Sekat Zon Beli-belah".

By the way, in English:
Please don't angry with me. ;)

Haha. Ok.

aron9forever 09-08-2014 08:47

Re: [Help] Completely hide buyzone icon.
 
what exactly do you want
just to hide the icon or remove buyzone?

HamletEagle 09-08-2014 09:51

Re: [Help] Completely hide buyzone icon.
 
He wants to do what his actual code do, but with orpheu( to hide the icon ). Why you need orpheu for a simple thing like this ? I mean, why not using it as it is ?

yokomo 09-08-2014 09:58

Re: [Help] Completely hide buyzone icon.
 
Quote:

Originally Posted by HamletEagle (Post 2195400)
He wants to do what his actual code do, but with orpheu( to hide the icon ). Why you need orpheu for a simple thing like this ? I mean, why not using it as it is ?

Do you think the code i posted above efficient? Because it will call every time StatusIcon message were sent.

aron9forever 09-08-2014 10:03

Re: [Help] Completely hide buyzone icon.
 
Quote:

Originally Posted by yokomo (Post 2195403)
Do you think the code i posted above efficient? Because it will call every time StatusIcon message were sent.

that's how often cs sends the icon anyways without your plugin, so I guess it's nothing inefficient
by my logic tho, may be incorrect

yokomo 09-08-2014 10:11

Re: [Help] Completely hide buyzone icon.
 
I tested with this code:
PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("Sekat Zon Beli-belah""0.0.1""wbyokomo")
    
register_message(get_user_msgid("StatusIcon"), "OnStatusIcon")
}

public 
OnStatusIcon(msgidmsgdestid
{  
    static 
szMsg[8]; get_msg_arg_string(2szMsg7);
    if(
equal(szMsg"buyzone") && get_msg_arg_int(1)) 
    {
        
server_print("Hook Called: OnStatusIcon(msgid, msgdest, id)")
        
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0))
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;


You stand in buyzone and see your hlds console, it called every ~0.4 seconds. I'm thinking.. how about we move the buyzone origin? set it origin outside of map so player can't reach/touch it.

aron9forever 09-08-2014 11:31

Re: [Help] Completely hide buyzone icon.
 
Quote:

Originally Posted by yokomo (Post 2195414)
I tested with this code:
PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("Sekat Zon Beli-belah""0.0.1""wbyokomo")
    
register_message(get_user_msgid("StatusIcon"), "OnStatusIcon")
}

public 
OnStatusIcon(msgidmsgdestid
{  
    static 
szMsg[8]; get_msg_arg_string(2szMsg7);
    if(
equal(szMsg"buyzone") && get_msg_arg_int(1)) 
    {
        
server_print("Hook Called: OnStatusIcon(msgid, msgdest, id)")
        
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0))
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;


You stand in buyzone and see your hlds console, it called every ~0.4 seconds. I'm thinking.. how about we move the buyzone origin? set it origin outside of map so player can't reach/touch it.

that's why I was asking what you want to do, remove shop icon or remove buyzone completely
PHP Code:

register_forward(FM_Spawn"precache_spawn"1)


public 
precache_spawn(ent)
{
if(
is_valid_ent(ent))
    {
        static 
szClass[33]
        
entity_get_string(entEV_SZ_classnameszClasssizeof(szClass))
            if(
equal(szClass"func_buyzone"))
                
remove_entity(ent)
    }


This should do the trick
untested tho

HamletEagle 09-08-2014 11:50

Re: [Help] Completely hide buyzone icon.
 
  • Even if you remove buyzone, players can still buy items, the game still knows that there is a buyzone.
  • Also, your way is not the best for removing a buyzone.
  • Spoiler
  • You still need to block buy commands.
  • Another ideea is to simply block the touch with the buyzone( register_touch( "func_buy_zone", "player", "CBasePlayer_Touch" ) ) ( I didn't ever try this, so idk if it will work, better to just use the snippet above ).


All times are GMT -4. The time now is 22:07.

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