Axel Posted October 10, 2011 Share Posted October 10, 2011 Was it changed the call function? Becouse i am using it in the new MTA version and it does not work.. Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 Use exports instead. ex: exports["myResource"]:myFunction() Link to comment
Cadu12 Posted October 10, 2011 Share Posted October 10, 2011 Solidsnake14, You forget say that add meta for exports. Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 call function needed that too, so I didn't think it was necessary. Link to comment
Axel Posted October 10, 2011 Author Share Posted October 10, 2011 I'v tryed that too and still.. (i have the meta exports) Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 What error do you get? is the resource running? Link to comment
Axel Posted October 10, 2011 Author Share Posted October 10, 2011 The ressource is running, there is no errors in the script (/debugscript 3),the script works alone, but calling/exports does not work.. Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 What do you mean by "does not work"? Link to comment
Axel Posted October 10, 2011 Author Share Posted October 10, 2011 It is supposed to create a Label, the label does not appears.. Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 Are you sure the exported function is set to type="client" in the meta.xml? Link to comment
Axel Posted October 10, 2011 Author Share Posted October 10, 2011 Yes it is: function='opgt' type='client'/> Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 Can you show me the script where you are using it? Link to comment
Axel Posted October 10, 2011 Author Share Posted October 10, 2011 I'v emailed you. ( i don't want that this ressource to be public ) Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 I haven't received any email. Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 I meant, the script where you call that function from, not the script with the exported function. Link to comment
Axel Posted October 10, 2011 Author Share Posted October 10, 2011 exports["gT"]:opGT("Go to the red house on the map in "..getZoneName(x,y,position)) Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 Is that function in a client side script? P.S: Did you add some debug outputs to the opGT function? Link to comment
Axel Posted October 10, 2011 Author Share Posted October 10, 2011 Yes it's clientside and yes.. Link to comment
Castillo Posted October 10, 2011 Share Posted October 10, 2011 Why didn't you said that the script is not working at all? you named 3 labels with numbers, that's not possible, and that causes errors. P.S. dxDrawText also has errors. Edit: In general, your script is a total mess, full of bugs, is not the exported function the problem. Edit2: I've fixed all the errors shown in the debugscript, but I don't know what is this, so you'll have to fix the rest. x,y = guiGetScreenSize() l1 = guiCreateLabel(x,0,0,0,"",false) l2 = guiCreateLabel(x,0,0,0,"",false) l3 = guiCreateLabel(x,0,0,0,"",false) guiSetVisible(l1,false) guiSetVisible(l2,false) guiSetVisible(l3,false) gc1 = guiCreateLabel(x,0,0,0,"-65536",false) gc2 = guiCreateLabel(x,0,0,0,"-65536",false) gc3 = guiCreateLabel(x,0,0,0,"-65536",false) guiSetVisible(gc1,false) guiSetVisible(gc2,false) guiSetVisible(gc3,false) function deseneaza() x,y = guiGetScreenSize() t1 = guiGetText(l1) t2 = guiGetText(l2) t3 = guiGetText(l3) a = 0.02 dxDrawText(t1,a*x,0.685*y,1,1,tocolor(255,255,255,255),1.2,"arial") dxDrawText(t2,a*x,0.655*y,1,1,tocolor(255,255,255,255),1.2,"arial") dxDrawText(t3,a*x,0.625*y,1,1,tocolor(255,255,255,255),1.2,"arial") end addEventHandler("onClientRender",root,deseneaza) setTimer( function() removeEventHandler("onClientRender", getRootElement(),deseneaza) end, 1300,0) function opGT(text,c1,c2,c3) local time = getRealTime() local hours = time.hour local minutes = time.minute local secs = time.second if hours < 10 then hours = "0"..hours end if minutes < 10 then minutes = "0"..minutes end if secs < 10 then secs = "0"..secs end theTime = hours..":"..minutes..":"..secs t1 = guiGetText(l1) t2 = guiGetText(l2) t3 = guiGetText(l3) guiSetText(l2,t1) guiSetText(l3,t2) tc1 = guiGetText(gc1) tc2 = guiGetText(gc2) tc3 = guiGetText(gc3) guiSetText(gc2,tc1) guiSetText(gc3,tc2) guiSetText(gc1,"["..theTime.."] "..text) c1,c2,c3 = tonumber(c1),tonumber(c2),tonumber(c3) color = tocolor(c1,c2,c3) return "true: added text '"..text.."'" end setTimer(opGT,500,299,"Hello world",255,0,70) addEvent("callOpGT",true) addEventHandler("callOpGT",root, function(text,c1,c2,c3) opSGT(text,c1,c2,c3) end) function opSGT(text,c1,c2,c3) t1 = guiGetText(l1) t2 = guiGetText(l2) t3 = guiGetText(l3) guiSetText(l2,t1) guiSetText(l3,t2) tc1 = guiGetText(gc1) tc2 = guiGetText(gc2) tc3 = guiGetText(gc3) guiSetText(gc2,tc1) guiSetText(gc3,tc2) guiSetText(l1,text) c1,c2,c3 = tonumber(c1),tonumber(c2),tonumber(c3) color = tocolor(c1,c2,c3) end Link to comment
qaisjp Posted October 11, 2011 Share Posted October 11, 2011 by the looks it is something like an alternate message box Link to comment
50p Posted October 11, 2011 Share Posted October 11, 2011 Lua is case-seisitive, so are function names. If you export "opgt" but the actual function name is "opGT" then that function will never be called. Link to comment
Axel Posted October 11, 2011 Author Share Posted October 11, 2011 I'm pretty sure it is all right now, but still it does not output when i call it. It does when i start the ressource ( setTimer(opGT,500,299,"Hello world",255,0,70) ) but not when i call it.. 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