Author Topic: [E2] Combine voice commands  (Read 14934 times)

Offline Khub

  • Gold Member
  • *
  • Posts: 1,136
  • Awards [OCRP Award] Secret Phrase [OCRP Award] Evo City Half Marathon [OCRP Award] Social Player [OCRP Award] Comrades
    • View Profile
    • Awards
[E2] Combine voice commands
« on: September 11, 2011, 08:10:13 AM »
Hello all :)
Few months ago, I was a bit bored and did an Expression 2 chip that allows you to use combine chat commands like in HL2RP.

Positives:
  • Playing sound when you (chip owner) say registered phrase in chat
  • Hiding the registered phrase and showing edited one - Pick up that can. instead of can1 (optional)
  • Only thing you need to get this working is Wiremod and brain
  • Low OPS (maximum of 25 on first execution)
  • Supports 58 sound commands

Negatives:
  • Edited phrases show up after 0,9 seconds plus latency
  • A bit unusual setup - you must enable console commands execution in E2 settings

Code: [Select]
@name Combine-Sound-Player
@persist S:table R:table Last WhatToSay:string EnableConCommands

runOnChat(1)
dsJoinGroup("kh_csp")
dsSetScope(1)

if (first()) {
    EnableConCommands = 1 #set this value to 0 to disable saying edited phrases
    S = table()
    S["citizen",string] = "citizen"
    S["apply",string] = "apply"
    S["dont move",string] = "dontmove"
    S["copy",string] = "copy"
    S["help",string] = "help"
    S["grenade",string] = "grenade"
    S["haha",string] = "chuckle"
    S["isolate",string] = "isolate"
    S["move",string] = "movealong"
    S["moveit",string] = "moveit"
    S["roger",string] = "rogerthat"
    S["sector",string] = "sector"
    S["shit",string] = "shit"
    S["affirmative",string] = "affirmative"
    S["amputate",string] = "amputate"
    S["down",string] = "getdown"
    S["gtfo",string] = "getoutofhere"
    S["move",string] = "isaidmovealong"
    S["keep moving",string] = "keepmoving"
    S["anticitizen",string] = "anticitizen"
    S["administer",string] = "administer"
    S["verdict done",string] = "finalverdictadministered"
    S["king",string] = "king"
    S["can1",string] = "pickupthecan1"
    S["can2",string] = "pickupthecan2"
    S["can3",string] = "pickupthecan3"
    S["bin1",string] = "putitinthetrash1"
    S["bin2",string] = "putitinthetrash2"
    S["restricted block",string] = "restrictedblock"
    S["warn1",string] = "firstwarningmove"
    S["warn2",string] = "thisisyoursecondwarning"
    S["warn3",string] = "finalwarning"
    S["xray",string] = "xray"
    S["one",string] = "one"
    S["two",string] = "two"
    S["three",string] = "three"
    S["four",string] = "four"
    S["five",string] = "five"
    S["six",string] = "six"
    S["seven",string] = "seven"
    S["eight",string] = "eight"
    S["nine",string] = "nine"
    S["ten",string] = "ten"
    S["ok",string] = "allrightyoucango"
    S["trouble",string] = "lookingfortrouble"
    S["hero",string] = "hero"
    S["king",string] = "king"
    S["lookout",string] = "lookout"
    S["moveback",string] = "movebackrightnow"
    S["moveback",string] = "movebackrightnow"
    S["ampready",string] = "readytoamputate"
    S["fwready",string] = "readytoprosecutefinalwarning"
    S["moveback",string] = "movebackrightnow"
    S["subject",string] = "subject"
    S["isdown",string] = "isdown"
    S["malcompliance",string] = "youwantamalcomplianceverdict"
    S["prepareforverdict",string] = "prepareforjudgement"
    S["hold it",string] = "holditrightthere"

    R["citizen",string] = "Citizen."
    R["apply",string] = "Apply!"
    R["dont move",string] = "Don't move!"
    R["copy",string] = "Copy."
    R["help",string] = "Help!"
    R["grenade",string] = "Grenade!"
    R["haha",string] = "Haha."
    R["isolate",string] = "Isolate!"
    R["move",string] = "Move along."
    R["moveit",string] = "Move it!"
    R["roger",string] = "Roger that."
    R["shit",string] = "Shit!"
    R["affirmative",string] = "Affirmative!"
    R["amputate",string] = "Amputate!"
    R["down",string] = "Get down!"
    R["gtfo",string] = "Get out of here!"
    R["move",string] = "I said move along!"
    R["keep moving",string] = "Keep moving"
    R["anticitizen",string] = "Anti-citizen"
    R["administer",string] = "Administer"
    R["verdict done",string] = "Final verdict administered."
    R["king",string] = "King!"
    R["can1",string] = "Pick up that can."
    R["can2",string] = "Pick.. up.. the.. can..!"
    R["can3",string] = "I said pick up the can!"
    R["bin1",string] = "Now, put it in the trashcan!"
    R["bin2",string] = "I said put it in the trashcan!"
    R["restricted block",string] = "Restricted block."
    R["warn1",string] = "First warning, move!"
    R["warn2",string] = "This is your secord warning."
    R["warn3",string] = "Final warning!"
    R["xray",string] = "X-Ray"
    R["ok",string] = "Alright, you can go."
    R["trouble",string] = "Lookin' for trouble?"
    R["lookout",string] = "Look out!"
    R["moveback",string] = "Move back, right now!"
    R["ampready",string] = "Ready to amputate."
    R["fwready",string] = "Ready to prosecute final warning."
    R["isdown",string] = "is down!"
    R["malcompliance",string] = "Do you want a malcompliance verdict?"
    R["prepareforverdict",string] = "Suspect, prepare to recieve a civil judgement!"
    R["hold it",string] = "Hold it right there!"
    Last = 0
}


if (chatClk(owner()) & Last < owner():lastSaidWhen()) {
     Last = owner():lastSaidWhen()
     Played = 0
   
     foreach (K,V:string = S) {
      if (owner():lastSaid():lower() == K) {
         owner():soundPlay(1,3,"npc/metropolice/vo/" + V + ".wav")
         if (EnableConCommands) {
           foreach (RK, RV:string = R) {
            if (RK == K) {
             hideChat(1)
             WhatToSay = RV
             timer("say",900)
             break
            }
           }


           Played = 1
           break
         }
      }   
     }
}

if (clk("say")) {
 concmd("say " + WhatToSay)   
}

Note: Availible chat commands are visible in the code, look at the code with S["I am Chatcommand!",string] = "something"

Tell me if you like and feel free to use / reuse, if you want.

Re: [E2] Combine voice commands
« Reply #1 on: September 11, 2011, 08:41:44 AM »
You did not make this, I seen it on the Wiremod forums a while ago.
Don't claim it yours.


After looking back, you posted it... Hah.... Lol..
« Last Edit: September 11, 2011, 08:43:15 AM by Martinerrr »

Offline Khub

  • Gold Member
  • *
  • Posts: 1,136
  • Awards [OCRP Award] Secret Phrase [OCRP Award] Evo City Half Marathon [OCRP Award] Social Player [OCRP Award] Comrades
    • View Profile
    • Awards
Re: [E2] Combine voice commands
« Reply #2 on: September 12, 2011, 11:43:31 AM »
Yes, that was me. Had some problems with it :D

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal