[SCRIPT] Kick, Ban

The source is the id if your scripting in Lua. That a way if getting player id’s

I’ve made a command in-game to get who’s online. It return the name and id of the player.

This will help you.

--client.lua

--Online Players
    RegisterNetEvent("onlinePlayers")
    AddEventHandler('onlinePlayers', function()
        for i = 0, 31 do
            local nome = GetPlayerName(i)
            local id = GetPlayerServerId(i)
            if (nome == "**Invalid**") then
                CancelEvent()
            else
                ShowNotification('~r~ID: ~g~'.. id .. ' ~w~- ~r~Nome: ~g~' .. nome)
            end
        end
    end)
--server.lua

--Lista Players
        elseif(command[1] == "/players") then
          TriggerClientEvent("onlinePlayers", source)

when i type it in the chat it just puts it as a message to everyone

@cody196 said in [SCRIPT] Kick, Ban...:

when i type it in the chat it just puts it as a message to everyone

Sorry! I forgot something! Put this function on client.lua

function ShowNotification(text)
    SetNotificationTextEntry("STRING")
    AddTextComponentString(text)
    DrawNotification(false, false)
end

@cody196 said in [SCRIPT] Kick, Ban...:

when i type it in the chat it just puts it as a message to everyone

And you need to make the resource “chat” recognize commands with “/”

@PsymoN when i did that in the basic scripting guide, when I press T it does nothing but freeze my player and bugs out.

@cody196 said in [SCRIPT] Kick, Ban...:

@PsymoN when i did that in the basic scripting guide, when I press T it does nothing but freeze my player and bugs out.

It works here. I’ve followed the Basic Scripting Guide too. Just make sure you’ve replaced the correct line.

Should it look like this? cause now the commsand still dont work and chat box is different

alt text

Also getting Error in ScriptEnvironment: Current block is closed before end of file

@cody196 said in [SCRIPT] Kick, Ban...:

Should it look like this? cause now the commsand still dont work and chat box is different

You kinda broke the chat.

@kanersps could you help me out with the whole command thing. or just send me your chat_client.lua.

Links down?

@LapizTJ yea it is

give it another rcon client? I dont want to restart my Server all time -.-

Is there any reason why the downloads don’t work?

@Pascal_Vegas you dont have to except when you make a new command and it really does help to restart the server at least once a day

@Luke192 the server and the client downloads do work

@lordsp1ce Yes the links work but the website says the files are unavailable. This is what I see. alt text

Here is a reupload for everyone.

including the OP’s resource, but a different rcon client.

http://www.mediafire.com/download/98bihucg2t6nbbp/■■■■■■■.rar

Virustotal of the .exe: https://www.virustotal.com/en/file/bd40c1f5fa19e477b07d7cd82241307959f77e51b76939c1f1483a26c2d91560/analysis/1471734545/

1 Like

@Eric Appreciate it man :slight_smile: