Modeliu keitimas B flagui

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
KamiN
Gana aktyvus vartotojas
Posts: 227
Joined: 2011 Apr 23 13:17

Modeliu keitimas B flagui

Post by KamiN »

Ar galit padaryti, kad modelius keistu tik B flaga turintiems zaidejams.

Code: Select all

#include <amxmodx>#include <fakemeta>#include <hamsandwich>#include <cstrike> new const CT_MODEL[] = "ctmdl"new const T_MODEL[] = "tmdl"#define MODELSET_TASK 100#define MODELCHANGE_DELAY 0.5new Float:g_models_targettimenew Float:g_roundstarttime new g_has_custom_model[33]new g_player_model[33][32]new g_ctmdl[33]new g_tmdl[33]   /*================================================================================ [Plugin Start]=================================================================================*/ public plugin_precache(){    new modelpath[100]    formatex( modelpath, charsmax( modelpath ), "models/player/%s/%s.mdl", CT_MODEL, CT_MODEL )    engfunc( EngFunc_PrecacheModel, modelpath )     formatex( modelpath, charsmax( modelpath ), "models/player/%s/%s.mdl", T_MODEL, T_MODEL )    engfunc( EngFunc_PrecacheModel, modelpath )} public plugin_init(){    register_plugin( "VIP Models", "0.3", "MeRcyLeZZ" )        register_event( "HLTV", "event_round_start", "a", "1=0", "2=0" )    RegisterHam( Ham_Spawn, "player", "fw_PlayerSpawn", 1 )        register_forward( FM_SetClientKeyValue, "fw_SetClientKeyValue" )    register_forward( FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged" )} /*================================================================================ [Round Start Event]=================================================================================*/ public event_round_start(){    g_roundstarttime = get_gametime()} /*================================================================================ [Player Spawn Event]=================================================================================*/ public fw_PlayerSpawn( id ){    if ( !is_user_alive( id ) || !cs_get_user_team( id ) )        return;        g_ctmdl[id] = cs_get_user_team( id ) == CS_TEAM_CT ? true : false;     g_tmdl[id] = cs_get_user_team( id ) == CS_TEAM_T ? true : false;        remove_task( id + MODELSET_TASK )     if ( g_ctmdl[id] )    {        copy( g_player_model[id], charsmax( g_player_model[] ), CT_MODEL )                new currentmodel[32]        fm_get_user_model( id, currentmodel, charsmax( currentmodel ) )                if ( !equal( currentmodel, g_player_model[id] ) )        {            if ( get_gametime() - g_roundstarttime < 5.0 )                set_task( 5.0 * MODELCHANGE_DELAY, "fm_user_model_update", id + MODELSET_TASK )            else                fm_user_model_update( id + MODELSET_TASK )        }    }    else if ( g_has_custom_model[id] )    {        fm_reset_user_model( id )    }     if ( g_tmdl[id] )    {        copy( g_player_model[id], charsmax( g_player_model[] ), T_MODEL )         new currentmodel[32]        fm_get_user_model( id, currentmodel, charsmax( currentmodel ) )                if ( !equal( currentmodel, g_player_model[id] ) )        {            if ( get_gametime() - g_roundstarttime < 5.0 )                set_task( 5.0 * MODELCHANGE_DELAY, "fm_user_model_update", id + MODELSET_TASK )            else                fm_user_model_update( id + MODELSET_TASK )        }    }    else if ( g_has_custom_model[id] )    {        fm_reset_user_model( id )    }} /*================================================================================ [Forwards]=================================================================================*/ public fw_SetClientKeyValue( id, const infobuffer[], const key[] ){       if ( g_has_custom_model[id] && equal( key, "model" ) )        return FMRES_SUPERCEDE;        return FMRES_IGNORED;} public fw_ClientUserInfoChanged( id ){    if ( !g_has_custom_model[id] )        return FMRES_IGNORED;        static currentmodel[32]    fm_get_user_model( id, currentmodel, charsmax( currentmodel ) )        if ( !equal( currentmodel, g_player_model[id] ) && !task_exists( id + MODELSET_TASK ) )        fm_set_user_model( id + MODELSET_TASK )        return FMRES_IGNORED;} /*================================================================================ [Tasks]=================================================================================*/ public fm_user_model_update( taskid ){    static Float:current_time    current_time = get_gametime()        if ( current_time - g_models_targettime >= MODELCHANGE_DELAY )    {        fm_set_user_model( taskid )        g_models_targettime = current_time    }    else    {        set_task( (g_models_targettime + MODELCHANGE_DELAY) - current_time, "fm_set_user_model", taskid )        g_models_targettime = g_models_targettime + MODELCHANGE_DELAY    }} public fm_set_user_model( player ){    player -= MODELSET_TASK        engfunc( EngFunc_SetClientKeyValue, player, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", g_player_model[player] )        g_has_custom_model[player] = true} /*================================================================================ [Stocks]=================================================================================*/ stock fm_get_user_model( player, model[], len ){    engfunc( EngFunc_InfoKeyValue, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", model, len )} stock fm_reset_user_model( player ){    g_has_custom_model[player] = false        dllfunc( DLLFunc_ClientUserInfoChanged, player, engfunc( EngFunc_GetInfoKeyBuffer, player ) )}

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: Modeliu keitimas B flagui

Post by psychical »

Code: Select all

 public fw_PlayerSpawn( id ){    if ( !is_user_alive( id ) || !cs_get_user_team( id )  || !(get_user_flags(id) & ADMIN_LEVEL_H)) // tik cia flagas t, b jei neklystu ADMIN_RESERVATION        return;    
P.S. Daugiau flag'u rasi cia: http://www.amxmodx.org/funcwiki.php?go=module&id=1

KamiN
Gana aktyvus vartotojas
Posts: 227
Joined: 2011 Apr 23 13:17

Re: Modeliu keitimas B flagui

Post by KamiN »

Sitas modeliu keitimo variantas dar blogesnis, negu sitas http://amxmodx.lt/viewtopic.php?f=17&t=665

Kai pradeda koki 20 uzrasu SZ_GETSPACE OVERFLOW ON NICKAS metyt konsolei ir kickina is serverio zaidejus.
Last edited by KamiN on 2011 Jun 10 18:15, edited 3 times in total.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest