Jump to content

[ERROR]Server Side


Sawos

Recommended Posts

Hello MTA Team and Everyone else, 

I'm having an issue with the server side like i've been trying to lock this Jetpack to a specific Team and i'm having this Type of Error : 

" error: attemp to index global 'allowedTeams' (a nil value) "  

Quote

--ALL RIGHTS RESERVED BY SAW

 allowedTeams = { ["Freedom Fighters"] = true,["Admin"] = true,["Global Event Organization"] = true, ["Law Prisoners"] = true}
addEventHandler("onPlayerJoin",root,
function ()
   bindKey(source,"j","down",jetpack)    
end)

--Wiki function (givePedJetPack!
function jetpack ( thePlayer, commandName )
--Only lets admins use it, remove the following 2 lines to let ALL players use jetpack
           if allowedTeams[getTeamName(getPlayerTeam(thePlayer))] then 
    if (exports.SACGpolice:getWantedLevel(thePlayer) > 0) then return end
   --If he has no jetpack...
   if not doesPedHaveJetPack ( thePlayer ) then  
    --...then give him one!
      local status = givePedJetPack ( thePlayer )  
      --If error occurred tell him.      
      if not status then
         outputConsole ( "Failed to give jetpack.", thePlayer )  
      end
   else
   --Remove it if he has it!
      local status = removePedJetPack ( thePlayer )              
      if ( not status ) then
      --If fails output eroor message.
         outputConsole ( "Failed to remove jetpack.", thePlayer )
      end
   end
end
end
addCommandHandler ( "jet", jetpack )

Thank you.

Edited by Saw^^
Link to comment
  • Moderators

I can't see the error directly. It looks fine. You might be overwriting the value somewhere else. Is this the only place where you use that table?

Put it in lua tags next time. This is just pain to read.

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...