|
发表于 2007-11-10 19:41:34
|
显示全部楼层
来自 中国–甘肃–兰州
回复: Rulzy版主近来帮下忙!重要!
这里有两个换服装插件的源代码,希望对你有所帮助:
这是第一个换服装插件的源代码(randomplayermodels.sma):/* AMXModX Plugin
RandomPlayerModels 1.1
------------
By: Ywa*NL
E-mail/MSN: ywa@xoti.net
------------
Description: On every new round everyone get a random player model.
You can change the random models to your own.
It will precache the models too.
In this version you can restrict models to be for CT/T team.
------------
CVars:
amx_randmodels (Default 1)
------------
Todo:
- Create a file and read from there the model names.
------------
*/
#include <amxmodx>
#include <cstrike>
#include <csx>
// comment this line, the array "models" will be used, else the arrays "ctmodels" and "tmodels"
#define TEAMMODELS;
// Model array's
#if defined TEAMMODELS
#define MAX_T_MODELS 6
new t_models[MAX_T_MODELS][] = {"leet","arctic","guerilla","terror","alien4","goomba"};
#define MAX_CT_MODELS 7
new ct_models[MAX_CT_MODELS][] = {"sas","gign","gsg9","urban","vip","alien4","goomba"};
#else
#define MAXMODELS 11
new models[MAXMODELS][] = {"arctic","gign","gsg9","guerilla","leet","sas","terror","urban","vip","alien4","goomba"};
#endif
// Don't change this lines please!
#define PLUGIN "RandomPlayerModels"
#define VERSION "1.1"
#define AUTHOR "Ywa*NL & Rulzy"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_cvar("amx_randmodels", "1");
register_event("ResetHUD","model","be");
register_event("DeathMsg","eDeathMsg","a")
}
public plugin_precache()
{
new i;
#if defined TEAMMODELS
// T
for (i=0; i<MAX_T_MODELS; i++)
{
new model[64];
format(model,63,"models/player/%s/%s.mdl",t_models,t_models);
precache_model(model);
}
// CT
for (i=0; i<MAX_CT_MODELS; i++)
{
new model[64];
format(model,63,"models/player/%s/%s.mdl",ct_models,ct_models);
precache_model(model);
}
#else
for (i=0; i<MAXMODELS; i++)
{
new model[64];
format(model,63,"models/player/%s/%s.mdl",models,models);
precache_model(model);
}
#endif
return PLUGIN_CONTINUE;
}
public model(id)
{
if ( !get_cvar_num("amx_randmodels") )
return PLUGIN_CONTINUE;
if(!is_user_connected(id)) return PLUGIN_CONTINUE;
new num;
#if defined TEAMMODELS
if (cs_get_user_team(id) == CS_TEAM_T)
{
// Choose random model
num = random_num(0,MAX_T_MODELS-1);
// Change player model
cs_set_user_model(id, t_models[num]);
// Hudmessage
set_hudmessage(255, 0, 0, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);
show_hudmessage(id, "Current Model: %s", t_models[num]);
// Chat message
//client_print(id, print_chat, "[AMXX] Current Model: %s", t_models[num]);
} else if(cs_get_user_team(id) == CS_TEAM_CT) {
// Choose random model
num = random_num(0,MAX_CT_MODELS-1);
// Change player model
cs_set_user_model(id, ct_models[num]);
// Hudmessage
set_hudmessage(0, 0, 255, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);
show_hudmessage(id, "Current Model: %s", ct_models[num]);
// Chat message
//client_print(id, print_chat, "[AMXX] Current Model: %s", ct_models[num]);
}
#else
if (cs_get_user_team(id) == CS_TEAM_T || cs_get_user_team(id) == CS_TEAM_CT)
{
// Choose random model
num = random_num(0,MAXMODELS-1);
// Change player model
cs_set_user_model(id, models[num]);
// Hudmessage
set_hudmessage(32, 202, 32, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);
show_hudmessage(id, "Current Model: %s", models[num]);
// Chat message
//client_print(id, print_chat, "[AMXX] Current Model: %s", models[num]);
}
#endif
return PLUGIN_CONTINUE;
}
public eDeathMsg()
{
new victim=read_data(2);
if(is_user_connected(victim))
cs_reset_user_model(victim);
}
public client_death(killer, victim, wpnindex, hitplace, TK)
{
if(wpnindex == CSW_C4 && is_user_connected(victim))
cs_reset_user_model(victim);
} |
|