Raised This Month: $32 Target: $400
 8% 

Model Change


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alexxxxxxxxx
Member
Join Date: Aug 2017
Old 11-19-2017 , 03:09   Model Change
Reply With Quote #1

Hello, i am using Zombie Plague advance 1.6.1

it happens just sometimesi get overflowed and kicked, in playerspawn when the players have to change the models back into human models

What could be wrong ?

i am using amxmodx 1.8.2
metamod 1.20


PHP Code:
new g_ZombieModels[7][] = 
{
    
"classic_model",
    
"tight_zombie_model",
    
"red_predator_model",
    
"mutant_model",
    
"demon_model",
    
"burner_model",
    
"hunter_model"
};

public 
plugin_precache()
{

    new 
ibuffer[100]
        for (
0sizeof(g_ZombieModels); i++)
        {       
                 
formatex(buffercharsmax(buffer), "models/player/%s/%s.mdl"g_ZombieModels[i], g_ZombieModels[i])
                    
engfunc(EngFunc_PrecacheModelbuffer)      
        }    
}

public 
EventRoundStart()
{
           
set_task(12.0"TaskZombie"TASK_MAKEZOMBIE);
}

public 
TaskZombie()
{
    static 
iPlayersnum
    iPlayersnum 
fnGetAlive()

    if (
iPlayersnum 1)
    {
        
set_task(2.0"TaskZombie"TASK_MAKEZOMBIE)
        return;
    }
    
start_infection_mode(0MODE_NONE)
}

zombieme(idinfectornemesissilentmoderewardsassassin)
{
       
g_zombie[id] = true;
       static 
currentmodel[32], tempmodel[32], already_has_modeli
    already_has_model 
false

    fm_cs_get_user_model
(idcurrentmodelcharsmax(currentmodel))

    
        for (
0sizeof(g_ZombieModels); i++)
        {
            
copy(tempmodelcharsmax(tempmodel), g_ZombieModels[i])
            if (
equal(currentmodeltempmodel)) already_has_model true
        
}
        if (!
already_has_model)
        {
            
formatex(g_playermodel[id], charsmax(g_playermodel[]), g_ZombieModels[g_zombieclass[id]])
                 }            

    if (!
already_has_model)
    {
        if (
g_newround)
            
set_task(5.0 0.25"fm_user_model_update"id+TASK_MODEL)
        else
            
fm_user_model_update(id+TASK_MODEL)
    }
}

