Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.89 KB | None | 0 0
  1. -- Called when a player's typing display has started.
  2. function Schema:PlayerStartTypingDisplay(player, code)
  3.     if (player:GetFaction() == FACTION_MPF and !player:IsNoClipping()) then
  4.         if (code == "n" or code == "y" or code == "w" or code == "r") then
  5.             if (!player.typingBeep) then
  6.                 player.typingBeep = true;
  7.                 if local randomSounds = {1, 2};
  8.                 local randomNumber = math.random(1, 2); then
  9.                     player:EmitSound("npc/metropolice/r_on"..randomSounds[randomNumber]..".wav");
  10.                 end;
  11.             end;
  12.         end;
  13.     elseif (player:GetFaction() == FACTION_OTA) then
  14.         if (code == "n" or code == "y" or code == "w" or code == "r") then
  15.             if (!player.typingBeep) then
  16.                 player.typingBeep = true;
  17.                 if local randomSounds = {1, 2};
  18.                 local randomNumber = math.random(1, 2); then
  19.                     player:EmitSound("npc/combine_soldier/r_on"..randomSounds[randomNumber]..".wav");
  20.                 end;
  21.             end;
  22.         end;
  23.     end;
  24. end;
  25.  
  26. -- Called when a player's typing display has finished.
  27. function Schema:PlayerFinishTypingDisplay(player, textTyped)
  28.     if (player:GetFaction() == FACTION_MPF and textTyped) then
  29.         if (player.typingBeep) then
  30.             if local randomSounds = {1, 2, 3, 4};
  31.             local randomNumber = math.random(1, 4); then
  32.                 player:EmitSound("npc/metropolice/r_off"..randomSounds[randomNumber]..".wav");
  33.             end;
  34.         end;
  35.     elseif (player:GetFaction() == FACTION_OTA) then
  36.         if (player.typingBeep) then
  37.             if local randomSounds = {1, 2, 3};
  38.             local randomNumber = math.random(1, 3); then
  39.                     player:EmitSound("npc/combine_soldier/r_off"..randomSounds[randomNumber]..".wav");
  40.                 end;
  41.             end;
  42.         end;
  43.     end;
  44.    
  45.     player.typingBeep = nil;
  46. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement