• Hallo leute,


    geht die Kick function allgemein nicht?


    [lua]
    function KickPlayer(kicker, player)
    kicker:sendMessage("player kicked")
    player:Kick()
    end
    [/lua]
    ______________________________________________
    Hi guys,
    is the kick does not function in general?


    [lua]
    function KickPlayer(kicker, player)
    kicker:sendMessage("player kicked")
    player:Kick()
    end
    [/lua]

  • EN: Please pay attention to the use of small and capital letters, the kick-function also requires a parameter (the reason that will be displayed to the kicked player) ;)
    DE: Bitte auf Klein-/Großschreibung achten, die kick-Funktion benötigt außerdem auch einen Parameter (den Grund, welcher dem Spieler angezeigt wird) ;)
    [lua]player:kick("You have been kicked for no reason")[/lua]

  • Is there such a function built-in ? Is this returning some kind of lua errors ?


    Error / Log
    [lua]
    Delete Client ID:0at com.jme3.network.base.KernelAdapter.run(KernelAdapter.java:280)at com.jme3.network.base.KernelAdapter.createAndDispatch(KernelAdapter.java:237)at com.jme3.network.base.KernelAdapter.dispatch(KernelAdapter.java:183)at com.jme3.network.base.DefaultServer$Redispatch.messageReceived(DefaultServer.java:565)at com.jme3.network.base.DefaultServer$Redispatch.messageReceived(DefaultServer.java:569)at com.jme3.network.base.DefaultServer.dispatch(DefaultServer.java:282)at com.jme3.network.base.MessageListenerRegistry.messageReceived(MessageListenerRegistry.java:73)at server.listeners.a.messageReceived(SourceFile:64)at server.listeners.a.a(SourceFile:93)at lua.ScriptEventManager.triggerEvent(SourceFile:32)at lua.ScriptEventList.triggerEvent(SourceFile:20)at org.luaj.vm2.LuaClosure.invoke(Unknown Source)at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)at org.luaj.vm2.LuaClosure.execute(Unknown Source)at org.luaj.vm2.LuaClosure.call(Unknown Source)at org.luaj.vm2.LuaClosure.execute(Unknown Source)at org.luaj.vm2.LuaValue.call(Unknown Source)at org.luaj.vm2.LuaValue.callmt(Unknown Source)at org.luaj.vm2.LuaValue.checkmetatag(Unknown Source)org.luaj.vm2.LuaError: @/home/r12_kd15759/game/6655_46978_rw/scripts/Essentials/Essentials.lua:325 attempt to call nilSEVERE: Unhandled error, endpoint:NioEndpoint[1, java.nio.channels.SocketChannel[connected local=/----:6655 remote=/---:51948]], context:i.d@2fd4f37fJan 25, 2015 5:57:34 PM com.jme3.network.base.KernelAdapter reportError[LUA][Essentials] 01/25/15 17:57:34 Marvinmauric: /kick Marvinmauric
    [/lua]


    Errorline:


    [lua] player:Kick()[/lua]



    Thank you for your help! ;)

  • [lua]
    at com.jme3.network.base.KernelAdapter.run(KernelAdapter.java:280)at com.jme3.network.base.KernelAdapter.createAndDispatch(KernelAdapter.java:237)at com.jme3.network.base.KernelAdapter.dispatch(KernelAdapter.java:183)at com.jme3.network.base.DefaultServer$Redispatch.messageReceived(DefaultServer.java:565)at com.jme3.network.base.DefaultServer$Redispatch.messageReceived(DefaultServer.java:569)at com.jme3.network.base.DefaultServer.dispatch(DefaultServer.java:282)at com.jme3.network.base.MessageListenerRegistry.messageReceived(MessageListenerRegistry.java:73)at server.listeners.a.messageReceived(SourceFile:64)at server.listeners.a.a(SourceFile:93)at lua.ScriptEventManager.triggerEvent(SourceFile:32)at lua.ScriptEventList.triggerEvent(SourceFile:20)at org.luaj.vm2.LuaClosure.invoke(Unknown Source)at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)at org.luaj.vm2.LuaClosure.execute(Unknown Source)at org.luaj.vm2.LuaClosure.call(Unknown Source)at org.luaj.vm2.LuaClosure.execute(Unknown Source)at org.luaj.vm2.LuaValue.call(Unknown Source)at org.luaj.vm2.LuaValue.callmt(Unknown Source)at org.luaj.vm2.LuaValue.checkmetatag(Unknown Source)org.luaj.vm2.LuaError: @/home/r12_kd15759/game/6655_46978_rw/scripts/Essentials/Essentials.lua:325 attempt to call nilSEVERE: Unhandled error, endpoint:NioEndpoint[1, java.nio.channels.SocketChannel[connected local=/----:6655 remote=/---:51981]], context:i.d@5683befdJan 25, 2015 6:02:09 PM com.jme3.network.base.KernelAdapter reportError[LUA][Essentials] 01/25/15 18:02:09 Marvinmauric: /kick Marvinmauric
    [/lua]


    ERRORline:


    [lua]player:kick("You have been kicked for no reason")[/lua]

  • EN: Maybe the targetplayer was not found, so it is nil. You should check if player is not nil:
    DE: Vielleicht wurde der Spieler nicht gefunden, also ist 'player' nil. Du solltest am besten prüfen, ob Spieler ungleich nil ist:
    [lua]if player ~= nil then
    player:kick("You have been kicked for no reason");
    end[/lua]

  • EN: I ask myself really what could be there had try it with several variants.
    DE: Ich frag mich echt woran es liegen könnte habe es mit mehren Varianten Probiert.


    [lua]
    at com.jme3.network.base.KernelAdapter.run(KernelAdapter.java:280)at com.jme3.network.base.KernelAdapter.createAndDispatch(KernelAdapter.java:237)at com.jme3.network.base.KernelAdapter.dispatch(KernelAdapter.java:183)at com.jme3.network.base.DefaultServer$Redispatch.messageReceived(DefaultServer.java:565)at com.jme3.network.base.DefaultServer$Redispatch.messageReceived(DefaultServer.java:569)at com.jme3.network.base.DefaultServer.dispatch(DefaultServer.java:282)at com.jme3.network.base.MessageListenerRegistry.messageReceived(MessageListenerRegistry.java:73)at server.listeners.a.messageReceived(SourceFile:64)at server.listeners.a.a(SourceFile:93)at lua.ScriptEventManager.triggerEvent(SourceFile:32)at lua.ScriptEventList.triggerEvent(SourceFile:20)at org.luaj.vm2.LuaClosure.invoke(Unknown Source)at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)at org.luaj.vm2.LuaClosure.execute(Unknown Source)at org.luaj.vm2.LuaClosure.call(Unknown Source)at org.luaj.vm2.LuaClosure.execute(Unknown Source)at org.luaj.vm2.LuaValue.call(Unknown Source)at org.luaj.vm2.LuaValue.callmt(Unknown Source)at org.luaj.vm2.LuaValue.checkmetatag(Unknown Source)org.luaj.vm2.LuaError: @/home/r12_kd15759/game/6655_46978_rw/scripts/Essentials/Essentials.lua:325 attempt to call nil
    [/lua]


    ERRORLINE:


    [lua]if player ~= nil then[/lua]

  • Well, here's a kick function that should be working, however, I can't test alone, since evrytime I try to kick myself, the game throw my an error, however, there's no error on the server console, so I guess this works !



    The command below is called on event, when a player type in the chat, then exploded in a table of String I acces with cmd[int].


    [lua]
    if cmd[1] == "/kick" then
    -- Checking if admin :
    if not event.player:isAdmin() then return msgAccessDenied(event.player) end
    -- Checking if there's a player, don't check for reason
    if not cmd[2] then return msgInvalidUsage(event.player) end
    -- Call the kick function
    local target = server:findPlayerByID(cmd[2]);
    kickPlayer(event.player, target, cmd[3]);
    end


    function kickPlayer(kicker, target, reason)
    local tName = target:getPlayerName()
    target:kick(reason)
    kicker:sendTextMessage("You kicked "..tName.." !")
    end[/lua]



    Hope this would work ;)

  • DE: Okay danke dir hat geklappt nur der Spieler ist raus aber er blockiert den Slots und steht da noch rum.
    Aber hat geklappt es wirkt wie ein Connection lost
    Aber wenn er abbaut abwohl er raus ist ist es beim restart oder neu join so



    EN: Okay, thank you worked only the player is out but he blocked the slots and stands there still around.
    But it worked acts like a lost connection
    But if he degrades abwohl he is out there is the restart or re-join so

  • So the slot on the server isn't released when the player is kicked ?


    Then you can use the ban function for 1 minute ?! See in Zcript the ban function. It's using a DB, and there's a lot of function involved so I won't copy paste them here ^^

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!