搜索
查看: 2382|回复: 7

Rulzy版主近来帮下忙!重要!

[复制链接]
发表于 2007-11-5 16:33:46 | 显示全部楼层 |阅读模式 来自 中国–广西–南宁–武鸣区
对路径来源的判断,和警察土匪的判断!

new modelfile[64];
format(modelfile,63,"models/player/%s/%s.mdl",output,output);

我想在这里加入警察和土匪的判断该怎么加?就是说如果自己是警察,则modelfile是
format(modelfile,63,"models/player/jc/%s/%s.mdl",output,output);
如果自己是土匪,则modelfile是
format(modelfile,63,"models/player/tf/%s/%s.mdl",output,output);

这个我是修改换服装插件的,让玩家自己选择服装警察只能看到警察的服装,土匪只能看到土匪的服装,不知道Rulzy版主这个该怎么添加代码。。。。。
发表于 2007-11-5 17:59:02 | 显示全部楼层 来自 中国–福建–厦门

回复: Rulzy版主近来帮下忙!重要!

没明白……什么意思啊
回复

使用道具 举报

 楼主| 发表于 2007-11-5 18:20:47 | 显示全部楼层 来自 中国–广西–南宁–武鸣区

回复: Rulzy版主近来帮下忙!重要!

源码是给出这样
new modelfile[64];
format(modelfile,63,"models/player/%s/%s.mdl",output,output);

给出的是模型的路径,在游戏里的效果是玩家换服装的时候看到这个路径下的所有服装。这样得到的结果是警察和土匪共用这里的服装不能分辨。
然后我就想把他们分开。
就是加个判断,再加个路径。做警察的时候只显示警察的路径,做土匪的时候只显示土匪的路径。
当然,我不是很熟代码。这里把我错误的代码给你看下,希望你能明白我的意思。
        // check if model is actually there
        new modelfile[64];
        new CsTeams:userTeam = cs_get_user_team(id)
        if (userTeam == CS_TEAM_T)
        cs_get_user_model(modelfile,63,"models/player/TE/%s/%s.mdl",output,output);
        else if(userTeam == CS_TEAM_CT)
        cs_get_user_model(modelfile,63,"models/player/JC/%s/%s.mdl",output,output);
哈~我上面肯定是错的~忘能帮我改正
回复

使用道具 举报

 楼主| 发表于 2007-11-5 18:26:04 | 显示全部楼层 来自 中国–广西–南宁–武鸣区

回复: Rulzy版主近来帮下忙!重要!

// check if model is actually there
        new modelfile[64];
        new CsTeams:userTeam = cs_get_user_team(id)
        if (userTeam == CS_TEAM_T)
        format(modelfile,63,"models/player/TE/%s/%s.mdl",output,output);
        else if(userTeam == CS_TEAM_CT)
        format(modelfile,63,"models/player/JC/%s/%s.mdl",output,output);
回复

使用道具 举报

 楼主| 发表于 2007-11-5 18:27:00 | 显示全部楼层 来自 中国–广西–南宁–武鸣区

回复: Rulzy版主近来帮下忙!重要!

这样判断个意思不知道对不对。?郁闷中
回复

使用道具 举报

发表于 2007-11-10 17:42:08 | 显示全部楼层 来自 中国–广东–佛山–禅城区

回复: Rulzy版主近来帮下忙!重要!

这样一来其实同指定模型有什么区别?
回复

使用道具 举报

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

使用道具 举报

发表于 2007-11-10 19:42:43 | 显示全部楼层 来自 中国–甘肃–兰州

回复: Rulzy版主近来帮下忙!重要!

这是第二个换服装插件的源代码(change_skin.sma):
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <string>
#include <engine>
#define holdViewTime 1.5
new mode=1;
new bool:changedSkin[33]={false,...};
new CT_MODEL[3][]={"vip","alien4","goomba"};
new T_MODEL[2][]={"alien4","goomba"};
public plugin_init()
{
register_plugin("Change Skin","0.2","Enigmaya & X-man");
register_concmd("amx_skin","adminControl",ADMIN_LEVEL_A,"<0-disable 1-random mode 2-interconvert mode>");
register_logevent("new_round", 2, "0=World triggered", "1=Round_Start")
register_event("DeathMsg","eDeathMsg","a")
        register_cvar("amx_skin3RD","0");
return PLUGIN_CONTINUE;
}
public adminControl(id, level, cid)
{
      if ( !cmd_access(id, level, cid, 2) )
          return PLUGIN_HANDLED;
   
new Arg1[1];
      read_argv(1, Arg1, 1);

mode=str_to_num(Arg1);

if( !mode )
  checkALl();
return PLUGIN_HANDLED;
}
public new_round()
{
if( !mode )
  return PLUGIN_CONTINUE;
set_task(0.2,"roundDelay");

return PLUGIN_CONTINUE;
}
public roundDelay()
{
checkALl();
return PLUGIN_CONTINUE;
}
checkALl()
{
new players[32],num;
get_players(players,num,"a");
for(new i=0;i<num;i++)
{
  if( changedSkin[ players ] ){
   cs_reset_user_model( players );
   changedSkin[ players ]=false;
  }
  if( mode ){
   if( !random(2) || mode==2 ){
    changeSkin( players );
    changedSkin[ players ]=true;
   }
  }
}
}
changeSkin(id)
{

if( cs_get_user_team(id)==CS_TEAM_T ) //TERRORIST
{
  cs_set_user_model( id,T_MODEL[ random(2) ] );

                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_MODEL[ random(2) ] );
        }
else if( cs_get_user_team(id)==CS_TEAM_CT ) //CT
{
  cs_set_user_model( id,CT_MODEL[ random(3) ] );

                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_MODEL[ random(3) ] );
        }
if( get_cvar_num("amx_skin3RD")==1 ){
  set_view(id,CAMERA_3RDPERSON);
  set_task(holdViewTime,"resetView",id);
}

return 1;
}
public resetView(id)
{
set_view(id,CAMERA_NONE);
}
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);
}
回复

使用道具 举报

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

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