Advertisement
Guest User

Untitled

a guest
Jul 12th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.70 KB | None | 0 0
  1. //! zinc
  2. library SpeechSystem requires Users,TimerUtils,Functions{
  3.  
  4. boolean SoundInUse = false;
  5. force Silence_Force = CreateForce();
  6.  
  7. sound Titan_Speech[];
  8. sound Builder_Speech[];
  9.  
  10. function onSilence() -> boolean{
  11. player p=GetTriggerPlayer();
  12. string s=GetEventPlayerChatString();
  13. if (s=="-silence"){
  14. sayPlayer(p,"|c00cfb549Player Speech:|r Off");
  15. ForceAddPlayer(Silence_Force,p);
  16. }else if (s=="-unsilence"){
  17. sayPlayer(p,"|c00cfb549Player Speech:|r On");
  18. ForceRemovePlayer(Silence_Force,p);
  19. }
  20. p=null;
  21. return false;
  22. }
  23.  
  24. function getTitanSound(string text) -> sound{
  25. sound s=Titan_Speech[S2I(text)];
  26. if (s==null){return null;}
  27. return s;
  28. }
  29.  
  30. function getBuilderSound(string text) -> sound{
  31. sound s=Builder_Speech[S2I(text)];
  32. if (s==null){return null;}
  33. return s;
  34. }
  35.  
  36. struct Data{
  37. sound soundHandle;
  38. }
  39.  
  40. function onTimer(){
  41. timer t=GetExpiredTimer();
  42. Data this=GetTimerData(t);
  43. SoundInUse=false;
  44. this.destroy();
  45. ReleaseTimer(t);
  46. t=null;
  47. }
  48.  
  49. function onAction() -> boolean{
  50. Data this=Data.create();
  51. player p=GetTriggerPlayer();
  52. timer t=NewTimer();
  53. integer id=GetPlayerId(p);
  54. integer d;
  55. string s=GetEventPlayerChatString();
  56. sound h;
  57. if (SoundInUse==false){
  58. if (isBuilder[id]==true){h=getBuilderSound(s);}
  59. else if (isTitan[id]==true){h=getTitanSound(s);}
  60. if (h!=null){
  61. SoundInUse=true;
  62. d=GetSoundDuration(h);
  63. this.soundHandle=h;
  64. SetTimerData(t,integer(this));
  65. TimerStart(t,d,false,function onTimer);
  66. if (IsPlayerInForce(GetLocalPlayer(),Silence_Force)==false){SoundStart(h);}
  67. }
  68. }
  69. p=null;
  70. t=null;
  71. h=null;
  72. return false;
  73. }
  74.  
  75. function speechVariable(){
  76. timer t=GetExpiredTimer();
  77. //Builder Speech
  78. Builder_Speech[S2I("im waiting")]=gg_snd_Builder_ImWaiting;
  79. Builder_Speech[S2I("this is too easy")]=gg_snd_Builder_ThisIsTooEasy;
  80. Builder_Speech[S2I("by the gods")]=gg_snd_Builder_ByTheGodsYourAnnoying;
  81. Builder_Speech[S2I("aahh")]=gg_snd_Builder_Aahh;
  82. Builder_Speech[S2I("what")]=gg_snd_Builder_What;
  83. Builder_Speech[S2I("begone")]=gg_snd_Builder_BeGoneSpawnOfDarkness;
  84. Builder_Speech[S2I("i grow tired of waiting")]=gg_snd_Builder_IGrowTiredOfWaiting;
  85. Builder_Speech[S2I("lolol")]=gg_snd_Builder_Lolol;
  86. Builder_Speech[S2I("huh")]=gg_snd_Builder_Huh;
  87. Builder_Speech[S2I("yes")]=gg_snd_Builder_Yes;
  88. Builder_Speech[S2I("why not")]=gg_snd_Builder_WhyNot;
  89. Builder_Speech[S2I("bring it on")]=gg_snd_Builder_BringItOn;
  90. Builder_Speech[S2I("time to die")]=gg_snd_Builder_TimeToDie;
  91. Builder_Speech[S2I("let me at them")]=gg_snd_Builder_LetMeAtThem;
  92. Builder_Speech[S2I("youve done well")]=gg_snd_Builder_YouveDoneWell;
  93. Builder_Speech[S2I("lets get the hell out of here")]=gg_snd_Builder_LetsGetTheHellOutOfHere;
  94. Builder_Speech[S2I("no not that way")]=gg_snd_Builder_NoNotThatWay;
  95. Builder_Speech[S2I("to hell with your apologies")]=gg_snd_Builder_ToHellWithYourApologies;
  96. Builder_Speech[S2I("then lets go")]=gg_snd_Builder_ThenLetsGoIDontWantToKeepTheBastardWaiting;
  97. Builder_Speech[S2I("damned cowards")]=gg_snd_Builder_DamnedCowards;
  98. Builder_Speech[S2I("you bastard")]=gg_snd_Builder_YouBastard;
  99. Builder_Speech[S2I("what the hell is that")]=gg_snd_Builder_WhatTheHellIsThat;
  100. Builder_Speech[S2I("here they come boys")]=gg_snd_Builder_HereTheyComeBoysStandYourGround;
  101. Builder_Speech[S2I("take cover")]=gg_snd_Builder_TakeCover;
  102. Builder_Speech[S2I("hes escaping")]=gg_snd_Builder_HesEscapingKillHim;
  103. Builder_Speech[S2I("save us")]=gg_snd_Builder_SaveUs;
  104. Builder_Speech[S2I("oh no")]=gg_snd_Builder_OhNo;
  105. Builder_Speech[S2I("where")]=gg_snd_Builder_Where;
  106. Builder_Speech[S2I("damn beasts")]=gg_snd_Builder_DamnBeasts;
  107. Builder_Speech[S2I("im so tired")]=gg_snd_Builder_ImSoTired;
  108. Builder_Speech[S2I("demon spawned wretchs")]=gg_snd_Builder_DemonSpawnedWretchs;
  109. Builder_Speech[S2I("kill them all twice")]=gg_snd_Builder_KillThemAllTwice;
  110. Builder_Speech[S2I("panda")]=gg_snd_Builder_Panda;
  111. //Titan Speech
  112. Titan_Speech[S2I("this one is mine")]=gg_snd_Titan_ThisOneIsMine;
  113. Titan_Speech[S2I("vanquish the weak")]=gg_snd_Titan_VanquishTheWeak;
  114. Titan_Speech[S2I("dont waste my time")]=gg_snd_Titan_DontWasteMyTime;
  115. Titan_Speech[S2I("right")]=gg_snd_Titan_Right;
  116. Titan_Speech[S2I("of course")]=gg_snd_Titan_OfCourse;
  117. Titan_Speech[S2I("stay out of my way")]=gg_snd_Titan_StayOutOfMyWay;
  118. Titan_Speech[S2I("pitiful")]=gg_snd_Titan_Pitiful;
  119. Titan_Speech[S2I("i must feed")]=gg_snd_Titan_IMustFeed;
  120. Titan_Speech[S2I("im always on the winning side")]=gg_snd_Titan_ImAlwaysOnTheWinningSide;
  121. Titan_Speech[S2I("die")]=gg_snd_Titan_Die;
  122. Titan_Speech[S2I("your soul is mine")]=gg_snd_Titan_YourSoulIsMine ;
  123. Titan_Speech[S2I("outstanding")]=gg_snd_Titan_Outstanding;
  124. Titan_Speech[S2I("cross over children")]=gg_snd_Titan_CrossOverChildrenCrossOverIntoTheLight;
  125. Titan_Speech[S2I("i come to cleanse")]=gg_snd_Titan_IComeToCleansThisLand;
  126. Titan_Speech[S2I("taste this")]=gg_snd_Titan_TasteThis;
  127. Titan_Speech[S2I("the dead shall serve")]=gg_snd_Titan_TheDeadShallServe;
  128. Titan_Speech[S2I("let blood drown the weak")]=gg_snd_Titan_LetBloodDrownedTheWeak;
  129. Titan_Speech[S2I("now feel my wrath")]=gg_snd_Titan_NowFeelMyWrath;
  130. Titan_Speech[S2I("never")]=gg_snd_Titan_Never;
  131. Titan_Speech[S2I("what the hell")]=gg_snd_Titan_WhatTheHellIsGoingOnHere;
  132. Titan_Speech[S2I("kill them all")]=gg_snd_Titan_KillThemAll;
  133. Titan_Speech[S2I("youve betrayed us all")]=gg_snd_Titan_YouveBetrayedUsAll;
  134. Titan_Speech[S2I("you should burn")]=gg_snd_Titan_YouShouldBurnInHell;
  135. Titan_Speech[S2I("gladly")]=gg_snd_Titan_Gladly;
  136. Titan_Speech[S2I("fateless coward")]=gg_snd_Titan_FatelessCoward;
  137. Titan_Speech[S2I("its a trap")]=gg_snd_Titan_ItsATrap;
  138. Titan_Speech[S2I("that doesnt sound too difficult")]=gg_snd_Titan_ThatDoesntSoundTooDifficult;
  139. Titan_Speech[S2I("your time has come")]=gg_snd_Titan_YourTimeHasCome;
  140. Titan_Speech[S2I("well see about that")]=gg_snd_Titan_WellSeeAboutThat;
  141. Titan_Speech[S2I("so youre not upset")]=gg_snd_Titan_SoYoureNotUpsetAboutMeKillingYouThatOneTime;
  142. Titan_Speech[S2I("tremble mortals")]=gg_snd_Titan_TrembleMortals;
  143. Titan_Speech[S2I("haha")]=gg_snd_Titan_Haha;
  144. ReleaseTimer(t);
  145. t=null;
  146. }
  147.  
  148. function onInit(){
  149. trigger t=CreateTrigger();
  150. trigger s=CreateTrigger();
  151. timer v=NewTimer();
  152. integer i=0;
  153. TimerStart(v,0.01,false,function speechVariable);
  154. while (i<bj_MAX_PLAYER_SLOTS){
  155. TriggerRegisterPlayerChatEvent(t,Player(i),"",false);
  156. TriggerRegisterPlayerChatEvent(s,Player(i),"-silence",true);
  157. TriggerRegisterPlayerChatEvent(s,Player(i),"-unsilence",true);
  158. i=i+1;
  159. }
  160. TriggerAddCondition(t,Condition(function onAction));
  161. TriggerAddCondition(t,Condition(function onSilence));
  162. t=null;
  163. s=null;
  164. v=null;
  165. }
  166. }
  167. //! endzinc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement