找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 730|回复: 6

求服里的某插件源码{片段也行}

[复制链接]

该用户从未签到

发表于 2010-3-10 00:03:23 | 显示全部楼层 |阅读模式
求服里修改cl_yawspeed就提示LJ脚本的那个
我发现控制台跟CFG的都会提示
不发完整的插件源码也行只要拦截这块的就可以了
T_T开了个死亡服发现有些人用自动压枪的脚本
想那啥那啥- -!

该用户从未签到

发表于 2010-3-10 00:23:47 | 显示全部楼层
貌似jumpstats里就有类似的...

该用户从未签到

发表于 2010-3-10 01:54:38 | 显示全部楼层
想做脚本

该用户从未签到

发表于 2010-3-10 02:49:57 | 显示全部楼层
jumpstats里的做法是建立一个task,每1秒检查一下client cvars设置

该用户从未签到

 楼主| 发表于 2010-3-12 01:00:15 | 显示全部楼层
jumpstats里的做法是建立一个task,每1秒检查一下client cvars设置
fantasist 发表于 2010-3-10 02:49



那个函数不行
客户端版本低于 3328就S13了
除非有办法检测客户端版本

该用户从未签到

发表于 2010-3-12 11:42:32 | 显示全部楼层
  1. #include <amxmodx>
  2. #include <fakemeta>

  3. #pragma semicolon 1

  4. new const gPLUGIN[] = "[KzM] Script Detector";
  5. new const gVERSION[] = "1.1";
  6. new const gAUTHOR[] = "[KzM] Fatalis";

  7. new const gLOOPTYPES[][] =
  8. {
  9. "special",
  10. "rebuy",
  11. "autobuy"
  12. };

  13. new gRandomStrings[3][4];
  14. new gAliases[129];

  15. new gMsgSayText;
  16. new gMaxPlayers;

  17. new gTimesDetected[33];

  18. new gCvarBanTime;
  19. new gCvarPunishment;
  20. new gCvarBanMode;

  21. public plugin_init()
  22. {
  23. register_plugin(gPLUGIN, gVERSION, gAUTHOR);

  24. register_cvar("fatalis", "sd1.1", FCVAR_SERVER, 0.0);

  25. gMsgSayText = get_user_msgid("SayText");
  26. gMaxPlayers = get_maxplayers();

  27. gCvarBanTime = register_cvar("kzm_sd_bantime", "30", 0, 0.0);
  28. gCvarPunishment = register_cvar("kzm_sd_punishment", "1", 0, 0.0);
  29. gCvarBanMode = register_cvar("kzm_sd_banmode", "1", 0, 0.0);

  30. register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0);

  31. new szCmd[10] = "kzm_sd";
  32. for( new i = 6; i < 10; i++ )
  33. {
  34. szCmd[i] = random_num('a', 'z');
  35. }

  36. register_clcmd(szCmd, "cmdScriptDetected", -1, "");

  37. for( new i = 0; i < 3; i++ )
  38. {
  39. for( new j = 0; j < 3; j++ )
  40. {
  41. gRandomStrings[i][j] = random_num('a', 'z');
  42. }
  43. }

  44. format(gAliases, 128,
  45. ";alias cl_yawspeed say 长跳脚本类;alias _special %s %s;alias cl_rebuy %s %s;alias cl_autobuy %s %s",
  46. szCmd, gRandomStrings[0],
  47. szCmd, gRandomStrings[1],
  48. szCmd, gRandomStrings[2]);

  49. return PLUGIN_CONTINUE;
  50. }

  51. public fwdPlayerPreThink(plr)
  52. {
  53. if( pev(plr, pev_button)&IN_JUMP
  54. && !(pev(plr, pev_oldbuttons)&IN_JUMP) )
  55. {
  56. client_cmd(plr, gAliases);
  57. }

  58. return FMRES_IGNORED;
  59. }

  60. public client_putinserver(plr)
  61. {
  62. gTimesDetected[plr] = 0;

  63. return PLUGIN_CONTINUE;
  64. }

  65. public cmdScriptDetected(plr)
  66. {
  67. if( !is_user_alive(plr)
  68. || fnIsOnGround(plr) )
  69. {
  70. return PLUGIN_HANDLED;
  71. }

  72. new szArg[7];
  73. read_argv(1, szArg, 6);

  74. for( new i = 0; i < 3; i++ )
  75. {
  76. if( !strcmp(szArg, gRandomStrings[i], 0) )
  77. {
  78. switch( i )
  79. {
  80. case 0:
  81. {
  82. fnPunish(plr, i);
  83. }
  84. case 1,2:
  85. {
  86. switch( ++gTimesDetected[plr] )
  87. {
  88. case 1,2:
  89. {
  90. fnGreenChat(plr, " 服务器禁止使用该命令.");
  91. }
  92. case 3:
  93. {
  94. fnPunish(plr, i);
  95. gTimesDetected[plr] = 0;
  96. }
  97. }
  98. }
  99. }

  100. break;
  101. }
  102. }

  103. return PLUGIN_HANDLED;
  104. }

  105. bool:fnIsOnGround(plr) // surf_olympics.sma - OneEyed
  106. {
  107. new flags = pev(plr, pev_flags);

  108. if( (flags&FL_ONGROUND) || (flags & FL_PARTIALGROUND)
  109. ||( flags&FL_INWATER )
  110. ||( flags&FL_CONVEYOR )
  111. ||( flags&FL_FLOAT) )
  112. {
  113. return true;
  114. }

  115. return false;
  116. }

  117. fnGreenChat(plr, const message[], {Float,Sql,Result,_}:...)
  118. {
  119. static msg[192];
  120. msg[0] = 0x04;

  121. vformat(msg[1], 190, message, 3);

  122. if( plr > 0 && plr <= gMaxPlayers )
  123. {
  124. message_begin(MSG_ONE, gMsgSayText, {0, 0, 0}, plr);
  125. write_byte(plr);
  126. write_string(msg);
  127. message_end();
  128. }
  129. else if( plr == 0 )
  130. {
  131. for( new i = 1; i <= gMaxPlayers; i++ )
  132. {
  133. if( !is_user_connected(i) )
  134. {
  135. continue;
  136. }

  137. message_begin(MSG_ONE, gMsgSayText, {0, 0, 0}, i);
  138. write_byte(i);
  139. write_string(msg);
  140. message_end();
  141. }
  142. }

  143. return 1;
  144. }

  145. fnPunish(plr, loopType)
  146. {
  147. new banTime = get_pcvar_num(gCvarBanTime);
  148. new punishment = get_pcvar_num(gCvarPunishment);
  149. new banMode = get_pcvar_num(gCvarBanMode);
  150. new userId = get_user_userid(plr);

  151. new szName[32];
  152. get_user_name(plr, szName, 32);

  153. new szReason[33];
  154. format(szReason, 32, "Script(%s)", gLOOPTYPES[loopType]);

  155. switch( punishment )
  156. {
  157. case 1:
  158. {
  159. if( banMode == 1 )
  160. {
  161. server_cmd("amx_ban #%i %i ^"%s^"", userId, banTime, szReason);
  162. }
  163. else if( banMode == 2 )
  164. {
  165. server_cmd("amx_ban %i #%i %s", banTime, userId, szReason);
  166. }

  167. fnGreenChat(0, " %s 玩家已被服务器禁封 %i 分钟. 原因: %s",
  168. szName, banTime, szReason);
  169. }
  170. case 2:
  171. {
  172. server_cmd("amx_kick #%i ^"%s^"", userId, szReason);

  173. fnGreenChat(0, " %s 玩家已被服务器踢出. 原因: %s", szName, szReason);
  174. }
  175. case 3:
  176. {
  177. user_kill(plr, 0);

  178. fnGreenChat(0, " %s 玩家已被服务器处死. 原因: %s", szName, szReason);
  179. }
  180. }


  181. return 1;
  182. }
复制代码

该用户从未签到

 楼主| 发表于 2010-3-12 21:42:42 | 显示全部楼层
Pledges 发表于 2010-3-12 11:42

3Q 一会看下去
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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