Jump to content

[HELP]Trigging Problem to Kick Player.


Om.

Recommended Posts

Full Script:

  
-- Client Side Script. 
        addEventHandler ( 'onClientGUIClick', root, 
    function () 
        if (source == kickSubmitBtn) then 
        local reason = guiGetText(Kickreason) 
                player = guiGridListGetItemText ( playersGrid, guiGridListGetSelectedItem ( playersGrid ), 1 ) 
        triggerServerEvent("ERP.staff:kickPlayer", resourceRoot, player, reason) 
        end 
end 
) 
  
-- Server Sided Script 
function kickPlrFromAdminPanel(thePlayer, reason) 
plr = getPlayerFromName(thePlayer) 
outputChatBox("User: "..plr.." has been kicked from the server. ("..reason..")", root) 
kickPlayer(plr, reason) 
end 
addEvent("ERP.staff:kickPlayer", true) 
addEventHandler("ERP.staff:kickPlayer", resourceRoot, kickPlrFromAdminPanel) 
  
  

There are no debug errors, i have no idea why. When i click "Kick player Button", it dosnt trigger, but if i output the value of player and reason vars, they work.

Link to comment

You say that there are no errors, do you mean just errors? Because if there was an issue with permissions it would throw a warning saying that access was denied. It would also throw a warning if 'plr' variable wasn't a player. It has to output something, use debugscript 3. Also, the outputChatBox should throw an error, because 'plr' is either a player element (if the player was found by getPlayerFromName) or false. In both cases it would be an error if you don't use tostring.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...