Русское сообщество по скриптингу

Плагин угадай провод разминируеш

Все вопросы по работе и настройке AMXX и его плагинов.

Модератор: liFe iS GoOD

Правила форума
1. Запрещено материться и оскорблять других участников форума.
2. Запрещен флуд, оффтоп, дабл постинг во всех разделах форума, кроме раздела "Болтовня".
3. Запрещено взламывать сайт/форум или наносить любой вред проекту.
4. Запрещено рекламировать другие ресурсы.
5. Запрещено создавать темы без информативного названия. Название темы должно отображать ее смысл.

В данном разделе форума разрешено создавать темы, касающие только вопросов по AMX Mod X и его плагинам.

Плагин угадай провод разминируеш

Сообщение axevano » 03 сен 2012, 20:56

[pawn]
  1. /* AMX Mod X script.

  2. *  

  3. *       Cut The Right Wire

  4. *      

  5. *       by The Specialist

  6. *

  7. *        Idea : TinLab

  8. *

  9. *  This program is free software; you can redistribute it and/or modify it

  10. *  under the terms of the GNU General Public License as published by the

  11. *  Free Software Foundation; either version 2 of the License, or (at

  12. *  your option) any later version.

  13. *

  14. *  This program is distributed in the hope that it will be useful, but

  15. *  WITHOUT ANY WARRANTY; without even the implied warranty of

  16. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

  17. *  General Public License for more details.

  18. *

  19. *  You should have received a copy of the GNU General Public License

  20. *  along with this program; if not, write to the Free Software Foundation,

  21. *  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

  22. *

  23. *  In addition, as a special exception, the author gives permission to

  24. *  link the code of this program with the Half-Life Game Engine ("HL

  25. *  Engine") and Modified Game Libraries ("MODs") developed by Valve,

  26. *  L.L.C ("Valve"). You must obey the GNU General Public License in all

  27. *  respects for all of the code used other than the HL Engine and MODs

  28. *  from Valve. If you modify this file, you may extend this exception

  29. *  to your version of the file, but you are not obligated to do so. If

  30. *  you do not wish to do so, delete this exception statement from your

  31. *  version.

  32. */

  33.  

  34. #include <amxmodx>

  35. #include <fakemeta>

  36.  

  37. #define TE_EXPLOSION 3

  38.  

  39. new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2 ;

  40. new g_Switch;

  41. new i;

  42. new PlayerDefused[33];

  43. new Sprite;

  44. new Float:  Location[3];

  45. new wire;

  46. new g_AllTalk;

  47.  

  48. public plugin_init()

  49. {

  50.         register_plugin("Cut The Right Wire","0.4","The Specialist");

  51.         g_Switch = register_cvar("ctrw_switch","1");

  52.         g_AllTalk = register_cvar("ctrw_alltalk","1");

  53.         register_dictionary("right_wire.txt");

  54.         register_menucmd(register_menuid("menu_show"),1023,"menu_choose");

  55.         register_event("ResetHUD","wire_call","be");

  56.         register_logevent("bomb_defuse_no_kit", 3, "2=Begin_Bomb_Defuse_Without_Kit");

  57.         register_logevent("bomb_defuse_no_kit", 3, "2=Begin_Bomb_Defuse_With_Kit");

  58.         register_forward(FM_PlayerPreThink,"block_buttons");

  59. }

  60. // detect defusing

  61. public bomb_defuse_no_kit()

  62. {

  63.         new id = get_loguser_index();

  64.        

  65.         if(get_pcvar_num(g_Switch)==0 || PlayerDefused[id] > 0 || is_user_bot(id)==1)

  66.         {

  67.                 return PLUGIN_HANDLED;

  68.         }else{

  69.                 new menu[192];

  70.                 format(menu,191,"%L",id,"CHOOSE");

  71.                 show_menu(id,keys,menu,-1,"menu_show");

  72.                 ++PlayerDefused[id];

  73.                 all_talk();

  74.                 ++i;

  75.                 return 0;

  76.         }

  77.         return 0;

  78. }

  79. // reset hud event

  80. public wire_call(id)

  81. {

  82.         PlayerDefused[id] = 0;

  83.         wire = random_num(0,1);

  84. }

  85. // remove use button and show menu

  86. public menu_choose(id,key)

  87. {

  88.         switch(key)

  89.         {

  90.                 case 0 :

  91.                 {

  92.                         if( wire == 0 )

  93.                         {

  94.                                 --i;

  95.                                 return PLUGIN_HANDLED;

  96.                         }else{

  97.                                 bomb_explosion(id);

  98.                                 PlayerDefused[id]  = 0;

  99.                                 return 1

  100.                         }

  101.                 }

  102.                 case 1:

  103.                 {

  104.                         if( wire == 1)

  105.                         {

  106.                                 --i;

  107.                                 return PLUGIN_HANDLED;

  108.                         }else{

  109.                                 bomb_explosion(id);

  110.                                 PlayerDefused[id] = 0;

  111.                                 return 1

  112.                         }

  113.                 }

  114.         }

  115.         return PLUGIN_HANDLED;

  116. }

  117. // block the users use button

  118. public block_buttons(id)

  119. {

  120.         if( i == 0 )

  121.         {

  122.                 return 1;

  123.         }else{

  124.                 set_pev( id, pev_button, pev(id,pev_button) & ~IN_USE);

  125.         }

  126.         return 1;

  127. }

  128. //bomb explosion

  129. public bomb_explosion(id)

  130. {

  131.         pev(id, pev_origin,Location);

  132.         message_begin(MSG_BROADCAST,SVC_TEMPENTITY);

  133.         write_byte(TE_EXPLOSION);

  134.         engfunc(EngFunc_WriteCoord,Location[0]);

  135.         engfunc(EngFunc_WriteCoord,Location[1]);

  136.         engfunc(EngFunc_WriteCoord,Location[2]);

  137.         write_short(Sprite);

  138.         write_byte(255);

  139.         write_byte(0);

  140.         write_byte(0);

  141.         message_end();

  142.         user_silentkill(id);

  143.         PlayerDefused[id] = 0; 

  144.         i = 0;

  145.         return 1;

  146. }

  147. // turn all talk on

  148. public all_talk()

  149. {

  150.         if(get_pcvar_num(g_AllTalk)==0)

  151.         {

  152.                 return PLUGIN_HANDLED;

  153.         }else{

  154.                 set_cvar_string("sv_alltalk","1");

  155.         }

  156.         return PLUGIN_HANDLED;

  157. }

  158. // function to get index from log events

  159. public get_loguser_index()

  160. {

  161.         new loguser[80], name[32];

  162.         read_logargv(0, loguser, 79);

  163.         parse_loguser(loguser, name, 31);

  164.         return get_user_index(name);

  165. }

  166. //precache sprites for exloasion

  167. public plugin_precache()

  168. {

  169.         Sprite = precache_model("sprites/zerogxplode.spr");

  170. }

  171.  
[/pawn]

Как зделать так чтоб когда угадал провод сразу разминировало, а не шла полоса разминировки

Аватара пользователя
axevano
 
Сообщения: 39
Зарегистрирован: 31 авг 2012, 20:58
Благодарил (а): 3 раз.
Поблагодарили: 0 раз.
Опыт программирования: Меньше недели

Вернуться в Вопросы по AMXX и его плагинам

Кто сейчас на конференции

Сейчас этот форум просматривают: Google [Bot] и гости: 7