start_infection_mode(idmode)
{

    static 
iPlayersnum
    iPlayersnum 
fnGetAlive()
    static 
forward_id

    g_currentmode 
MODE_INFECTION
    g_lastmode 
MODE_INFECTION
    g_allowinfection 
true

    
if (mode == MODE_NONE)
        
id fnGetRandomAlive(random_num(1iPlayersnum))
    
zombieme(id00000
    
forward_id id

    
for (id 1id <= g_maxplayersid++)
    {

        if (!
g_isalive[id])
            continue;

        if (
g_zombie[id])
            continue;
        
        if (
fm_cs_get_user_team(id) != FM_CS_TEAM_CT)
        {
            
remove_task(id+TASK_TEAM)
            
fm_cs_set_user_team(idFM_CS_TEAM_CT)
            
fm_user_team_update(id)
        }
    }
    
set_hudmessage(25500, -1.000.1700.005.001.001.00, -1)
    
ShowSyncHudMsg(0g_iTopMessageSync"%s is the first zombie !!"g_playername[forward_id])
    
g_modestarted true
    g_newround 
false
    ExecuteForward
(g_fwRoundStartg_fwDummyResultMODE_INFECTIONforward_id);
}

public 
fm_cs_set_user_model(taskid)
{
    
set_user_info(ID_MODEL"model"g_playermodel[ID_MODEL])
}

stock fm_cs_get_user_model(playermodel[], len)
{
    
get_user_info(player"model"modellen)
}

public 
fm_user_model_update(taskid)
{
    static 
Float:current_time
    current_time 
get_gametime()
    
    if (
current_time g_models_targettime >= 0.2)
    {
        
fm_cs_set_user_model(taskid)
        
g_models_targettime current_time
    
}
    else
    {
        
set_task((g_models_targettime 0.25) - current_time"fm_cs_set_user_model"taskid)
        
g_models_targettime g_models_targettime 0.25
    
}


Last edited by Alexxxxxxxxx; 12-06-2017 at 16:02. Reason: updated
Alexxxxxxxxx is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 11-19-2017 , 03:56   Re: Model Change
Reply With Quote #2

why don`t you just use zombie plague 5.0.8. pretty sure it has all the features and more

btw. what is the code you gave us? custom zombie class plugin?
__________________
retired chump
DjSoftero is offline
Alexxxxxxxxx
Member
Join Date: Aug 2017
Old 11-19-2017 , 04:07   Re: Model Change
Reply With Quote #3

zombie plague 5.0.8 sucks
those are the change model for zombie only codes of zpa 1.6.1
Alexxxxxxxxx is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-19-2017 , 07:40   Re: Model Change
Reply With Quote #4

That code won't even compile because of a missing quote in the hunter_model name.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 11-19-2017 , 11:03   Re: Model Change
Reply With Quote #5

and how does the plugin know when to update model? you pasted only like half of the code which handles model changing
__________________
retired chump
DjSoftero is offline
Alexxxxxxxxx
Member
Join Date: Aug 2017
Old 11-19-2017 , 15:15   Re: Model Change
Reply With Quote #6

Quote:
Originally Posted by DjSoftero View Post
and how does the plugin know when to update model? you pasted only like half of the code which handles model changing
Yes at logevent Round start. i updated the code
Alexxxxxxxxx is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-19-2017 , 19:51   Re: Model Change
Reply With Quote #7

You have to hook FM_SetClientKeyValue and re-set player model. Learn from this code.
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < basebuilder >

#define ADMIN_FLAG ADMIN_KICK
#define VIP_FLAG ADMIN_LEVEL_H

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;

    if( 
bb_is_user_zombieid ) )
    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 ) && ( ~ get_user_flagsiPlayer ) & VIP_FLAG ) && ! bb_is_user_zombieiPlayer ) )
        {
            
set_user_infoiPlayer"model"g_szAdminPlayerModel );
            return 
FMRES_SUPERCEDE;
        }
    }
    return 
FMRES_IGNORED;

__________________
edon1337 is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 11-20-2017 , 05:40   Re: Model Change
Reply With Quote #8

this only makes the first zombie and gives him the right model. there is still no code which would reset the players model on round start
PHP Code:
public EventRoundStart()
{
           
set_task(12.0"TaskZombie"TASK_MAKEZOMBIE);

this is still not it, it only creates first zombie and sets model for him.
__________________
retired chump
DjSoftero is offline
Alexxxxxxxxx
Member
Join Date: Aug 2017
Old 11-20-2017 , 12:02   Re: Model Change
Reply With Quote #9

Quote:
Originally Posted by edon1337 View Post
You have to hook FM_SetClientKeyValue and re-set player model. Learn from this code.
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < basebuilder >

#define ADMIN_FLAG ADMIN_KICK
#define VIP_FLAG ADMIN_LEVEL_H

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;

    if( 
bb_is_user_zombieid ) )
    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 ) && ( ~ get_user_flagsiPlayer ) & VIP_FLAG ) && ! bb_is_user_zombieiPlayer ) )
        {
            
set_user_infoiPlayer"model"g_szAdminPlayerModel );
            return 
FMRES_SUPERCEDE;
        }
    }
    return 
FMRES_IGNORED;

edon! i have just this at forward setclientkeyvalue

PHP Code:
public fw_SetClientKeyValue(id, const infobuffer[], const key[])
{

    if (
key[0] == 'm' && key[1] == 'o' && key[2] == 'd' && key[3] == 'e' && key[4] == 'l')
        return 
FMRES_SUPERCEDE;
    
    return 
FMRES_IGNORED;

Alexxxxxxxxx is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-20-2017 , 17:51   Re: Model Change
Reply With Quote #10

As you're using Zombie Plague, a simple zp_override_user_model in zp_user_infected_post will do the job. But you have to integrate zp_override_user_model into ZPA, my suggestion: Switch to ZP 4.3 .
__________________

Last edited by edon1337; 11-20-2017 at 17:51.
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 08:52.


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