Backsage Posted October 13, 2014 Share Posted October 13, 2014 (edited) Hi, there. I need some help. I'm trying to call a function that I exported in another resource (yes, I put it in the meta.xml), but it's not working. I'm always getting a fail. And for some reason, the output isn't appearing in scripts.log, even though I have it set to 3 in mtaserver.config. ERROR: attempt to call a nil value ERROR: StaffPunch\client.lua:2: call: failed to call 'new-tournament-spawn:teamlist' This code for a resource, let's say it's Resource 1. EDIT: Whoops, nothing to see here. Now what I'm trying to do is call the function 'teamlist' so that it can grab the list of teams and so that the function 'StaffPunch' can execute accordingly. The following code is for Resource 2. EDIT: Whoops, nothing to see here. I don't know what I'm doing wrong. EDIT: I'd also like to add that function teamlist() local teamtype1 = getTeamFromName("Unemployed") local teamtype2 = getTeamFromName("Unoccupied") local teamtype3 = getTeamFromName("Civilian Workers") local teamtype4 = getTeamFromName("Police Service") local teamtype5 = getTeamFromName("Criminals") local teamtype6 = getTeamFromName("Gangsters") local teamtype7 = getTeamFromName("Purple Team") local teamtype8 = getTeamFromName("Pink Team") local teamtype9 = getTeamFromName("Orange Team") local teamtype10 = getTeamFromName("Blue Team") local teamtype11 = getTeamFromName("White Team") local teamtype12 = getTeamFromName("Yellow Team") local teamtype13 = getTeamFromName("Cyan Team") local teamtype14 = getTeamFromName("Gray Team") local teamtype15 = getTeamFromName("Staff Team") local teamtype16 = getTeamFromName("Emergency Services") end addEvent("onTeamList", true) addEventHandler("onTeamList", resourceRoot, teamlist) caused part of my script to not work (Not being able to enter a colshape even when in a certain team). Edited October 14, 2014 by Guest Link to comment
Anubhav Posted October 13, 2014 Share Posted October 13, 2014 function teamlist() teamTable = { "Unemployed", "Unoccupied", "Civilian Workers", "Police Service", "Criminals", "Gangsters", "Purple Team", "Pink Team", "Orange Team" "Blue Team", "White Team", "Yellow Team", "Cyan Team", "Gray Team", "Staff Team", "Emergency Services" } returnString = "" for i, v in ipairs(teamlist) do if i == 1 then returnString = getTeamFromName(v) else returnString = returnString..","..getTeamFromName(v) end end return returnString end addEvent("onTeamList", true) addEventHandler("onTeamList", root, teamlist) Link to comment
Backsage Posted October 14, 2014 Author Share Posted October 14, 2014 Nvm, got it fixed. Didn't even need to export anything. 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