Jade Posted March 1, 2014 Share Posted March 1, 2014 S.lua function openhelpacs(player) if (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("TT"))) then triggerClientEvent(player, "openhelp", root) end end function resourceStart () bindKey (player,"F3", "down", openhelpacs) end addEventHandler ("onResourceStart",getResourceRootElement(getThisResource()),resourceStart) debugscript: s.lua:8:Bad argument @ 'bindKey' Link to comment
WhoAmI Posted March 1, 2014 Share Posted March 1, 2014 function resourceStart () for k,v in ipairs(getElementsByType("player")) do bindKey (v,"F3", "down", openhelpacs) end end addEventHandler("onResourceStart", resourceRoot, resourceStart) Link to comment
Moderators Citizen Posted March 1, 2014 Moderators Share Posted March 1, 2014 You should defintly check this: Introduction to Scripting function openhelpacs(player) if (isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("TT"))) then triggerClientEvent(player, "openhelp", root) end end -- When the resource starts, bind the key for everyone that are already on the server function resourceStart () for k, p in ipairs (getElementsByType("player")) do bindKey(p, "F3", "down", openhelpacs, p) end end addEventHandler ("onResourceStart", resourceRoot, resourceStart) -- When a new player join, bind the key for him function playerJoins() bindKey(source, "F3", "down", openhelpacs, source) end addEventHandler("onPlayerJoin", root, playerJoins) Link to comment
Moderators Citizen Posted March 1, 2014 Moderators Share Posted March 1, 2014 function resourceStart () for k,v in ipairs(getElementsByType("player")) do bindKey (v,"F3", "down", openhelpacs) end end addEventHandler("onResourceStart", resourceRoot, resourceStart) 1 - The binds wont work if players join after the resource as beed started. 2 - The script will still not work because you don't send v as argument. Link to comment
Jade Posted March 1, 2014 Author Share Posted March 1, 2014 Thanks WhoAmI and Citizen 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