Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.87 KB | None | 0 0
  1. @ScriptManifest(Script.SERVICE,"Login Service","Løhde", "0.1")
  2. class LoginServices : ServiceScript() {
  3.  
  4.     val gameWorld = -1
  5.     val password = ""
  6.     val email = ""
  7.     val shouldLogin = false
  8.     val logout = false
  9.  
  10.     override suspend fun loop() {
  11.  
  12.     }
  13.  
  14.     override fun start() {
  15.         ctx.ipc.subscribe(ctx.ipc.uuid, ::ipcCallback)
  16.         ctx.ipc.subscribe("Sexy Channel", ::ipcCallback)
  17.         println("start")
  18.     }
  19.  
  20.     override fun stop() {
  21.         ctx.ipc.unsubscribe(ctx.ipc.uuid)
  22.         println("stop")
  23.     }
  24.  
  25.     private fun ipcCallback(channel: String, message: String) {
  26.  
  27.         // the general channel for all script in the channel
  28.         if (channel == ctx.ipc.uuid) {
  29.             val parts = message.split(";")
  30.             if (parts[0]?.contains("login")) {
  31.                 println("login packet")
  32.             }
  33.  
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement