Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.88 KB | None | 0 0
  1. #pragma semicolon 1
  2. #include <sourcemod>
  3. #include <sdktools>
  4. #include <sdkhooks>
  5.  
  6. #define IsValidClient(%1) (1 <= %1 <= MaxClients && IsClientInGame(%1))
  7. #define QT "\x04[Ra1n6owS]\x03 玩家\x04 %N \x03抽到了\x01%s \x05→ \x02%s"
  8. #define PIE "\x05[Ra1n6owS] \x04妳抽中了\x01%s \x05→ \x02%s"
  9. #define PH "\x04[Ra1n6owS]\x03 玩家\x04 %N \x03抽到了\x01%s \x05→ \x02%s"
  10.  
  11. #define DD "buttons/button14.wav"
  12.  
  13. new Handle:hTimerAchieved[MAXPLAYERS+1];
  14. new Handle:hTimerMiniFireworks[MAXPLAYERS+1];
  15. new Handle:hTimerLoopEffect[MAXPLAYERS+1];
  16. new bool:rolled[MAXPLAYERS+1];
  17. new bool:sift[MAXPLAYERS+1];
  18. new count[MAXPLAYERS+1];
  19. new L[MAXPLAYERS+1];
  20. new gain[MAXPLAYERS+1];
  21. new prize1[MAXPLAYERS+1];
  22. new prize2[MAXPLAYERS+1];
  23. new prize3[MAXPLAYERS+1];
  24. new prize4[MAXPLAYERS+1];
  25. new prize5[MAXPLAYERS+1];
  26. new prize6[MAXPLAYERS+1];
  27. new Handle:StopTime[MAXPLAYERS+1] = { INVALID_HANDLE, ...};
  28. new Tegan[MAXPLAYERS+1];
  29. new Handle:kills;
  30. new Handle:Tegan_count;
  31. new Handle:tank_count;
  32. new Handle:LDW_MSG_time;
  33.  
  34. new Handle:timer_handle=INVALID_HANDLE;
  35.  
  36. static g_flLagMovement = 0;
  37.  
  38. public Plugin:myinfo =
  39. {
  40. name = "抽奖插件繁体版1.x地瓜版",
  41. author = "烟消云散应地瓜要求修改 qq1287161830接插件定做",
  42. description = "原L4D2_Lucky_Draw_繁体版v1.1",
  43. version = "1.x",
  44. url = "Null"
  45. };
  46.  
  47. public OnPluginStart()
  48. {
  49. RegConsoleCmd("sm_ldw",LDW);
  50. HookEvent("infected_death", infected_death);
  51. HookEvent("player_death", player_death);
  52. HookEvent("round_start", round_start);
  53. HookEvent("round_end", Event_RoundEnd);
  54. HookEvent("finale_win", Event_RoundEnd);
  55. HookEvent("mission_lost", Event_RoundEnd);
  56. HookEvent("map_transition", Event_RoundEnd);
  57.  
  58. kills = CreateConVar("common_kills", "25", "擊殺多少小僵屍可獲得壹次抽獎機會", FCVAR_PLUGIN);
  59. Tegan_count = CreateConVar("Tegan_counts", "7", "擊殺几個特感可獲得1抽獎機會", FCVAR_PLUGIN);
  60. tank_count = CreateConVar("tank_iskill_count", "2", "tank死亡時所有幸存者可獲得多少次抽獎機會", FCVAR_PLUGIN);
  61. LDW_MSG_time = CreateConVar("ldw_msg_time", "300.0", "抽獎系統公告多少時間(秒)播放壹次", FCVAR_PLUGIN);
  62. AutoExecConfig(true, "L4D2_Lucky_Draw");
  63. }
  64.  
  65. public OnMapStart()
  66. {
  67. for(new i=1; i<=MaxClients; i++)
  68. {
  69. rolled[i]=false;
  70. sift[i]=true;
  71. }
  72. PrecacheSound("ui/littlereward.wav", true);
  73. PrecacheSound("level/gnomeftw.wav", true);
  74. PrecacheSound("npc/moustachio/strengthattract05.wav", true);
  75. PrecacheSound(DD, true);
  76. g_flLagMovement = FindSendPropInfo("CTerrorPlayer", "m_flLaggedMovementValue");
  77. }
  78.  
  79. public OnClientDisconnect(Client)
  80. {
  81. if(!IsFakeClient(Client) && IsClientConnected(Client) && IsClientInGame(Client))
  82. {
  83. Tegan[Client]=0;
  84. if (StopTime[Client] != INVALID_HANDLE) {
  85. KillTimer(StopTime[Client]);
  86. StopTime[Client] = INVALID_HANDLE;
  87. }
  88. PrintToServer("清除玩家%N的抽獎次數", Client);
  89. }
  90. }
  91.  
  92. // public OnClientConnected(Client)
  93. // {
  94. // L[Client]=0;
  95. // Tegan[Client]=0;
  96. // count[Client]=0;
  97. // PrintToServer("连接 清除玩家%N的抽獎次數", Client);
  98. // }
  99.  
  100. public Action:round_start(Handle:event, const String:name[], bool:dontBroadcast)
  101. {
  102.  
  103. if(timer_handle != INVALID_HANDLE )
  104. {
  105. KillTimer(timer_handle);
  106. timer_handle=INVALID_HANDLE;
  107. }
  108. if(timer_handle == INVALID_HANDLE)
  109. {
  110. timer_handle=CreateTimer(GetConVarFloat(LDW_MSG_time), Msg, 0, TIMER_REPEAT);
  111. }
  112. }
  113.  
  114. public Action:infected_death(Handle:event, String:event_name[], bool:dontBroadcast)
  115. {
  116. new id = GetClientOfUserId(GetEventInt(event, "attacker"));
  117.  
  118. if(IsValidClient(id))
  119. {
  120. if(GetClientTeam(id) == 2 && !IsFakeClient(id))
  121. {
  122. if(count[id]<GetConVarInt(kills))
  123. {
  124. count[id]+=1;
  125. } else
  126. {
  127. count[id]=0;
  128. L[id]+=1;
  129. PrintHintText(id, "抽獎機會+1");
  130. }
  131. }
  132. }
  133. }
  134.  
  135. public Action:player_death(Handle:event, String:event_name[], bool:dontBroadcast)
  136. {
  137. new client = GetClientOfUserId(GetEventInt(event, "attacker"));
  138. new vic = GetClientOfUserId(GetEventInt(event, "userid"));
  139.  
  140. if(IsValidClient(client) && IsValidClient(vic))
  141. {
  142. if(IsClientInGame(vic) && IsClientInGame(client) && !IsFakeClient(client) && !(IsCommonInfected(vic) || IsWitch(vic)))
  143. {
  144. if(GetClientTeam(client) == 2 && GetClientTeam(vic) == 3)
  145. {
  146. if(GetEntProp(vic, Prop_Send, "m_zombieClass") != 8)
  147. {
  148. if (Tegan[client] >= GetConVarInt(Tegan_count))
  149. {
  150. Tegan[client] = 0;
  151. L[client] += 1;
  152. PrintHintText(client, "抽獎機會 + 1");
  153. }
  154. else
  155. {
  156. Tegan[client] += 1;
  157. }
  158. }
  159. }
  160. }
  161.  
  162. if(!(IsCommonInfected(vic) || IsWitch(vic)))
  163. {
  164. if(GetClientTeam(vic) == 3 && GetEntProp(vic, Prop_Send, "m_zombieClass") == 8 && IsClientInGame(vic))
  165. {
  166. for (new i = 1; i <= MaxClients; i++)
  167. {
  168. if(IsClientInGame(i))
  169. {
  170. if(GetClientTeam(i) == 2)
  171. {
  172. L[i]+=GetConVarInt(tank_count);
  173. PrintHintText(i, "抽獎機會+%d", GetConVarInt(tank_count));
  174. }
  175. }
  176. }
  177. }
  178. }
  179.  
  180. if(GetClientTeam(vic) == 2 && rolled[vic])
  181. {
  182. KillTimer(StopTime[vic]);
  183. rolled[vic]=false;
  184. sift[vic]=true;
  185. PrintToChat(vic, "\x04由于角色死亡,抽獎強制終止!");
  186. PrintCenterText(vic, "抽獎終止!");
  187. }
  188. }
  189. }
  190.  
  191. public Action:Event_RoundEnd(Handle:event, String:event_name[], bool:dontBroadcast)
  192. {
  193. for (new i = 1; i <= MaxClients; i++)
  194. {
  195. if(IsClientInGame(i) && IsClientConnected(i))
  196. {
  197. KillTimer(StopTime[i]);
  198. }
  199. }
  200.  
  201. if(timer_handle != INVALID_HANDLE )
  202. {
  203. KillTimer(timer_handle);
  204. timer_handle=INVALID_HANDLE;
  205. }
  206.  
  207. for(new i=1; i<=MaxClients; i++)
  208. {
  209. if(IsClientInGame(i))
  210. {
  211. rolled[i]=false;
  212. sift[i]=true;
  213. }
  214. }
  215. }
  216.  
  217. public Action:LDW(Client, args)
  218. {
  219. if(GetClientTeam(Client)==2)
  220. {
  221. draw_function(Client);
  222. } else
  223. {
  224. PrintToChat(Client, "此功能只有倖存者可以使用!");
  225. }
  226. }
  227.  
  228. public Action:draw_function(Client)
  229. {
  230. decl String:line[256];
  231. new Handle:menu = CreatePanel();
  232. if(!rolled[Client])
  233. {
  234. Format(line, sizeof(line), " -抽獎系統列表-");
  235. SetPanelTitle(menu, line);
  236. if(L[Client] > 0)
  237. {
  238. Format(line, sizeof(line), "妳有%d次抽獎機會", L[Client]);
  239. DrawPanelText(menu, line);
  240. Format(line, sizeof(line), "【詳情請查看規則說明】");
  241. DrawPanelText(menu, line);
  242. } else
  243. {
  244. L[Client] = 0;
  245. Format(line, sizeof(line), "你暂时没有抽獎机会");
  246. DrawPanelText(menu, line);
  247. Format(line, sizeof(line), "【詳情請查看規則說明】");
  248. DrawPanelText(menu, line);
  249. }
  250.  
  251. Format(line, sizeof(line), "准備抽獎");
  252. DrawPanelItem(menu, line);
  253. Format(line, sizeof(line), "規則說明");
  254. DrawPanelItem(menu, line);
  255. Format(line, sizeof(line), "刷新列表");
  256. DrawPanelItem(menu, line);
  257. DrawPanelItem(menu, "Exit", ITEMDRAW_DISABLED);
  258. SendPanelToClient(menu, Client, MenuHandler, MENU_TIME_FOREVER);
  259. CloseHandle(menu);
  260. } else
  261. {
  262. Format(line, sizeof(line), " -祝您好運-");
  263. SetPanelTitle(menu, line);
  264. Format(line, sizeof(line), "~~~~~~~~~~~~~~", L[Client]);
  265. DrawPanelText(menu, line);
  266. Format(line, sizeof(line), " 抽獎中... ", L[Client]);
  267. DrawPanelText(menu, line);
  268. Format(line, sizeof(line), "~~~~~~~~~~~~~~", L[Client]);
  269. DrawPanelText(menu, line);
  270. Format(line, sizeof(line), "-停-");
  271. DrawPanelItem(menu, line);
  272. DrawPanelItem(menu, "如果列表關閉,請再次打開,選擇:-停-", ITEMDRAW_DISABLED);
  273. SendPanelToClient(menu, Client, Stop, MENU_TIME_FOREVER);
  274. CloseHandle(menu);
  275. }
  276. }
  277.  
  278. public MenuHandler(Handle:menu, MenuAction:action, Client, param)
  279. {
  280. if (action == MenuAction_Select) {
  281. switch (param)
  282. {
  283. case 1:
  284. {
  285. if(L[Client] > 0)
  286. {
  287. if(sift[Client])
  288. {
  289. sift_start1(Client);
  290. sift_start2(Client);
  291. sift_start3(Client);
  292. sift_start4(Client);
  293. sift_start5(Client);
  294. sift_start6(Client);
  295. sift[Client]=false;
  296. }
  297. Award_List(Client);
  298. } else
  299. {
  300. PrintToChat(Client, "\x04[Ra1n6owS]\x03 Sorry,妳沒有抽獎機會!");
  301. }
  302. }
  303. case 2:
  304. {
  305. Explain(Client);
  306. }
  307. case 3:
  308. {
  309. draw_function(Client);
  310. EmitSoundToClient(Client, DD);
  311. }
  312. }
  313. }
  314. }
  315.  
  316. public Stop(Handle:menu, MenuAction:action, Client, param)
  317. {
  318. if (action == MenuAction_Select) {
  319. switch (param)
  320. {
  321. case 1:
  322. {
  323. KillTimer(StopTime[Client]);
  324. rolled[Client]=false;
  325. sift[Client]=true;
  326. Award(Client);
  327. }
  328. }
  329. }
  330. }
  331.  
  332. public Action:Explain(Client)//说明
  333. {
  334. decl String:line[256];
  335. new Handle:menu = CreatePanel();
  336. Format(line, sizeof(line), " -規則說明-");
  337. SetPanelTitle(menu, line);
  338. Format(line, sizeof(line), "請選擇妳想了解的說明");
  339. DrawPanelText(menu, line);
  340. Format(line, sizeof(line), "操作說明");
  341. DrawPanelItem(menu, line);
  342. Format(line, sizeof(line), "抽獎機會獲得方法");
  343. DrawPanelItem(menu, line);
  344. Format(line, sizeof(line), "獎項出現概率");
  345. DrawPanelItem(menu, line);
  346. Format(line, sizeof(line), "返回");
  347. DrawPanelItem(menu, line);
  348. DrawPanelItem(menu, "Exit", ITEMDRAW_DISABLED);
  349. SendPanelToClient(menu, Client, Declare, MENU_TIME_FOREVER);
  350. CloseHandle(menu);
  351. }
  352.  
  353. public Declare(Handle:menu, MenuAction:action, Client, param)
  354. {
  355. if (action == MenuAction_Select) {
  356. switch (param)
  357. {
  358. case 1:
  359. {
  360. E1(Client);
  361. }
  362. case 2:
  363. {
  364. E2(Client);
  365. }
  366. case 3:
  367. {
  368. E3(Client);
  369. }
  370. case 4:
  371. {
  372. draw_function(Client);
  373. }
  374. }
  375. }
  376. }
  377.  
  378. public Action:E1(Client)
  379. {
  380. decl String:line[256];
  381. new Handle:menu = CreatePanel();
  382. Format(line, sizeof(line), " -操作說明-");
  383. SetPanelTitle(menu, line);
  384. Format(line, sizeof(line), ">如果妳有抽獎機會");
  385. DrawPanelText(menu, line);
  386. Format(line, sizeof(line), ">請點擊主菜單的 【准備抽獎】");
  387. DrawPanelText(menu, line);
  388. Format(line, sizeof(line), ">此時會出現壹個列表,上面顯示妳本次獎項的獎品");
  389. DrawPanelText(menu, line);
  390. Format(line, sizeof(line), ">然後選擇【開始抽獎】");
  391. DrawPanelText(menu, line);
  392. Format(line, sizeof(line), "下壹頁");
  393. DrawPanelItem(menu, line);
  394. Format(line, sizeof(line), "返回");
  395. DrawPanelItem(menu, line);
  396. DrawPanelItem(menu, "Exit", ITEMDRAW_DISABLED);
  397. SendPanelToClient(menu, Client, Page1, MENU_TIME_FOREVER);
  398. CloseHandle(menu);
  399. }
  400.  
  401. public Page1(Handle:menu, MenuAction:action, Client, param)
  402. {
  403. if (action == MenuAction_Select) {
  404. switch (param)
  405. {
  406. case 1:
  407. {
  408. E1_1(Client);
  409. }
  410. case 2:
  411. {
  412. Explain(Client);
  413. }
  414. }
  415. }
  416. }
  417.  
  418. public Action:E1_1(Client)
  419. {
  420. decl String:line[256];
  421. new Handle:menu = CreatePanel();
  422. Format(line, sizeof(line), " -操作說明-");
  423. SetPanelTitle(menu, line);
  424. Format(line, sizeof(line), ">此時妳准心上方會出現壹個跳動的獎項條");
  425. DrawPanelText(menu, line);
  426. Format(line, sizeof(line), ">當妳選擇菜單中的【-停-】時,獎項條停止跳動");
  427. DrawPanelText(menu, line);
  428. Format(line, sizeof(line), ">妳即可獲得獎項欄對應的獎品");
  429. DrawPanelText(menu, line);
  430. Format(line, sizeof(line), "上壹頁");
  431. DrawPanelItem(menu, line);
  432. Format(line, sizeof(line), "返回");
  433. DrawPanelItem(menu, line);
  434. DrawPanelItem(menu, "Exit", ITEMDRAW_DISABLED);
  435. SendPanelToClient(menu, Client, Page2, MENU_TIME_FOREVER);
  436. CloseHandle(menu);
  437. }
  438.  
  439. public Page2(Handle:menu, MenuAction:action, Client, param)
  440. {
  441. if (action == MenuAction_Select) {
  442. switch (param)
  443. {
  444. case 1:
  445. {
  446. E1(Client);
  447. }
  448. case 2:
  449. {
  450. Explain(Client);
  451. }
  452. }
  453. }
  454. }
  455.  
  456. public Action:E2(Client)
  457. {
  458. decl String:line[256];
  459. new Handle:menu = CreatePanel();
  460. Format(line, sizeof(line), " -抽獎機會獲得方法-");
  461. SetPanelTitle(menu, line);
  462. Format(line, sizeof(line), ">擊殺%d個小僵屍即可獲得1次抽獎機會", GetConVarInt(kills));
  463. DrawPanelText(menu, line);
  464. Format(line, sizeof(line), ">擊殺%d個特感可以獲得1次抽獎機會", GetConVarInt(Tegan_count));
  465. DrawPanelText(menu, line);
  466. Format(line, sizeof(line), ">Tank死亡時,所有幸存者可獲得%d次抽獎機會", GetConVarInt(tank_count));
  467. DrawPanelText(menu, line);
  468. Format(line, sizeof(line), "返回");
  469. DrawPanelItem(menu, line);
  470. DrawPanelItem(menu, "Exit", ITEMDRAW_DISABLED);
  471. SendPanelToClient(menu, Client, Back, MENU_TIME_FOREVER);
  472. CloseHandle(menu);
  473. }
  474.  
  475. public Back(Handle:menu, MenuAction:action, Client, param)
  476. {
  477. if (action == MenuAction_Select) {
  478. switch (param)
  479. {
  480. case 1:
  481. {
  482. Explain(Client);
  483. }
  484. }
  485. }
  486. }
  487.  
  488. public Action:E3(Client)
  489. {
  490. decl String:line[256];
  491. new Handle:menu = CreatePanel();
  492. Format(line, sizeof(line), " -獎項出現概率-");
  493. SetPanelTitle(menu, line);
  494. Format(line, sizeof(line), "以下爲獎項條跳動時,各類獎項出現概率:");
  495. DrawPanelText(menu, line);
  496. Format(line, sizeof(line), ">特等獎5%出現");
  497. DrawPanelText(menu, line);
  498. Format(line, sizeof(line), ">壹等獎10%出現");
  499. DrawPanelText(menu, line);
  500. Format(line, sizeof(line), ">二等獎15%出現");
  501. DrawPanelText(menu, line);
  502. Format(line, sizeof(line), ">三等獎25%出現");
  503. DrawPanelText(menu, line);
  504. Format(line, sizeof(line), ">安慰獎40%出現");
  505. DrawPanelText(menu, line);
  506. Format(line, sizeof(line), ">懲罰5%出現");
  507. DrawPanelText(menu, line);
  508. Format(line, sizeof(line), "返回");
  509. DrawPanelItem(menu, line);
  510. DrawPanelItem(menu, "Exit", ITEMDRAW_DISABLED);
  511. SendPanelToClient(menu, Client, Back, MENU_TIME_FOREVER);
  512. CloseHandle(menu);
  513. }
  514.  
  515.  
  516. public Action:Award(Client)//** 发放獎品 **//
  517. {
  518. decl String:ms[32];
  519. decl String:hd[32];
  520. if(gain[Client]==1)
  521. {
  522. if(prize1[Client]==1)
  523. {
  524. for (new i = 1; i <= MaxClients; i++)
  525. {
  526. if(IsClientInGame(i))
  527. {
  528. if(GetClientTeam(i) == 2)
  529. {
  530. new MaxHP = GetEntProp(i, Prop_Data, "m_iMaxHealth");
  531. if(GetClientHealth(i) < 100)
  532. {
  533. SetEntProp(i, Prop_Data, "m_iHealth", MaxHP);
  534. }
  535. }
  536. }
  537. }
  538. Format(hd, sizeof(hd), "所有幸存者加滿HP");
  539. } else if(prize1[Client]==2)
  540. {
  541. CheatCommand(Client, "ent_remove_all", "infected");
  542. Format(hd, sizeof(hd), "清除所有小僵屍");
  543. } else if(prize1[Client]==3)
  544. {
  545. SetEntProp(Client, Prop_Data, "m_takedamage", 0, 1);
  546. Format(hd, sizeof(hd), "他自己進入無敵狀態");
  547. } else if(prize1[Client]==4)
  548. {
  549. SetEntityGravity(Client, 0.1);
  550. Format(hd, sizeof(hd), "他自己的重力降到最低");
  551. } else if(prize1[Client]==5)
  552. {
  553. for (new i = 1; i <= MaxClients; i++)
  554. {
  555. if(IsClientInGame(i))
  556. {
  557. if(GetClientTeam(i) == 3)
  558. {
  559. ForcePlayerSuicide(i);
  560. }
  561. }
  562. }
  563. Format(hd, sizeof(hd), "處死所有特感");
  564. } else if(prize1[Client]==6)
  565. {
  566. decl Float:speed;
  567. speed = GetEntDataFloat(Client, g_flLagMovement) * 1.7;
  568. SetEntDataFloat(Client, g_flLagMovement, speed, true);
  569. Format(hd, sizeof(hd), "飞毛腿");
  570. } else if(prize1[Client]==7)
  571. {
  572. CheatCommand(Client, "give", "first_aid_kit");
  573. CheatCommand(Client, "give", "pain_pills");
  574. CheatCommand(Client, "give", "adrenaline");
  575. CheatCommand(Client, "give", "defibrillator");
  576. CheatCommand(Client, "give", "pipe_bomb");
  577. CheatCommand(Client, "give", "vomitjar");
  578. CheatCommand(Client, "give", "molotov");
  579. Format(hd, sizeof(hd), "补给大礼包");
  580. }
  581. Format(ms, sizeof(ms), "特等獎");
  582. PrintToChatAll(QT, Client, ms, hd);
  583. EmitSoundToClient(Client, "level/gnomeftw.wav");
  584. AttachParticle(Client, "achieved", 3.0);
  585. }
  586.  
  587. if(gain[Client] == 2)
  588. {
  589. if(prize2[Client]==1)
  590. {
  591. CheatCommand(Client, "give", "rifle");
  592. Format(hd, sizeof(hd), "獲得M16");
  593. } else if(prize2[Client]==2)
  594. {
  595. CheatCommand(Client, "give", "rifle_ak47");
  596. Format(hd, sizeof(hd), "獲得AK47");
  597. } else if(prize2[Client]==3)
  598. {
  599. CheatCommand(Client, "give", "sniper_military");
  600. Format(hd, sizeof(hd), "獲得大型連狙");
  601. } else if(prize2[Client]==4)
  602. {
  603. CheatCommand(Client, "give", "rifle_sg552");
  604. Format(hd, sizeof(hd), "獲得SG552");
  605. } else if(prize2[Client]==5)
  606. {
  607. CheatCommand(Client, "give", "autoshotgun");
  608. Format(hd, sizeof(hd), "獲得自動散彈槍");
  609. } else if(prize2[Client]==6)
  610. {
  611. CheatCommand(Client, "give", "sniper_scout");
  612. Format(hd, sizeof(hd), "獲得SCOUT小狙");
  613. } else if(prize2[Client]==7)
  614. {
  615. CheatCommand(Client, "give", "sniper_awp");
  616. Format(hd, sizeof(hd), "獲得AWP大狙");
  617. } else if(prize2[Client]==8)
  618. {
  619. CheatCommand(Client, "give", "shotgun_spas");
  620. Format(hd, sizeof(hd), "獲得SPAS戰鬥散彈槍");
  621. } else if(prize2[Client]==9)
  622. {
  623. CheatCommand(Client, "give", " rifle_desert");
  624. Format(hd, sizeof(hd), "獲得突擊步槍");
  625. } else if(prize2[Client]==10)
  626. {
  627. CheatCommand(Client, "give", "grenade_launcher");
  628. Format(hd, sizeof(hd), "獲得榴彈槍");
  629. } else if(prize2[Client]==11)
  630. {
  631. CheatCommand(Client, "give", "rifle_m60");
  632. Format(hd, sizeof(hd), "獲得M60");
  633. }
  634. Format(ms, sizeof(ms), "壹等獎");
  635. PrintToChat(Client, PIE, ms, hd);
  636. EmitSoundToClient(Client, "level/gnomeftw.wav");
  637. AttachParticle(Client, "achieved", 3.0);
  638. }
  639.  
  640. if(gain[Client]==3)
  641. {
  642. if(prize3[Client]==1)
  643. {
  644. CheatCommand(Client, "give", "first_aid_kit");
  645. Format(hd, sizeof(hd), "獲得醫藥包");
  646. } else if(prize3[Client]==2)
  647. {
  648. CheatCommand(Client, "give", "pain_pills");
  649. Format(hd, sizeof(hd), "獲得止痛藥");
  650. } else if(prize3[Client]==3)
  651. {
  652. CheatCommand(Client, "give", "adrenaline");
  653. Format(hd, sizeof(hd), "獲得腎上腺素");
  654. } else if(prize3[Client]==4)
  655. {
  656. CheatCommand(Client, "give", "defibrillator");
  657. Format(hd, sizeof(hd), "獲得電擊器");
  658. }
  659. Format(ms, sizeof(ms), "二等獎");
  660. PrintToChat(Client, PIE, ms, hd);
  661. EmitSoundToClient(Client, "level/gnomeftw.wav");
  662. AttachParticle(Client, "achieved", 3.0);
  663. }
  664.  
  665. if(gain[Client]==4)
  666. {
  667. if(prize4[Client]==1)
  668. {
  669. CheatCommand(Client, "give", "pistol_magnum");
  670. Format(hd, sizeof(hd), "獲得馬格南手槍");
  671. } else if(prize4[Client]==2)
  672. {
  673. CheatCommand(Client, "give", "baseball_bat");
  674. Format(hd, sizeof(hd), "獲得棒球棒");
  675. } else if(prize4[Client]==3)
  676. {
  677. CheatCommand(Client, "give", "pipe_bomb");
  678. Format(hd, sizeof(hd), "獲得土制炸彈");
  679. } else if(prize4[Client]==4)
  680. {
  681. CheatCommand(Client, "give", "molotov");
  682. Format(hd, sizeof(hd), "獲得燃燒瓶");
  683. } else if(prize4[Client]==5)
  684. {
  685. CheatCommand(Client, "give", "vomitjar");
  686. Format(hd, sizeof(hd), "獲得膽汁炸彈");
  687. } else if(prize4[Client]==6)
  688. {
  689. CheatCommand(Client, "give", "chainsaw");
  690. Format(hd, sizeof(hd), "獲得電鋸");
  691. } else if(prize4[Client]==7)
  692. {
  693. CheatCommand(Client, "give", "knife");
  694. Format(hd, sizeof(hd), "獲得小刀");
  695. } else if(prize4[Client]==8)
  696. {
  697. CheatCommand(Client, "give", "machete");
  698. Format(hd, sizeof(hd), "獲得砍刀");
  699. } else if(prize4[Client]==9)
  700. {
  701. CheatCommand(Client, "give", "katana");
  702. Format(hd, sizeof(hd), "獲得武士刀");
  703. }
  704. Format(ms, sizeof(ms), "三等獎");
  705. PrintToChat(Client, PIE, ms, hd);
  706. EmitSoundToClient(Client, "level/gnomeftw.wav");
  707. AttachParticle(Client, "achieved", 3.0);
  708. }
  709.  
  710. if(gain[Client]==5)
  711. {
  712. if(prize5[Client]==1)
  713. {
  714. CheatCommand(Client, "give", "upgradepack_incendiary");
  715. Format(hd, sizeof(hd), "獲得燃燒彈盒");
  716. } else if(prize5[Client]==2)
  717. {
  718. CheatCommand(Client, "give", "upgradepack_explosive");
  719. Format(hd, sizeof(hd), "獲得高爆彈盒");
  720. } else if(prize5[Client]==3)
  721. {
  722. CheatCommand(Client, "give", "propanetank");
  723. Format(hd, sizeof(hd), "獲得煤氣罐");
  724. } else if(prize5[Client]==4)
  725. {
  726. CheatCommand(Client, "give", "gascan");
  727. Format(hd, sizeof(hd), "獲得汽油桶");
  728. } else if(prize5[Client]==5)
  729. {
  730. CheatCommand(Client, "give", "oxygentank");
  731. Format(hd, sizeof(hd), "獲得氧氣罐");
  732. }
  733. Format(ms, sizeof(ms), "安慰獎");
  734. PrintToChat(Client, PIE, ms, hd);
  735. EmitSoundToClient(Client, "level/gnomeftw.wav");
  736. AttachParticle(Client, "achieved", 3.0);
  737. }
  738.  
  739. if(gain[Client]==6)
  740. {
  741. if(prize6[Client]==1)
  742. {
  743. CheatCommand(Client, "z_spawn", "witch");
  744. CheatCommand(Client, "z_spawn", "witch");
  745. Format(hd, sizeof(hd), "召喚兩只Witch");
  746. } else if(prize6[Client]==2)
  747. {
  748. CheatCommand(Client, "z_spawn", "tank");
  749. Format(hd, sizeof(hd), "召喚壹只Tank");
  750. } else if(prize6[Client]==3)
  751. {
  752. ForcePlayerSuicide(Client);
  753. Format(hd, sizeof(hd), "自殺!!!");
  754. } else if(prize6[Client]==4)
  755. {
  756. CheatCommand(Client, "z_spawn", "mob");
  757. CheatCommand(Client, "z_spawn", "mob");
  758. Format(hd, sizeof(hd), "召喚屍潮!");
  759. } else if(prize6[Client]==5)
  760. {
  761. ServerCommand("sm_freeze \"%N\" \"%d\"", Client, 20);
  762. Format(hd, sizeof(hd), "被冰凍20秒");
  763. } else if(prize6[Client]==6)
  764. {
  765. DispatchKeyValue(Client, "rendercolor", "255 255 255 0");
  766. Format(hd, sizeof(hd), "被夺去肉身");
  767. }
  768. Format(ms, sizeof(ms), "懲罰");
  769. PrintToChatAll(PH, Client, ms, hd);
  770. EmitSoundToClient(Client, "npc/moustachio/strengthattract05.wav");
  771. }
  772.  
  773. }
  774.  
  775. public Action:sift_start1(Client)//特殊獎品
  776. {
  777. new diceNum = GetRandomInt(1, 7);
  778. switch (diceNum)
  779. {
  780. case 1:
  781. {
  782. prize1[Client]=1;
  783. }
  784. case 2:
  785. {
  786. prize1[Client]=2;
  787. }
  788. case 3:
  789. {
  790. prize1[Client]=3;
  791. }
  792. case 4:
  793. {
  794. prize1[Client]=4;
  795. }
  796. case 5:
  797. {
  798. prize1[Client]=5;
  799. }
  800. case 6:
  801. {
  802. prize1[Client]=6;
  803. }
  804. case 7:
  805. {
  806. prize1[Client]=7;
  807. }
  808. }
  809. }
  810.  
  811. public Action:sift_start2(Client)//主武器
  812. {
  813. new diceNum2 = GetRandomInt(1, 11);
  814. switch (diceNum2)
  815. {
  816. case 1:
  817. {
  818. prize2[Client]=1;
  819. }
  820. case 2:
  821. {
  822. prize2[Client]=2;
  823. }
  824. case 3:
  825. {
  826. prize2[Client]=3;
  827. }
  828. case 4:
  829. {
  830. prize2[Client]=4;
  831. }
  832. case 5:
  833. {
  834. prize2[Client]=5;
  835. }
  836. case 6:
  837. {
  838. prize2[Client]=6;
  839. }
  840. case 7:
  841. {
  842. prize2[Client]=7;
  843. }
  844. case 8:
  845. {
  846. prize2[Client]=8;
  847. }
  848. case 9:
  849. {
  850. prize2[Client]=9;
  851. }
  852. case 10:
  853. {
  854. prize2[Client]=10;
  855. }
  856. case 11:
  857. {
  858. prize2[Client]=11;
  859. }
  860. }
  861. }
  862.  
  863. public Action:sift_start3(Client)//医药品
  864. {
  865. new diceNum3 = GetRandomInt(1, 4);
  866. switch (diceNum3)
  867. {
  868. case 1:
  869. {
  870. prize3[Client]=1;
  871. }
  872. case 2:
  873. {
  874. prize3[Client]=2;
  875. }
  876. case 3:
  877. {
  878. prize3[Client]=3;
  879. }
  880. case 4:
  881. {
  882. prize3[Client]=4;
  883. }
  884. }
  885. }
  886.  
  887. public Action:sift_start4(Client)//投掷&棒球棒&马格南
  888. {
  889. new diceNum4 = GetRandomInt(1, 9);
  890. switch (diceNum4)
  891. {
  892. case 1:
  893. {
  894. prize4[Client]=1;
  895. }
  896. case 2:
  897. {
  898. prize4[Client]=2;
  899. }
  900. case 3:
  901. {
  902. prize4[Client]=3;
  903. }
  904. case 4:
  905. {
  906. prize4[Client]=4;
  907. }
  908. case 5:
  909. {
  910. prize4[Client]=5;
  911. }
  912. case 6:
  913. {
  914. prize4[Client]=6;
  915. }
  916. case 7:
  917. {
  918. prize4[Client]=7;
  919. }
  920. case 8:
  921. {
  922. prize4[Client]=8;
  923. }
  924. case 9:
  925. {
  926. prize4[Client]=9;
  927. }
  928. }
  929. }
  930.  
  931. public Action:sift_start5(Client)//爆炸品
  932. {
  933. new diceNum5 = GetRandomInt(1, 5);
  934. switch (diceNum5)
  935. {
  936. case 1:
  937. {
  938. prize5[Client]=1;
  939. }
  940. case 2:
  941. {
  942. prize5[Client]=2;
  943. }
  944. case 3:
  945. {
  946. prize5[Client]=3;
  947. }
  948. case 4:
  949. {
  950. prize5[Client]=4;
  951. }
  952. case 5:
  953. {
  954. prize5[Client]=5;
  955. }
  956. }
  957. }
  958.  
  959. public Action:sift_start6(Client)//懲罰
  960. {
  961. new diceNum6 = GetRandomInt(1, 6);
  962. switch (diceNum6)
  963. {
  964. case 1:
  965. {
  966. prize6[Client]=1;
  967. }
  968. case 2:
  969. {
  970. prize6[Client]=2;
  971. }
  972. case 3:
  973. {
  974. prize6[Client]=3;
  975. }
  976. case 4:
  977. {
  978. prize6[Client]=4;
  979. }
  980. case 5:
  981. {
  982. prize6[Client]=5;
  983. }
  984. case 6:
  985. {
  986. prize6[Client]=6;
  987. }
  988. }
  989. }
  990.  
  991. public Action:Award_List(Client)
  992. {
  993. decl String:line[256];
  994. new Handle:menu = CreatePanel();
  995. Format(line, sizeof(line), "-本次獎品-");
  996. SetPanelTitle(menu, line);
  997. if(prize1[Client]==1)
  998. {
  999. Format(line, sizeof(line), "【特等獎】:加滿所有幸存者的HP");
  1000. DrawPanelText(menu, line);
  1001. } else if(prize1[Client]==2)
  1002. {
  1003. Format(line, sizeof(line), "【特等獎】:清除所有小僵屍");
  1004. DrawPanelText(menu, line);
  1005. } else if(prize1[Client]==3)
  1006. {
  1007. Format(line, sizeof(line), "【特等獎】:自己進入無敵狀態");
  1008. DrawPanelText(menu, line);
  1009. } else if(prize1[Client]==4)
  1010. {
  1011. Format(line, sizeof(line), "【特等獎】:自己重力降到最低");
  1012. DrawPanelText(menu, line);
  1013. } else if(prize1[Client]==5)
  1014. {
  1015. Format(line, sizeof(line), "【特等獎】:處死所有特感");
  1016. DrawPanelText(menu, line);
  1017. } else if(prize1[Client]==6)
  1018. {
  1019. Format(line, sizeof(line), "【特等獎】:飞毛腿");
  1020. DrawPanelText(menu, line);
  1021. } else if(prize1[Client]==7)
  1022. {
  1023. Format(line, sizeof(line), "【特等獎】:补给大礼包");
  1024. DrawPanelText(menu, line);
  1025. }
  1026.  
  1027. if(prize2[Client]==1)
  1028. {
  1029. Format(line, sizeof(line), "【壹等獎】:獲得M16步槍");
  1030. DrawPanelText(menu, line);
  1031. } else if(prize2[Client]==2)
  1032. {
  1033. Format(line, sizeof(line), "【壹等獎】:獲得AK47");
  1034. DrawPanelText(menu, line);
  1035. } else if(prize2[Client]==3)
  1036. {
  1037. Format(line, sizeof(line), "【壹等獎】:獲得大型連狙");
  1038. DrawPanelText(menu, line);
  1039. } else if(prize2[Client]==4)
  1040. {
  1041. Format(line, sizeof(line), "【壹等獎】:獲得小型連狙");
  1042. DrawPanelText(menu, line);
  1043. } else if(prize2[Client]==5)
  1044. {
  1045. Format(line, sizeof(line), "【壹等獎】:獲得自動散彈槍");
  1046. DrawPanelText(menu, line);
  1047. } else if(prize2[Client]==6)
  1048. {
  1049. Format(line, sizeof(line), "【壹等獎】:獲得SCOUT小狙");
  1050. DrawPanelText(menu, line);
  1051. } else if(prize2[Client]==7)
  1052. {
  1053. Format(line, sizeof(line), "【壹等獎】:獲得AWP大狙");
  1054. DrawPanelText(menu, line);
  1055. } else if(prize2[Client]==8)
  1056. {
  1057. Format(line, sizeof(line), "【壹等獎】:獲得SPAS戰鬥散彈槍");
  1058. DrawPanelText(menu, line);
  1059. } else if(prize2[Client]==9)
  1060. {
  1061. Format(line, sizeof(line), "【壹等獎】:獲得突擊步槍");
  1062. DrawPanelText(menu, line);
  1063. } else if(prize2[Client]==10)
  1064. {
  1065. Format(line, sizeof(line), "【壹等獎】:獲得榴彈槍");
  1066. DrawPanelText(menu, line);
  1067. } else if(prize2[Client]==11)
  1068. {
  1069. Format(line, sizeof(line), "【壹等獎】:獲得M60");
  1070. DrawPanelText(menu, line);
  1071. }
  1072.  
  1073. if(prize3[Client]==1)
  1074. {
  1075. Format(line, sizeof(line), "【二等獎】:獲得醫藥包");
  1076. DrawPanelText(menu, line);
  1077. } else if(prize3[Client]==2)
  1078. {
  1079. Format(line, sizeof(line), "【二等獎】:獲得止痛藥");
  1080. DrawPanelText(menu, line);
  1081. } else if(prize3[Client]==3)
  1082. {
  1083. Format(line, sizeof(line), "【二等獎】:獲得腎上腺素");
  1084. DrawPanelText(menu, line);
  1085. } else if(prize3[Client]==4)
  1086. {
  1087. Format(line, sizeof(line), "【二等獎】:獲得電擊器");
  1088. DrawPanelText(menu, line);
  1089. }
  1090.  
  1091. if(prize4[Client]==1)
  1092. {
  1093. Format(line, sizeof(line), "【三等獎】:獲得馬格南手槍");
  1094. DrawPanelText(menu, line);
  1095. } else if(prize4[Client]==2)
  1096. {
  1097. Format(line, sizeof(line), "【三等獎】:獲得棒球棒");
  1098. DrawPanelText(menu, line);
  1099. } else if(prize4[Client]==3)
  1100. {
  1101. Format(line, sizeof(line), "【三等獎】:獲得土制炸彈");
  1102. DrawPanelText(menu, line);
  1103. } else if(prize4[Client]==4)
  1104. {
  1105. Format(line, sizeof(line), "【三等獎】:獲得燃燒瓶");
  1106. DrawPanelText(menu, line);
  1107. } else if(prize4[Client]==5)
  1108. {
  1109. Format(line, sizeof(line), "【三等獎】:獲得膽汁炸彈");
  1110. DrawPanelText(menu, line);
  1111. } else if(prize4[Client]==6)
  1112. {
  1113. Format(line, sizeof(line), "【三等獎】:獲得電鋸");
  1114. DrawPanelText(menu, line);
  1115. } else if(prize4[Client]==7)
  1116. {
  1117. Format(line, sizeof(line), "【三等獎】:獲得小刀");
  1118. DrawPanelText(menu, line);
  1119. } else if(prize4[Client]==8)
  1120. {
  1121. Format(line, sizeof(line), "【三等獎】:獲得砍刀");
  1122. DrawPanelText(menu, line);
  1123. } else if(prize4[Client]==9)
  1124. {
  1125. Format(line, sizeof(line), "【三等獎】:獲得武士刀");
  1126. DrawPanelText(menu, line);
  1127. }
  1128.  
  1129. if(prize5[Client]==1)
  1130. {
  1131. Format(line, sizeof(line), "【安慰獎】:獲得燃燒彈盒");
  1132. DrawPanelText(menu, line);
  1133. } else if(prize5[Client]==2)
  1134. {
  1135. Format(line, sizeof(line), "【安慰獎】:獲得高爆彈盒");
  1136. DrawPanelText(menu, line);
  1137. } else if(prize5[Client]==3)
  1138. {
  1139. Format(line, sizeof(line), "【安慰獎】:獲得煤氣罐");
  1140. DrawPanelText(menu, line);
  1141. } else if(prize5[Client]==4)
  1142. {
  1143. Format(line, sizeof(line), "【安慰獎】:獲得汽油桶");
  1144. DrawPanelText(menu, line);
  1145. } else if(prize5[Client]==5)
  1146. {
  1147. Format(line, sizeof(line), "【安慰獎】:獲得氧氣罐");
  1148. DrawPanelText(menu, line);
  1149. }
  1150.  
  1151. if(prize6[Client]==1)
  1152. {
  1153. Format(line, sizeof(line), "【懲罰】:召喚兩只Witch");
  1154. DrawPanelText(menu, line);
  1155. } else if(prize6[Client]==2)
  1156. {
  1157. Format(line, sizeof(line), "【懲罰】:召喚壹只Tank");
  1158. DrawPanelText(menu, line);
  1159. } else if(prize6[Client]==3)
  1160. {
  1161. Format(line, sizeof(line), "【懲罰】:自殺!!!");
  1162. DrawPanelText(menu, line);
  1163. } else if(prize6[Client]==4)
  1164. {
  1165. Format(line, sizeof(line), "【懲罰】:召喚屍潮!");
  1166. DrawPanelText(menu, line);
  1167. } else if(prize6[Client]==5)
  1168. {
  1169. Format(line, sizeof(line), "【懲罰】:被冰凍20秒");
  1170. DrawPanelText(menu, line);
  1171. } else if(prize6[Client]==6)
  1172. {
  1173. Format(line, sizeof(line), "【懲罰】:被夺去肉身");
  1174. DrawPanelText(menu, line);
  1175. }
  1176. Format(line, sizeof(line), "開始抽獎");
  1177. DrawPanelItem(menu, line);
  1178. Format(line, sizeof(line), "返回");
  1179. DrawPanelItem(menu, line);
  1180. DrawPanelItem(menu, "Exit", ITEMDRAW_DISABLED);
  1181. SendPanelToClient(menu, Client, Start, MENU_TIME_FOREVER);
  1182. CloseHandle(menu);
  1183. }
  1184.  
  1185. public Start(Handle:menu, MenuAction:action, Client, param)
  1186. {
  1187. if (action == MenuAction_Select) {
  1188. switch (param)
  1189. {
  1190. case 1:
  1191. {
  1192. StopTime[Client] = CreateTimer(0.04, Roll, Client, TIMER_REPEAT);
  1193. rolled[Client]=true;
  1194. draw_function(Client);
  1195. L[Client]-=1;
  1196. }
  1197. case 2:
  1198. {
  1199. draw_function(Client);
  1200. }
  1201. }
  1202. }
  1203. }
  1204.  
  1205. public Action:Roll(Handle:timer, any:Client)
  1206. {
  1207. decl String:show[32];
  1208. new extract = GetRandomInt(1, 20);
  1209. switch (extract)
  1210. {
  1211. case 1:
  1212. {
  1213. Format(show, sizeof(show), "特等獎");
  1214. gain[Client]=1;
  1215. }
  1216. case 2:
  1217. {
  1218. Format(show, sizeof(show), "壹等獎");
  1219. gain[Client]=2;
  1220. }
  1221. case 3:
  1222. {
  1223. Format(show, sizeof(show), "壹等獎");
  1224. gain[Client]=2;
  1225. }
  1226. case 4:
  1227. {
  1228. Format(show, sizeof(show), "二等獎");
  1229. gain[Client]=3;
  1230. }
  1231. case 5:
  1232. {
  1233. Format(show, sizeof(show), "二等獎");
  1234. gain[Client]=3;
  1235. }
  1236. case 6:
  1237. {
  1238. Format(show, sizeof(show), "二等獎");
  1239. gain[Client]=3;
  1240. }
  1241. case 7:
  1242. {
  1243. Format(show, sizeof(show), "三等獎");
  1244. gain[Client]=4;
  1245. }
  1246. case 8:
  1247. {
  1248. Format(show, sizeof(show), "三等獎");
  1249. gain[Client]=4;
  1250. }
  1251. case 9:
  1252. {
  1253. Format(show, sizeof(show), "三等獎");
  1254. gain[Client]=4;
  1255. }
  1256. case 10:
  1257. {
  1258. Format(show, sizeof(show), "三等獎");
  1259. gain[Client]=4;
  1260. }
  1261. case 11:
  1262. {
  1263. Format(show, sizeof(show), "三等獎");
  1264. gain[Client]=4;
  1265. }
  1266. case 12:
  1267. {
  1268. Format(show, sizeof(show), "安慰獎");
  1269. gain[Client]=5;
  1270. }
  1271. case 13:
  1272. {
  1273. Format(show, sizeof(show), "安慰獎");
  1274. gain[Client]=5;
  1275. }
  1276. case 14:
  1277. {
  1278. Format(show, sizeof(show), "安慰獎");
  1279. gain[Client]=5;
  1280. }
  1281. case 15:
  1282. {
  1283. Format(show, sizeof(show), "安慰獎");
  1284. gain[Client]=5;
  1285. }
  1286. case 16:
  1287. {
  1288. Format(show, sizeof(show), "安慰獎");
  1289. gain[Client]=5;
  1290. }
  1291. case 17:
  1292. {
  1293. Format(show, sizeof(show), "安慰獎");
  1294. gain[Client]=5;
  1295. }
  1296. case 18:
  1297. {
  1298. Format(show, sizeof(show), "安慰獎");
  1299. gain[Client]=5;
  1300. }
  1301. case 19:
  1302. {
  1303. Format(show, sizeof(show), "安慰獎");
  1304. gain[Client]=5;
  1305. }
  1306. case 20:
  1307. {
  1308. Format(show, sizeof(show), "懲罰");
  1309. gain[Client]=6;
  1310. }
  1311. }
  1312. PrintCenterText(Client, "★抽獎中★ → %s 請在列表中選擇: -停- ", show);
  1313. EmitSoundToClient(Client, "ui/littlereward.wav");
  1314. }
  1315.  
  1316. stock CheatCommand(Client, const String:command[], const String:arguments[])
  1317. {
  1318. if (!Client) return;
  1319. new admindata = GetUserFlagBits(Client);
  1320. SetUserFlagBits(Client, ADMFLAG_ROOT);
  1321. new flags = GetCommandFlags(command);
  1322. SetCommandFlags(command, flags & ~FCVAR_CHEAT);
  1323. FakeClientCommand(Client, "%s %s", command, arguments);
  1324. SetCommandFlags(command, flags);
  1325. SetUserFlagBits(Client, admindata);
  1326. }
  1327.  
  1328. Handle:AttachParticle(ent, String:particleType[], Float:time=10.0)
  1329. {
  1330. if (ent < 1)
  1331. {
  1332. return INVALID_HANDLE;
  1333. }
  1334.  
  1335. new particle = CreateEntityByName("info_particle_system");
  1336.  
  1337. if (IsValidEdict(particle))
  1338. {
  1339. decl String:tName[32];
  1340. new Float:pos[3];
  1341.  
  1342. GetEntPropVector(ent, Prop_Send, "m_vecOrigin", pos);
  1343. pos[2] += 60;
  1344.  
  1345. Format(tName, sizeof(tName), "target%i", ent);
  1346. DispatchKeyValue(ent, "targetname", tName);
  1347.  
  1348. DispatchKeyValue(particle, "targetname", "tf2particle");
  1349. DispatchKeyValue(particle, "parentname", tName);
  1350. DispatchKeyValue(particle, "effect_name", particleType);
  1351. if (DispatchSpawn(particle))
  1352. {
  1353. TeleportEntity(particle, pos, NULL_VECTOR, NULL_VECTOR);
  1354. SetVariantString(tName);
  1355. AcceptEntityInput(particle, "SetParent", particle, particle, 0);
  1356.  
  1357. SetVariantString("OnUser1 !self,Start,,0.0,-1");
  1358. AcceptEntityInput(particle, "AddOutput");
  1359. SetVariantString("OnUser2 !self,Stop,,4.0,-1");
  1360. AcceptEntityInput(particle, "AddOutput");
  1361. ActivateEntity(particle);
  1362. AcceptEntityInput(particle, "FireUser1");
  1363. AcceptEntityInput(particle, "FireUser2");
  1364.  
  1365. new Handle:pack;
  1366. new Handle:hTimer;
  1367. hTimer = CreateDataTimer(time, DeleteParticle, pack);
  1368. WritePackCell(pack, particle);
  1369. WritePackString(pack, particleType);
  1370. WritePackCell(pack, ent);
  1371.  
  1372. new Handle:packLoop;
  1373. hTimerLoopEffect[ent] = CreateDataTimer(4.2, LoopParticleEffect, packLoop, TIMER_REPEAT);
  1374. WritePackCell(packLoop, particle);
  1375. WritePackCell(packLoop, ent);
  1376.  
  1377. return hTimer;
  1378. }
  1379. else
  1380. {
  1381. if (IsValidEdict(particle))
  1382. {
  1383. RemoveEdict(particle);
  1384. }
  1385. return INVALID_HANDLE;
  1386. }
  1387. }
  1388. return INVALID_HANDLE;
  1389. }
  1390.  
  1391. public Action:DeleteParticle(Handle:timer, Handle:pack)
  1392. {
  1393. decl String:particleType[32];
  1394.  
  1395. ResetPack(pack);
  1396. new particle = ReadPackCell(pack);
  1397. ReadPackString(pack, particleType, sizeof(particleType));
  1398. new client = ReadPackCell(pack);
  1399.  
  1400. if (hTimerLoopEffect[client] != INVALID_HANDLE)
  1401. {
  1402. KillTimer(hTimerLoopEffect[client]);
  1403. hTimerLoopEffect[client] = INVALID_HANDLE;
  1404. }
  1405.  
  1406. if (IsValidEntity(particle))
  1407. {
  1408. decl String:classname[128];
  1409. GetEdictClassname(particle, classname, sizeof(classname));
  1410. if (StrEqual(classname, "info_particle_system", false))
  1411. {
  1412. RemoveEdict(particle);
  1413. }
  1414. }
  1415.  
  1416. if (StrEqual(particleType, "achieved", true))
  1417. {
  1418. hTimerAchieved[client] = INVALID_HANDLE;
  1419. }
  1420. else if (StrEqual(particleType, "mini_fireworks", true))
  1421. {
  1422. hTimerMiniFireworks[client] = INVALID_HANDLE;
  1423. }
  1424. }
  1425.  
  1426. public Action:LoopParticleEffect(Handle:timer, Handle:pack)
  1427. {
  1428.  
  1429. ResetPack(pack);
  1430. new particle = ReadPackCell(pack);
  1431. new client = ReadPackCell(pack);
  1432.  
  1433. if (IsValidEntity(particle))
  1434. {
  1435. decl String:classname[128];
  1436. GetEdictClassname(particle, classname, sizeof(classname));
  1437. if (StrEqual(classname, "info_particle_system", false))
  1438. {
  1439. AcceptEntityInput(particle, "FireUser1");
  1440. AcceptEntityInput(particle, "FireUser2");
  1441. return Plugin_Continue;
  1442. }
  1443. }
  1444. hTimerLoopEffect[client] = INVALID_HANDLE;
  1445. return Plugin_Stop;
  1446. }
  1447.  
  1448. public Action:Msg(Handle:timer, any:data)
  1449. {
  1450. PrintToChatAll("\x04[Ra1n6owS]\x03 输入 \x04!ldw \x03打开 \x01[\x04抽奖系统\x01]");
  1451.  
  1452. }
  1453.  
  1454. stock bool:IsCommonInfected(iEntity)
  1455. {
  1456. if(iEntity > 0 && IsValidEntity(iEntity) && IsValidEdict(iEntity))
  1457. {
  1458. decl String:strClassName[64];
  1459. GetEdictClassname(iEntity, strClassName, sizeof(strClassName));
  1460. return StrEqual(strClassName, "infected");
  1461. }
  1462. return false;
  1463. }
  1464.  
  1465. stock bool:IsWitch(iEntity)
  1466. {
  1467. if(iEntity > 0 && IsValidEntity(iEntity) && IsValidEdict(iEntity))
  1468. {
  1469. decl String:strClassName[64];
  1470. GetEdictClassname(iEntity, strClassName, sizeof(strClassName));
  1471. return StrEqual(strClassName, "witch");
  1472. }
  1473. return false;
  1474. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement