kick player from panel

Share your gamemodes and snippets here
Post Reply
Ahmed Ly
Posts: 6
Joined: March 30th, 2020, 3:50 am

kick player from panel

Post by Ahmed Ly » April 2nd, 2020, 6:33 am

Code: Select all

local Passworld = "Passworld" -- you must change the passworld to your passworld
local list = false
 diag = createDialogList(20, "Players List", 1, "kick!", "Cancel")

 function addallplayers ()
 if list == false then 
 players = getPlayers()
   for k, v in ipairs(players) do
   addDialogRow(20,""..getPlayerName(v).."")
   list = true
   end 
else 
   clearDialogRows(20)
   for k, v in ipairs(players) do
   addDialogRow(20,""..getPlayerName(v).."")
end 
end
end 



addCommand("/systemkick", 
   function(playerid,params)
      if params[1] == Passworld then 
      showDialogList(playerid,20)
      addallplayers ()
      else 
         sendPlayerMsg(playerid,"Password is wrong", 0xFFF00000)
   end
end 
, nil)


function onclik(playerid, dialogId, buttonId, dialogRow)
   if(dialogId == 20 and buttonId == 1 and players[dialogRow + 1] ~= nil) then
    

      if players[dialogRow + 1] ~= playerid then 


      if isPlayerOnline(players[dialogRow + 1]) ~= false then 

     sendMsgToAll("the player "..getPlayerName(players[dialogRow + 1]).." kicked by "..getPlayerName(playerid).."",0xFFFF0000)

     disconnectPlayer(players[dialogRow + 1])


      else 

         sendPlayerMsg(playerid,"the player is not at server", 0xFFF00000)
      end
   else 
      sendPlayerMsg(playerid,"you cant kick youself", 0xFFF00000)
   end
	end
end
registerEvent("onclik", "onPlayerDialogResponse")


Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests