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

Model Changer Problem


Post New Thread Reply   
 
Thread Tools Display Modes
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-21-2017 , 16:45   Re: Model Changer Problem
Reply With Quote #11

You guys are speaking no-sense. Test this code if you want.
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

#define ADMIN_FLAG ADMIN_KICK

new g_szAdminPlayerModel[ ] = "hsk_admin1"

public plugin_init( )
{
    
register_plugin"Admin Model""1.0""DoNii" );

    
RegisterHamHam_Spawn"player""fw_HamSpawnPost");

    
register_forwardFM_SetClientKeyValue"fw_FMSetClientKeyValuePre") ;
}

public 
plugin_precache( )
{
    new 
szBuffer64 ];
    
formatexszBuffercharsmaxszBuffer ), "models/player/%s/%s.mdl"g_szAdminPlayerModelg_szAdminPlayerModel );

    
precache_modelszBuffer );
}

public 
fw_HamSpawnPostid )
{
    if( ! 
is_user_connectedid ) )
    return 
HAM_IGNORED;

    if( ~ 
get_user_flagsid ) & ADMIN_FLAG )
    return 
HAM_IGNORED;

    
set_user_infoid"model"g_szAdminPlayerModel );
    return 
HAM_IGNORED;
}

public 
fw_FMSetClientKeyValuePreiPlayer, const szBuffer[ ], const szKey[ ] )
{
    if( 
equalszKey"model" ) )
    {    
        if( ( 
get_user_flagsiPlayer ) & ADMIN_FLAG ) )
        {
            
set_user_infoiPlayer"model"g_szAdminPlayerModel );
            
log_to_file"TestModel.txt""szBuffer[] = %s | szKey = %s |"szBufferszKey );
            
            return 
FMRES_SUPERCEDE;
        }
    }
    return 
FMRES_IGNORED;

+ I added a log file to prove you wrong.
PHP Code:
L 11/21/2017 22:39:52szBuffer[] = \model\gordon\    | szKey model |
L 11/21/2017 22:39:52szBuffer[] = \model\hsk_admin1 szKey model |
L 11/21/2017 22:39:53szBuffer[] = \model\hsk_admin1 szKey model |
L 11/21/2017 22:39:53szBuffer[] = \model\hsk_admin1 szKey model 
You see that it overrides 'gordon' model, I wrote multiple times 'model gordon' and the skin didn't change.
__________________

Last edited by edon1337; 11-21-2017 at 16:46.
edon1337 is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-21-2017 , 16:48   Re: Model Changer Problem
Reply With Quote #12

Quote:
Originally Posted by edon1337 View Post
And what is that plugin using? FM_SetClientKeyValue.
It's also hooking the forward
register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")

and checking every time userinfo is supposed to change (when players type model asdf in console, or when server changes it) and blocking them if they're not from the server

it's done in a neat package that handles all problems including delay to avoid overflows, that's why I recommended it, no point in reinventing the wheel



I wouldn't be talking about this if I hadn't personally tried all combinations and noticed this problem myself, which you can only do if you have a server that actually uses these functions, dickhead players willing to abuse it and high enough traffic to notice overflows when changing all skins at once



edit:: I guess I was wrong with what I understood from your suggestion, I thought it implied only changing user's info string once as that's a common error
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by aron9forever; 11-21-2017 at 16:54.
aron9forever is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-21-2017 , 16:54   Re: Model Changer Problem
Reply With Quote #13

Quote:
Originally Posted by aron9forever View Post
It's also hooking the forward
register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
Quote:
Originally Posted by edon1337 View Post
Use set_user_info + FM_SetClientKeyValue.
And what have I been saying all this time?

Quote:
Originally Posted by aron9forever View Post
it's done in a neat package that handles all problems including delay to avoid overflows, that's why I recommended it, no point in reinventing the wheel
That plugin is more of an API, the OP needs a plugin to let user choose his skin. About the overflow, I do agree that his delay method is alright.

Quote:
Originally Posted by aron9forever View Post
I wouldn't be talking about this if I hadn't personally tried all combinations and noticed this problem myself, which you can only do if you have a server that actually uses these functions, dickhead players willing to abuse it and high enough traffic to notice overflows when changing all skins at once
What problems are you talking about? I'm using almost the same method as his API, I don't get what you're trying to explain.
__________________

Last edited by edon1337; 11-21-2017 at 16:56.
edon1337 is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-21-2017 , 16:59   Re: Model Changer Problem
Reply With Quote #14

Quote:
Originally Posted by edon1337 View Post
What problems are you talking about? I'm using almost the same method as his API, I don't get what you're trying to explain.
if you don't set a delay between model changes, and you change all player models at 32 slot they can easily get disconnected because of an overflow. The API also includes this delaying regardless of the number of clients you execute on every time you use the command.

there's no point in rewriting all of this inside another plugin when you'll have to copy it in every plugin where you want to change a model, just use the API, along with the team change API which is also as useful
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by aron9forever; 11-21-2017 at 17:00.
aron9forever is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-26-2017 , 01:21   Re: Model Changer Problem
Reply With Quote #15

Quote:
Originally Posted by Saint Sinner View Post
After chose a model , model does not change , why?

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

new const Plugin[] = "Models Menu";
new const Version[] = "1.0";
new const Author[] = "=";

//--------------------------------------------------------------------------
new const Model_One[] = "models/player/Kloun/kloun.mdl"; 
new const Model_Two[] = "models/player/Naruto/naruto.mdl"; 
new const Model_Theree[] = "models/player/Marihuana/marihuana.mdl"; 
new const Model_Four[] = "models/player/Jason/jason.mdl";
new const Model_Five[] = "models/player/Jack/jack.mdl";

#define Admin_Access ADMIN_RCON
//--------------------------------------------------------------------------

new g_Menu;

public plugin_precache()
{
precache_model( Model_One );
precache_model( Model_Two );
precache_model( Model_Theree );
precache_model( Model_Four );
precache_model( Model_Five );

}

public plugin_init()
{
register_plugin( Plugin, Version, Author );

register_clcmd( "say /skin", "ClientCommand_Menu" );
register_clcmd( "say_team /skin", "ClientCommand_Menu" );

g_Menu = menu_create( "Select your model:", "Model_Menu_Handler" );

//--------------------------------
menu_additem( g_Menu, "KloYyn" );
menu_additem( g_Menu, "Narut0o" );
menu_additem( g_Menu, "MariHuana" );
menu_additem( g_Menu, "Jaso0on" );
menu_additem( g_Menu, "JacCcKk" );

//--------------------------------
}

public ClientCommand_Menu( id )
{
if( get_user_flags( id ) & Admin_Access && is_user_alive( id ) && cs_get_user_team( id ) == CS_TEAM_CT )
{
menu_display( id, g_Menu );
}
else
{
client_print( id, print_chat, "This command is not valid for you!" );
}
}

public Model_Menu_Handler( id, menu, item )
{
if( item != MENU_EXIT )
{
switch( item )
{
case 0:
{
cs_set_user_model( id, "Kloun" );
client_print( id, print_chat, "You chose the Kloun model" );
}
case 1:
{
cs_set_user_model( id, "Naruto" );
client_print( id, print_chat, "You chose the Naruto model" );
} 
case 2:
{ 
cs_set_user_model( id, "Marihuana" );
client_print( id, print_chat, "You chose the Marihuana model" );
} 
case 3:
{ 
cs_set_user_model( id, "Jason" );
client_print( id, print_chat, "You chose the Jason model" );
} 
case 4:
{ 
cs_set_user_model( id, "Jack" );
client_print( id, print_chat, "You chose the Jack model" );
}
}
}
}
update your amxmodx this issue has been fixed in latest update
Don't use Reamxmodx
indraraj striker 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 05:22.


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