setElementData (getRootElement(), "adminclickopen", false)
setElementData (getRootElement(), "adminclickmousebind", false)
function clickmenu (mouseButton, buttonState, clickedElement, worldPosX, worldPosY, worldPosZ, screenPosX, screenPosY)
if ( buttonState == "down" ) then
if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Police" ) ) then
if ( not getElementData ( source, "adminclickopen" ) ) then
if ( getElementData ( source, "adminclickmousebind") ) then
if ( mouseButton == "right" ) then
if ( clickedElement ) then
if ( getElementType (clickedElement) == "player" ) then
name = getPlayerName (clickedElement)
setElementData ( source, "adminclickselplayer", tostring(name) )
setElementData ( source, "adminclickopen", true)
triggerClientEvent (source,"playermenu", getRootElement() )
elseif ( getElementType (clickedElement) == "vehicle" ) then
thecar = clickedElement
setElementData ( source, "adminclickselplayer", thecar )
triggerClientEvent (source,"carmenu", getRootElement() )
end
end
elseif ( mouseButton == "left" ) then
--outputChatBox ( worldPosX .. "," .. worldPosY .. "," .. worldPosZ )
--[[ Random send cars & players flying, can be abused
col = createColCircle ( worldPosX, worldPosY, 15)
colelements = getElementsWithinColShape (col)
for theKey,theElement in ipairs(colelements) do
if ( getElementType (theElement) == "player" ) then
setElementVelocity ( theElement, 2, 0, 5)
elseif ( getElementType (theElement) == "vehicle" ) then
setElementVelocity ( theElement, 2, 0, 1.5)
end
end
--]]
end
end
end
end
end
end
addEventHandler( "onPlayerClick", getRootElement(), clickmenu )
function onstart()
players = getElementsByType ( "player" ) -- get a table of all the players in the server
for theKey,player in ipairs(players) do
if ( hasObjectPermissionTo ( player, "function.kickPlayer", true ) ) then
setElementData ( player, "adminclickopen", false)
setElementData ( player, "adminclickmousebind", false)
bindKey (player, "o", "down", showmouse, player )
end
end
end
addEventHandler ( "onResourceStart", getRootElement(), onstart )
function showmouse ( player )
showCursor ( player, not isCursorShowing ( player ) )
setElementData ( player, "adminclickmousebind", isCursorShowing ( player ) )
end
function bindmouse ()
if ( hasObjectPermissionTo ( source, "function.kickPlayer", true ) ) then
setElementData ( source, "adminclickopen", false )
setElementData ( source, "adminclickmousebind", false )
bindKey ( source, "o", "down", showmouse )
end
end
addEventHandler ("onPlayerLogin", getRootElement(), bindmouse )
function killplayer ()
victimemt = getElementData ( source, "adminclickselplayer" )
victim = getPlayerFromName (tostring(victimemt))
if ( isElement(victim) ) then
killPed (victim)
outputChatBox ("You just killed " .. victimemt, source, 125, 125, 125 )
outputChatBox ("You just admin killed!", victim, 125, 125, 125 )
else
outputChatBox ("This player is no longer connected.", source, 255, 0, 0 )
end
end
addEvent("killplayer", true)
addEventHandler ("killplayer", getRootElement(), killplayer)
function muteplayer ()
victimemt = getElementData ( source, "adminclickselplayer" )
victim = getPlayerFromName (tostring(victimemt))
if ( isElement(victim) ) then
if ( getElementData ( victim, "muted" ) == false ) then
setPlayerMuted ( victim, true )
setElementData (victim, "muted", true)
outputChatBox ("You just muted " .. victimemt, source, 125, 125, 125 )
outputChatBox ("You just got muted.", victim, 125, 125, 125 )
elseif ( getElementData ( victim, "muted" ) == true ) then
setPlayerMuted ( victim, false )
setElementData (victim, "muted", false)
outputChatBox ("You just unmuted " .. victimemt, source, 125, 125, 125 )
outputChatBox ("You just got unmuted.", victim, 125, 125, 125 )
end
else
outputChatBox ("This player is no longer connected.", source, 255, 0, 0 )
end
end
addEvent("mute", true)
addEventHandler ("mute", getRootElement(), muteplayer)
function freezeplayer ()
victimemt = getElementData ( source, "adminclickselplayer" )
victim = getPlayerFromName (tostring(victimemt))
if ( isElement(victim) ) then
if ( getElementData ( victim, "froozen" ) == false ) then
toggleAllControls ( victim, false, true, false )
setElementData (victim, "froozen", true)
outputChatBox ("You just freezed " .. victimemt, source, 125, 125, 125 )
outputChatBox ("You just got freezed.", victim, 125, 125, 125 )
elseif ( getElementData ( victim, "froozen" ) == true ) then
toggleAllControls ( victim,true,true,true )
setElementData (victim, "froozen", false)
outputChatBox ("You're now free to move " .. victimemt, source, 125, 125, 125 )
outputChatBox ("You just got un-froozen.", victim, 125, 125, 125 )
end
else
outputChatBox ("This player is no longer connected.", source, 255, 0, 0 )
end
end
addEvent("freeze", true)
addEventHandler ("freeze", getRootElement(), freezeplayer)
function banplayer (reason)
victimemt = getElementData ( source, "adminclickselplayer" )
victim = getPlayerFromName (tostring(victimemt))
if ( isElement(victim) ) then
banPlayer ( victim, true, true, true, getRootElement(), tostring(reason), 20)
outputChatBox ("You just banned " .. victimemt, source, 125, 125, 125 )
outputChatBox ( getPlayerName(source) .. " has just banned " .. victimemt .. " for: " .. tostring(reason), source, 255, 0, 0 )
else
outputChatBox ("This player is no longer connected.", source, 255, 0, 0 )
end
end
addEvent("ban", true)
addEventHandler ("ban", getRootElement(), banplayer)
function kickplayer (reason)
victimemt = getElementData ( source, "adminclickselplayer" )
victim = getPlayerFromName (tostring(victimemt))
if ( isElement(victim) ) then
kickPlayer ( victim, getRootElement(), reason)
outputChatBox ("You just kicked " .. victimemt, source, 125, 125, 125 )
outputChatBox ( getPlayerName(source) .. " has just kicked " .. victimemt .. " for: " .. tostring(reason), source, 255, 0, 0 )
else
outputChatBox ("This player is no longer connected.", source, 255, 0, 0 )
end
end
addEvent("kick", true)
addEventHandler ("kick", getRootElement(), kickplayer)
addEvent ( "destroyVehicle", true )
addEventHandler ( "destroyVehicle", root,
function ( theVehicle )
if ( theVehicle ) then
destroyElement ( theVehicle )
setElementData ( source, "adminclickselplayer", nil )
end
end
)
Try that.