yesterday 发表于 2010-6-2 11:52:18

设置玩家模型插件(源)+inc

附件:

lys192829 发表于 2010-6-3 17:01:55

什么都没有怎么弄啊   连个说明也不留

525904532 发表于 2010-6-3 17:56:45

如果是真的的话就不错~

525904532 发表于 2010-6-3 18:06:22

#if defined _playermodel_included
#endinput
#endif
#define _playermodel_included

#pragma reqlib playermodel

#if !defined AMXMODX_NOAUTOLOAD
        #pragma loadlib playermodel
#endif

native fm_set_user_model(index, model[])
native fm_reset_user_model(index)

525904532 发表于 2010-6-3 18:07:24

*        Copyright ?2008, ConnorMcLeod

        Set Player Model is free software;
        you can redistribute it and/or modify it under the terms of the
        GNU General Public License as published by the Free Software Foundation.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with Set Player Model; if not, write to the
        Free Software Foundation, Inc., 59 Temple Place - Suite 330,
        Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Set Player Model"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

#define MAX_MODEL_LENGTH        32
#define MAX_PLAYERS        32

new const MODEL[] = "model"

new g_szModel

new g_iMaxPlayers

new g_iFwd, g_iMsg
new gmsgClCorpse

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)

        gmsgClCorpse = get_user_msgid("ClCorpse")
        g_iMaxPlayers = get_maxplayers()
}

public client_disconnect(id)
{
        g_szModel = 0
        Set_Plugin_State(id, false)
}

public plugin_natives()
{
        register_library("playermodel")
        register_native("fm_set_user_model", "native_fm_set_user_model")
        register_native("fm_reset_user_model", "native_fm_reset_user_model")
}

public native_fm_set_user_model(iPlugin, iParams)
{
        new id = get_param(1)

        if( ! ( 1 <= id <= g_iMaxPlayers ) )
        {
                log_error(AMX_ERR_NATIVE, "Invalid index %d", id)
                return 0
        }

        if( !is_user_connected(id) )
        {
                log_error(AMX_ERR_NATIVE, "Player %d not connected", id)
                return 0
        }

        Set_Plugin_State(id, true)

        new szModel
        get_string(2, szModel, charsmax(szModel))

        formatex(g_szModel, charsmax(szModel), szModel)
        set_user_info(id, MODEL, g_szModel)

        return 1
}

public native_fm_reset_user_model(iPlugin, iParams)
{
        new id = get_param(1)

        if( ! ( 1 <= id <= g_iMaxPlayers ) )
        {
                log_error(AMX_ERR_NATIVE, "Invalid index %d", id)
                return 0
        }

        if(!g_szModel)
        {
                return 0
        }

        g_szModel = 0

        if( is_user_connected(id) )
        {
                dllfunc(DLLFunc_ClientUserInfoChanged, id, engfunc(EngFunc_GetInfoKeyBuffer, id))
        }

        Set_Plugin_State(id, false)

        return 1
}

public SetClientKeyValue(id, szInfoBuffer[], szKey[], szValue[])
{
        if(g_szModel && equal(szKey, MODEL) && !equal(szValue, g_szModel))
        {
                set_user_info(id, MODEL, g_szModel)
                return FMRES_SUPERCEDE
        }
        return FMRES_IGNORED
}

public Message_ClCorpse()
{
        new id = get_msg_arg_int(12)
        if( g_szModel )
        {
                set_msg_arg_string(1, g_szModel)
        }
}

Set_Plugin_State(id, bool:bActive)
{
        if( bActive )
        {
                if( !g_iFwd )
                {
                        g_iFwd = register_forward(FM_SetClientKeyValue, "SetClientKeyValue")
                }
                if( !g_iMsg)
                {
                        g_iMsg = register_message(gmsgClCorpse, "Message_ClCorpse")
                }
        }
        else
        {
                for(new i=1; i<=g_iMaxPlayers; i++)
                {
                        if( i != id && g_szModel )
                        {
                                return
                        }
                }

                if( g_iFwd )
                {
                        unregister_forward(FM_SetClientKeyValue, g_iFwd)
                        g_iFwd = 0
                }

                if( g_iMsg )
                {
                        unregister_message(gmsgClCorpse, g_iMsg)
                        g_iMsg = 0
                }
        }

madness 发表于 2010-11-5 15:11:59

啥意思   下载下

a314205702a 发表于 2011-3-5 23:46:25

怎么用呀???给个图看看撒!!!!

a5913483 发表于 2011-3-13 01:43:33

我也下来看看
页: [1]
查看完整版本: 设置玩家模型插件(源)+inc