搜索
查看: 2694|回复: 7

[AMXX 带源码] 设置玩家模型插件(源)+inc

[复制链接]
发表于 2010-6-2 11:52:18 | 显示全部楼层 |阅读模式 来自 甘肃兰州
附件:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2010-6-3 17:01:55 | 显示全部楼层 来自 辽宁大连
什么都没有  怎么弄啊   连个说明也不留
回复

使用道具 举报

发表于 2010-6-3 17:56:45 | 显示全部楼层 来自 江西南昌
如果是真的的话就不错~
回复

使用道具 举报

发表于 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)
回复

使用道具 举报

发表于 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[MAX_PLAYERS+1][MAX_MODEL_LENGTH]

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[id][0] = 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[MAX_MODEL_LENGTH]
        get_string(2, szModel, charsmax(szModel))

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

        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[id][0])
        {
                return 0
        }

        g_szModel[id][0] = 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[id][0] && equal(szKey, MODEL) && !equal(szValue, g_szModel[id]))
        {
                set_user_info(id, MODEL, g_szModel[id])
                return FMRES_SUPERCEDE
        }
        return FMRES_IGNORED
}

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

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[i][0] )
                        {
                                return
                        }
                }

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

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

使用道具 举报

发表于 2010-11-5 15:11:59 | 显示全部楼层 来自 河北石家庄
啥意思   下载下
回复

使用道具 举报

发表于 2011-3-5 23:46:25 | 显示全部楼层 来自 广东江门
怎么用呀???给个图看看撒!!!!
回复

使用道具 举报

发表于 2011-3-13 01:43:33 | 显示全部楼层 来自 新疆石河子
我也下来看看
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表