Haze Posted June 20, 2011 Share Posted June 20, 2011 Well I got this Script Frome Community And I Want to Add it Only For Admins that mean the Only Group should Use this script are the Admins Can some One Show me How to Make It thx https://community.multitheftauto.com/ind ... ails&id=71 root = getRootElement () players = getElementsByType ( "player" ) OS_Trigger = false OS_Active = false function ResourceStartOS ( name, root ) for k,v in ipairs(players) do bindKey ( v, "o", "down", placeOSBeacon ) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), ResourceStartOS ) function OSPlayerJoin () bindKey ( source, "o", "down", placeOSBeacon ) end addEventHandler ( "onPlayerJoin", root, OSPlayerJoin ) function placeOSBeacon ( player, key, state ) if ( OS_Trigger == false ) and ( OS_Active == false ) then OS_Trigger = true defineLaunchType = key showCursor ( player, true ) outputChatBox ( "Click to activate orbital strike. Press activation key again to cancel.", player, 105, 252, 55 ) elseif ( OS_Trigger == true ) then --Cancel activation OS_Trigger = false defineLaunchType = nil showCursor ( player, false ) outputChatBox ( "Orbital strike activation cancelled.", player, 105, 252, 55 ) end end function playerClick ( button, state, clickedElement, x, y, z ) if ( OS_Active ~= false ) then outputChatBox ( "Sorry, orbital strike already activated", source, 105, 252, 55 ) end if ( button ~= "left" ) or ( state ~= "down" ) or ( defineLaunchType ~= "o" ) then return end showCursor ( source, false ) OS_Trigger = false OS_Active = true defineLaunchType = nil --reset stuff triggerClientEvent ( "ClientFireOS", getRootElement(), x, y, z ) end addEventHandler ( "onPlayerClick", root, playerClick ) function OrbitalStrikeFinished () OS_Active = false end addEvent("serverOrbitalStrikeFinished", true) addEventHandler("serverOrbitalStrikeFinished", root, OrbitalStrikeFinished) if you need the Clinet i can post it Link to comment
JR10 Posted June 20, 2011 Share Posted June 20, 2011 Here: function ResourceStartOS ( name, root ) for k,v in ipairs(players) do bindKey ( v, "o", "down", placeOSBeacon ) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), ResourceStartOS ) function OSPlayerJoin () bindKey ( source, "o", "down", placeOSBeacon ) end addEventHandler ( "onPlayerJoin", root, OSPlayerJoin ) I don't know what is this resource but the bindKey is what makes you press on "o" and it works so check if the player is admin then use bindKey. Link to comment
Castillo Posted June 20, 2011 Share Posted June 20, 2011 Try this: root = getRootElement () players = getElementsByType ( "player" ) OS_Trigger = false OS_Active = false function ResourceStartOS ( name, root ) for k,v in ipairs(players) do bindKey ( v, "o", "down", placeOSBeacon ) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), ResourceStartOS ) function OSPlayerJoin () bindKey ( source, "o", "down", placeOSBeacon ) end addEventHandler ( "onPlayerJoin", root, OSPlayerJoin ) function placeOSBeacon ( player, key, state ) local playerAccount = getPlayerAccount(player) if not playerAccount then return end local accountName = getAccountName(playerAccount) if not isObjectInACLGroup("user."..accountName,aclGetGroup("Admin")) then return end if ( OS_Trigger == false ) and ( OS_Active == false ) then OS_Trigger = true defineLaunchType = key showCursor ( player, true ) outputChatBox ( "Click to activate orbital strike. Press activation key again to cancel.", player, 105, 252, 55 ) elseif ( OS_Trigger == true ) then --Cancel activation OS_Trigger = false defineLaunchType = nil showCursor ( player, false ) outputChatBox ( "Orbital strike activation cancelled.", player, 105, 252, 55 ) end end function playerClick ( button, state, clickedElement, x, y, z ) if ( OS_Active ~= false ) then outputChatBox ( "Sorry, orbital strike already activated", source, 105, 252, 55 ) end if ( button ~= "left" ) or ( state ~= "down" ) or ( defineLaunchType ~= "o" ) then return end showCursor ( source, false ) OS_Trigger = false OS_Active = true defineLaunchType = nil --reset stuff triggerClientEvent ( "ClientFireOS", getRootElement(), x, y, z ) end addEventHandler ( "onPlayerClick", root, playerClick ) function OrbitalStrikeFinished () OS_Active = false end addEvent("serverOrbitalStrikeFinished", true) addEventHandler("serverOrbitalStrikeFinished", root, OrbitalStrikeFinished) Link to comment
Haze Posted June 20, 2011 Author Share Posted June 20, 2011 Thank you so Much so You Think I should Use this Function for the Othr scripts ??? by the way This one work Thank you so much you are the Best 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