Sawos Posted January 4, 2018 Posted January 4, 2018 (edited) 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 January 4, 2018 by Saw^^
Moderators IIYAMA Posted January 4, 2018 Moderators Posted January 4, 2018 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.
Sawos Posted January 4, 2018 Author Posted January 4, 2018 No, it's not the only one. I have fewscripts having the same table function
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