abu5lf Posted April 3, 2012 Share Posted April 3, 2012 (edited) I want to open the panel to set the police but did not work, I do not know why ? function clickmenu (mouseButton, buttonState, clickedElement, worldPosX, worldPosY, worldPosZ, screenPosX, screenPosY) -- outputChatBox ("1") local accountname = "" if (isGuestAccount(getPlayerAccount(v)) == false) then accountname = getAccountName (getPlayerAccount(v)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Police" ) ) then outputChatBox ("00") if ( buttonState == "down" ) then -- outputChatBox ("2") if ( hasObjectPermissionTo ( source, "function.kickPlayer", true ) ) then -- outputChatBox ("3") if ( getElementData ( getRootElement(), "adminclickopen" ) == false ) then -- outputChatBox ("4") if ( getElementData (getRootElement(), "adminclickmousebind") == true ) then -- outputChatBox ("5") if ( mouseButton == "right" ) then if ( clickedElement ) then if ( getElementType (clickedElement) == "player" ) then name = getPlayerName (clickedElement) setElementData (getRootElement(), "adminclickselplayer", tostring(name) ) setElementData (getRootElement(), "adminclickopen", true) triggerClientEvent (source,"playermenu", getRootElement() ) elseif ( getElementType (clickedElement) == "vehicle" ) then thecar = clickedElement setElementData ( source, "adminclickselplayer", thecar ) triggerClientEvent (source,"carmenu", getRootElement() ) --setElementVelocity ( clickedElement, 0, 0, 1.5) 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 Edited December 25, 2012 by Guest Link to comment
Castillo Posted April 3, 2012 Share Posted April 3, 2012 You're checking if the player is on "Police" ACL group, are you sure you don't want to check if player is on "Police" team? Link to comment
abu5lf Posted April 3, 2012 Author Share Posted April 3, 2012 You're checking if the player is on "Police" ACL group, are you sure you don't want to check if player is on "Police" team? I want her all to the same group just does not matter the team Link to comment
Castillo Posted April 3, 2012 Share Posted April 3, 2012 Try this: function clickmenu ( mouseButton, buttonState, clickedElement, worldPosX, worldPosY, worldPosZ, screenPosX, screenPosY ) if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Police" ) ) then if ( buttonState == "down" ) then if ( getElementData ( getRootElement(), "adminclickopen" ) == false ) then if ( getElementData (getRootElement(), "adminclickmousebind") == true ) then if ( mouseButton == "right" ) then if ( clickedElement ) then if ( getElementType (clickedElement) == "player" ) then name = getPlayerName (clickedElement) setElementData (getRootElement(), "adminclickselplayer", tostring(name) ) setElementData (getRootElement(), "adminclickopen", true) triggerClientEvent (source,"playermenu", getRootElement() ) elseif ( getElementType (clickedElement) == "vehicle" ) then thecar = clickedElement setElementData ( source, "adminclickselplayer", thecar ) triggerClientEvent (source,"carmenu", getRootElement() ) --setElementVelocity ( clickedElement, 0, 0, 1.5) 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 Link to comment
abu5lf Posted April 4, 2012 Author Share Posted April 4, 2012 Try this: function clickmenu ( mouseButton, buttonState, clickedElement, worldPosX, worldPosY, worldPosZ, screenPosX, screenPosY ) if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Police" ) ) then if ( buttonState == "down" ) then if ( getElementData ( getRootElement(), "adminclickopen" ) == false ) then if ( getElementData (getRootElement(), "adminclickmousebind") == true ) then if ( mouseButton == "right" ) then if ( clickedElement ) then if ( getElementType (clickedElement) == "player" ) then name = getPlayerName (clickedElement) setElementData (getRootElement(), "adminclickselplayer", tostring(name) ) setElementData (getRootElement(), "adminclickopen", true) triggerClientEvent (source,"playermenu", getRootElement() ) elseif ( getElementType (clickedElement) == "vehicle" ) then thecar = clickedElement setElementData ( source, "adminclickselplayer", thecar ) triggerClientEvent (source,"carmenu", getRootElement() ) --setElementVelocity ( clickedElement, 0, 0, 1.5) 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 not work Link to comment
abu5lf Posted April 4, 2012 Author Share Posted April 4, 2012 Post your whole script. -- adminclickcars_cl: function playermenu ( ) if ( not isElement ( mainwindow ) ) then victimemt = getElementData ( getRootElement(), "adminclickselplayer" ) mainwindow = guiCreateWindow ( 750, 250, 240, 180, "Car menu", false ) -- fixveh = guiCreateButton ( 0.05, 0.15, 0.4, 0.15, "Fix vehicle", true, mainwindow ) blowveh = guiCreateButton ( 0.55, 0.15, 0.4, 0.15, "Blow up vehicle", true, mainwindow ) -- delveh = guiCreateButton ( 0.05, 0.35, 0.4, 0.15, "Delete vehicle", true, mainwindow ) colveh = guiCreateButton ( 0.55, 0.35, 0.4, 0.15, "Colour vehicle", true, mainwindow ) -- upgveh = guiCreateButton ( 0.05, 0.55, 0.4, 0.15, "Upgrade vehicle", true, mainwindow ) selowner = guiCreateButton ( 0.55, 0.55, 0.4, 0.15, "Select driver", true, mainwindow ) -- closebutton = guiCreateButton ( 0.30, 0.8, 0.4, 0.15, "Close", true, mainwindow ) addEventHandler( "onClientGUIClick", delveh, vc, false ) addEventHandler( "onClientGUIClick", closebutton, disable, false ) addEventHandler( "onClientGUIClick", selowner, selectowner, false ) end end addEvent ("carmenu", true) addEventHandler ("carmenu", getRootElement(), playermenu) function disable () guiSetVisible ( mainwindow, false ) setElementData ( localPlayer, "adminclickselplayer", nil ) setElementData ( getRootElement(), "adminclickopen", false ) end function selectowner () thecar = getElementData ( localPlayer, "adminclickselplayer" ) occupant = getVehicleOccupant ( thecar ) guiSetVisible ( mainwindow, false ) if ( occupant ) then setElementData ( localPlayer, "adminclickselplayer", occupant ) else outputChatBox ( "This vehicle does not have a driver", 255, 0, 0 ) end end function vc ( ) local thecar = getElementData ( localPlayer, "adminclickselplayer" ) if ( thecar and isElement ( thecar ) ) then triggerServerEvent ( "destroyVehicle", localPlayer, thecar ) end end -- adminclick.lua: setElementData (getRootElement(), "adminclickopen", false) setElementData (getRootElement(), "adminclickmousebind", false) function clickmenu (mouseButton, buttonState, clickedElement, worldPosX, worldPosY, worldPosZ, screenPosX, screenPosY) if ( buttonState == "down" ) then if ( hasObjectPermissionTo ( source, "function.kickPlayer", true ) ) 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 ) That works, even when the script is a real mess. Link to comment
Castillo Posted April 4, 2012 Share Posted April 4, 2012 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. Link to comment
abu5lf Posted April 5, 2012 Author Share Posted April 5, 2012 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. not work , Can you make it to a team Link to comment
Castillo Posted April 5, 2012 Share Posted April 5, 2012 setElementData (getRootElement(), "adminclickopen", false) setElementData (getRootElement(), "adminclickmousebind", false) function clickmenu (mouseButton, buttonState, clickedElement, worldPosX, worldPosY, worldPosZ, screenPosX, screenPosY) if ( buttonState == "down" ) then if ( getPlayerTeam ( source ) and getTeamName ( getPlayerTeam ( source ) ) == "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 ) Link to comment
abu5lf Posted April 5, 2012 Author Share Posted April 5, 2012 setElementData (getRootElement(), "adminclickopen", false) setElementData (getRootElement(), "adminclickmousebind", false) function clickmenu (mouseButton, buttonState, clickedElement, worldPosX, worldPosY, worldPosZ, screenPosX, screenPosY) if ( buttonState == "down" ) then if ( getPlayerTeam ( source ) and getTeamName ( getPlayerTeam ( source ) ) == "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 ) not work =( Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now