Adde Posted October 9, 2013 Share Posted October 9, 2013 Hello, I wounder if anyone know what the message in debug means/want to tell me. I don´t understand what I am doing wrong. I am using a topchat script and want to trigger that from another script. I am supposed to trigger this in another script: outputTopChat("Respawning ALL empty vehicles In 25 Seconds", 255, 255, 255) How I added it in another script: exports["topchat"]:outputTopChat("Respawning ALL empty vehicles In 25 Seconds", 255, 255, 255) What it tells me in debug: ERROR: call:failed to call"topchat:outputTopChat"[string"?"] Link to comment
Discord Moderators Zango Posted October 9, 2013 Discord Moderators Share Posted October 9, 2013 In case you haven't, you might want to read about "call" on the wiki. Your syntax is correct, but you need to make sure that "outputTopChat" is exported in the resource meta.xml The error basically means that it can't find the exported function. Link to comment
tosfera Posted October 10, 2013 Share Posted October 10, 2013 To make this easier, you can add this to the top; local topchat = exports.topchat; After that, you can just call a function out of there like this: topchat:outputTopChat("respawning all empty vehicles in 25 seconds", 255, 255, 255); This gives you the advantage to rename your project / resource and you just have to replace line 1, instead of line 1, 5, 10, 31, etc. But make sure that your resource name doesn't contain any slashes, stripes or what ever. If it does, you've to change the first line to; local topchat = exports["Top-chat"]; Link to comment
Adde Posted October 10, 2013 Author Share Posted October 10, 2013 Oh, I read on wiki but I missed that I had to export the function from meta. So I should add this right?: Link to comment
myonlake Posted October 10, 2013 Share Posted October 10, 2013 Oh, I read on wiki but I missed that I had to export the function from meta. So I should add this right?: If you're creating the function client-side, then yes, you should use that. If you're making it server-side, then you should switch to "server" instead, or in case both, then "shared". Link to comment
Adde Posted October 10, 2013 Author Share Posted October 10, 2013 Oh, I read on wiki but I missed that I had to export the function from meta. So I should add this right?: If you're creating the function client-side, then yes, you should use that. If you're making it server-side, then you should switch to "server" instead, or in case both, then "shared". Okay yes ofc i know that i should switch depended on client/server. It still don´t work... Link to comment
Discord Moderators Zango Posted October 10, 2013 Discord Moderators Share Posted October 10, 2013 Any errors in the debugging console? Please post the contents of your script and meta.xml. Link to comment
Adde Posted October 18, 2013 Author Share Posted October 18, 2013 Meta: type="script" description="Topchat" version="1.0" /> Server: function respawn() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "HeadAdmin" ) ) then exports["topchat"]:outputTopChat("Respawning ALL empty vehicles In 25 Seconds", 255, 255, 255) setTimer(function () local vehicles = getElementsByType ( "vehicle" ) for k, vehicle in ipairs ( vehicles ) do if checkEmpty( vehicle ) then local seats = getVehicleMaxPassengers(vehicle) resetVehicleIdleTime ( vehicle ) respawnVehicle ( vehicle ) end end end, 25000, 1) end end addEvent( "respawn", true ) addEventHandler( "respawn", getRootElement(), respawn ) Link to comment
Moderators Citizen Posted October 18, 2013 Moderators Share Posted October 18, 2013 No just remove that line from your meta.xml: <export function="outputTopChat" type="client"/> This line must only be in the meta of the resource that provides that function. The second thing you must do is to start the resource that contains that fonction in order to be called. Link to comment
Adde Posted October 18, 2013 Author Share Posted October 18, 2013 No just remove that line from your meta.xml: <export function="outputTopChat" type="client"/> This line must only be in the meta of the resource that provides that function. The second thing you must do is to start the resource that contains that fonction in order to be called. I am using meta in topchat resource and server.lua in another resource, both are running. 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