Raised This Month: $ Target: $400
 0% 

block key 'model' & used it for other case ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 04-08-2017 , 04:14   Re: block key 'model' & used it for other case ?
Reply With Quote #1

Quote:
Originally Posted by PRoSToTeM@ View Post
You can't change client-side model value. You should check your real model with some third person view plugin.
i want block it can i do that ? .. yes im yes 3D view to chack model

edon1337
you code is wrong i mean here
&& !g_asModels[ 0 ] )
this arry should be index

and this full code :

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>

#define PLUGIN   "Test"
#define AUTHOR   "LetiLetiLepestok"
#define VERSION   "1.0"

#define RANDOMSKINS 3

new const Set_ClassesRANDOMSKINS][] =
{
    
"blue",
    
"red",
    
"helmet"
}
new 
g_asModels[33][32]

public 
plugin_init()
{
   
register_plugin(PLUGINVERSIONAUTHOR)
   
register_forward(FM_SetClientKeyValue"SetClientKeyValue"0);
   
register_clcmd("set_model""set_player_mdl")
   
register_clcmd("say ss""set_views")
   
register_clcmd("say gg""set_test")
}


public 
set_views(id)
   
set_view(idCAMERA_3RDPERSON)  // i use this to see if my skin is changed :)

   
   
public set_test(id)
   
client_cmd(id"set_model %s"Set_Classes[random(RANDOMSKINS)])
   
   
public 
set_player_mdl(player)
{
    new 
sModel[32]
    
read_argv(1sModelcharsmax(sModel))
    
    
trim(sModel)
    
remove_quotes(sModel)
    if(
equal(sModel""))
    
g_asModels[player] = ""
    
g_asModels[player] = sModel
    
    set_user_info
(player"model"g_asModels[player])   
    return 
PLUGIN_HANDLED
}

public 
SetClientKeyValue(player, const szInfoBuffer[], const szKey[], const szValue[])
{
    new 
sCurModel[32], PlayerChoice[32];
        
    
//hl_get_user_model(player, sCurModel, charsmax(sCurModel));
    
get_user_info(player"model"sCurModel31);
        

    if(
equal(szKey"model") && is_user_connected(player) && !equal(g_asModels[player], ""))
    {
        
        new 
name[32]//, model[32];
        
        
get_user_name(playername31);
        
//get_user_info(id, "model", model, 31);
        
log_amx("check model %s %s"namesCurModel);

        if(
changes[player] > || equali(sCurModel[player], PlayerChoice) && equali(sCurModel[player], name) )
        {
            
//hl_set_user_model(player, PlayerChoice[player]);
            
client_print(playerprint_chat" ====== Stop  change model ======= ")
            
set_user_info(player"model"PlayerChoice[player]) 
            
//return FMRES_IGNORED
            
return FMRES_HANDLED
        
}
        
client_print(playerprint_chat" ====== Auto  change model ======= ")
        
changes[player]++
        return 
FMRES_SUPERCEDE
        
    
}
    return 
FMRES_IGNORED

__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 04-08-2017 , 06:18   Re: block key 'model' & used it for other case ?
Reply With Quote #2

Quote:
Originally Posted by abdobiskra View Post
i want block it can i do that ? .. yes im yes 3D view to chack model

edon1337
you code is wrong i mean here
&& !g_asModels[ 0 ] )
this arry should be index

and this full code :

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>

#define PLUGIN   "Test"
#define AUTHOR   "LetiLetiLepestok"
#define VERSION   "1.0"

#define RANDOMSKINS 3

new const Set_ClassesRANDOMSKINS][] =
{
    
"blue",
    
"red",
    
"helmet"
}
new 
g_asModels[33][32]

public 
plugin_init()
{
   
register_plugin(PLUGINVERSIONAUTHOR)
   
register_forward(FM_SetClientKeyValue"SetClientKeyValue"0);
   
register_clcmd("set_model""set_player_mdl")
   
register_clcmd("say ss""set_views")
   
register_clcmd("say gg""set_test")
}


public 
set_views(id)
   
set_view(idCAMERA_3RDPERSON)  // i use this to see if my skin is changed :)

   
   
public set_test(id)
   
client_cmd(id"set_model %s"Set_Classes[random(RANDOMSKINS)])
   
   
public 
set_player_mdl(player)
{
    new 
sModel[32]
    
read_argv(1sModelcharsmax(sModel))
    
    
trim(sModel)
    
remove_quotes(sModel)
    if(
equal(sModel""))
    
g_asModels[player] = ""
    
g_asModels[player] = sModel
    
    set_user_info
(player"model"g_asModels[player])   
    return 
PLUGIN_HANDLED
}

public 
SetClientKeyValue(player, const szInfoBuffer[], const szKey[], const szValue[])
{
    new 
sCurModel[32], PlayerChoice[32];
        
    
//hl_get_user_model(player, sCurModel, charsmax(sCurModel));
    
get_user_info(player"model"sCurModel31);
        

    if(
equal(szKey"model") && is_user_connected(player) && !equal(g_asModels[player], ""))
    {
        
        new 
name[32]//, model[32];
        
        
get_user_name(playername31);
        
//get_user_info(id, "model", model, 31);
        
log_amx("check model %s %s"namesCurModel);

        if(
changes[player] > || equali(sCurModel[player], PlayerChoice) && equali(sCurModel[player], name) )
        {
            
//hl_set_user_model(player, PlayerChoice[player]);
            
client_print(playerprint_chat" ====== Stop  change model ======= ")
            
set_user_info(player"model"PlayerChoice[player]) 
            
//return FMRES_IGNORED
            
return FMRES_HANDLED
        
}
        
client_print(playerprint_chat" ====== Auto  change model ======= ")
        
changes[player]++
        return 
FMRES_SUPERCEDE
        
    
}
    return 
FMRES_IGNORED

I don't see how this makes sense.
Code:
!equal(g_asModels[player], "")

It's checking if string is empty, right?
__________________
edon1337 is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 04-08-2017 , 09:28   Re: block key 'model' & used it for other case ?
Reply With Quote #3

Quote:
Originally Posted by edon1337 View Post
I don't see how this makes sense. Code:
!equal(g_asModels[player], "")


It's checking if string is empty, right?
If it is not empty
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 04-08-2017 , 13:56   Re: block key 'model' & used it for other case ?
Reply With Quote #4

Quote:
Originally Posted by abdobiskra View Post
If it is not empty
Yes, my bad, I didn't notice the '!'. Still that's kind of an irrelevant way of checking if a string is empty. Better way would be this
Code:
if( ! g_asModels[ 0 ] )
just like in the code I gave you.
__________________
edon1337 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 17:48.


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