kieran Posted July 4, 2017 Share Posted July 4, 2017 Trying to make admin jetpack to a bindkey, I tried it but getting error saying it expected a player at bindKey argument one... function jet( thePlayer, key, state ) if ( isGuestAccount(getPlayerAccount(player)) ) then return end if ( aclGetGroup ( "Admin" ) ) and ( isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) ) then if not doesPedHaveJetPack ( thePlayer ) then local status = givePedJetPack ( thePlayer ) if not status then outputConsole ( "Error.", thePlayer ) end else local status = removePedJetPack ( thePlayer ) if ( not status ) then outputConsole ( "Error.", thePlayer ) end end end end bindKey (thePlayer, "J", "down", jet) Issue on last line, can't see anything wrong... Link to comment
pa3ck Posted July 4, 2017 Share Posted July 4, 2017 Self-explanatory, looking for a player element @getPlayerAccount, but you passed through something else. What did you pass through? Variable "player", do you have that variable? No, you have "thePlayer", make sure you are always using the correct variable names. Link to comment
kieran Posted July 4, 2017 Author Share Posted July 4, 2017 (edited) 6 minutes ago, pa3ck said: Self-explanatory, looking for a player element @getPlayerAccount, but you passed through something else. What did you pass through? Variable "player", do you have that variable? No, you have "thePlayer", make sure you are always using the correct variable names. Oh, thanks, you're a legend mate Tried this.... Still doesn't work function jet( player, key, state ) if ( isGuestAccount(getPlayerAccount(player)) ) then return end if ( aclGetGroup ( "Admin" ) ) and ( isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) ) then if not doesPedHaveJetPack ( player ) then -- if the player doesn't have a jetpack local status = givePedJetPack ( player ) -- give him one if not status then outputConsole ( "Error.", player ) -- tell him if it failed end else local status = removePedJetPack ( player ) -- remove his jetpack if ( not status ) then outputConsole ( "Error.", player ) -- tell him if it failed end end end end bindKey (player, "j", "down", jet) Edited July 4, 2017 by kieran Link to comment
kieran Posted July 4, 2017 Author Share Posted July 4, 2017 (edited) Solved it, download is Here for anyone that wants it (This binds key to activate event, not a command). Thanks to Lorimaxxx's script, I have based the bind from there. Edited July 4, 2017 by kieran 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