Jump to content

[Question] bindkey to jetpack


kieran

Recommended Posts

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

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
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 :P 

 

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 by kieran
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...