Jump to content

dam034

Members
  • Posts

    58
  • Joined

  • Last visited

Everything posted by dam034

  1. Dear users, I have a ubuntu server, and I want to create my own LUA compiler. It's not that I don't trust yours, but I want to create my own. What do I have to do? Thanks
  2. Yes, I know this is map editor, but I didn't know in which section post this thread. I posted in this section because I'm creating a resource to do it, with createObject. If kindly someone can suggest me which model to put where, because there are many models, and the right railroad gradient (or how to measure it). Thanks
  3. Dear staff, when I post on this forum, I usually need to attach images. Now I'm using an external webserver where host them, but I want to store them in this forum engine. Is it possible? And how? Thanks
  4. Dear users, in this position: I want to create a gate/fence like this: But I can't find the right model to insert there, and after I need tips regarding the gradient and precision. Help!
  5. Since I don't understand good the english, can you tell me if a variable declared clientside I can (and how) read serverside? Thanks
  6. Today I have another question: if I declare a variable in a lua file executed clientside, can I read it in another lua executed serverside in the same resource? Thanks
  7. Yeah, it's true. I wonder where I left my head. Thanks
  8. Thanks, now it works. And I let to execute a.lua clientside, not shared. Now I have a.lua: basesf = createColPolygon(-1543, 480, -1559, 451, -1597, 399, -1726, 261, -1446, 261, -1446, 293, -1342, 293, -1329, 306, -1329, 435, -1227, 435, -1227, 519, -1515, 519, -1515, 480) lanciarazzi = { } basirazzi = { } sbarra = 0 removeWorldModel(968, 15, -1526, 481, 7) -- sbarra sbarra = createObject(968, -1526.4400439453, 481.39999389648, 6.905, 0, 270, 0) lanciarazzi = { createObject(3884, -1496.8, 590.4, 42.05, 0, 0, 225), -- ponte ferroviario nuovo createObject(3884, -1225, 456, 7.05, 0, 0, 90), -- est nuovo } basirazzi = { createObject(3885, -1496.8, 590.4, 42, 0, 0, 0), -- ponte ferroviario nuova createObject(3885, -1225, 456, 7, 0, 0, 0), -- est nuova } function nonrompere() setObjectBreakable(sbarra, false) for ch, v in ipairs(lanciarazzi) do setObjectBreakable(v, false) end for ch, v in ipairs(basirazzi) do setObjectBreakable(v, false) end end b.lua: function proteggi() nonrompere() addEventHandler("onClientColShapeHit", basesf, inizia) moveObject(sbarra, 4000, -1526.4400439453, 481.39999389648, 6.905, 0, -90, 0, 'InOutQuad') outputChatBox("Attenzione: protezione sulla base di San Fierro abilitata.") end function nonproteggere() removeEventHandler("onClientColShapeHit", basesf, inizia) moveObject(sbarra, -1526.4400439453, 481.39999389648, 6.905, 0, 90, 0, 'InOutQuad') outputChatBox("Attenzione: protezione sulla base di San Fierro disabilitata.") end addEventHandler("onClientResourceStart", resourceRoot, proteggi) addEventHandler("onClientResourceStop", resourceRoot, nonproteggere) addCommandHandler("sibasesf", proteggi) addCommandHandler("nobasesf", nonproteggere) and meta.xml: <meta> <script src="a.lua" type="client" /> <script src="b.lua" type="client" /> </meta> And I removed the OOP because it doesn't work, I don't know why. But I have another problem: when I execute nonproteggere() via the nobasesf command, the function moveObject() isn't executed, it is a simple rotation, why? Thanks
  9. Where do I have to call the function crealanciatori()? Thanks
  10. Dear users, this is the file a.lua: lanciarazzi = { } basirazzi = { } sbarra = 0 function crealanciatori() sbarra = createObject(968, -1526.4400439453, 481.39999389648, 6.905, 0, 270, 0) sbarra.breakable = false lanciarazzi = { createObject(3884, -1496.8, 590.4, 42.05, 0, 0, 225), -- ponte ferroviario nuovo createObject(3884, -1225, 456, 7.05, 0, 0, 90), -- est nuovo } basirazzi = { createObject(3885, -1496.8, 590.4, 42, 0, 0, 0), -- ponte ferroviario nuova createObject(3885, -1225, 456, 7, 0, 0, 0), -- est nuova } end function nonrompere() for ch, v in ipairs(lanciarazzi) do setObjectBreakable(v, false) end for ch, v in ipairs(basirazzi) do setObjectBreakable(v, false) end end This is b.lua: function proteggi(nome, param) nonrompere() addEventHandler("onClientColShapeHit", basesf, inizia) sbarra.move(4000, -1526.4400439453, 481.39999389648, 6.905, 0, -90, 0, 'InOutQuad') outputChatBox("Attenzione: protezione sulla base di San Fierro abilitata.") end function nonproteggere(nome, param) removeEventHandler("onClientColShapeHit", basesf, inizia) sbarra.move(4000, -1526.4400439453, 481.39999389648, 6.905, 0, 90, 0, 'InOutQuad') outputChatBox("Attenzione: protezione sulla base di San Fierro disabilitata.") end addEventHandler("onClientResourceStart", resourceRoot, proteggi) addEventHandler("onClientResourceStop", resourceRoot, nonproteggere) addCommandHandler("sibasesf", proteggi) addCommandHandler("nobasesf", nonproteggere) And this is meta.xml: <meta> <oop>true</oop> <script src="a.lua" type="shared" /> <script src="b.lua" type="client" /> </meta> In function proteggi() and nonproteggere() I can't read the variable sbarra, furthermore the function nonrompere() doesn't work. Where did I go wrong? Thanks
  11. Dear users, I want to let the users to sign-up and sign-in the game when connected to my server. For some reasons (PHP scripts and third-parties API) I can't use simple GUI elements, but a webpage hosted on a LAMP server. Now, I know I need permissions by the player to access that webpage, via requestBrowserDomains function, and I'll say to the players they need to allow those domains to play. I want to load a simple browser when the player joins the game, and to do these steps: load a simple page hosted in the resource which informs the user he needs to allow some domains to play; ask the permission for those domains; load the page hosted externally to sign-in or sign-up; let the user to login to my server in that page; read the result from that script (in JSON) and parse it in a function to login the user in the game; close the browser and spawn the player assigning some properties (e.g. money amount, particular skin, etc...). I read some function documentations and I wrote this clientside code: window = guiCreateWindow( 0.2, 0.2, 0.6, 0.6, "Titolo", true ) dimx, dimy = guiGetSize(window, false) browser = guiCreateBrowser( 0, 28, dimx, dimy, false, false, false, window ) theBrowser = guiGetBrowser( browser ) requestBrowserDomains({'192.168.1.16'}) guiWindowSetMovable ( window, false ) showCursor ( true ) addEventHandler( "onClientBrowserCreated", theBrowser, function( ) loadBrowserURL( source, "http://192.168.1.16/" ) end ) addEventHandler('onClientBrowserWhitelistChange', root, function(lista) outputChatBox(table.getn(lista)) loadBrowserURL( source, "http://192.168.1.16/" ) end ) I'm executing this code to resource start for test, and 192.168.1.16 is the LAN server IP for test, I'll change it in production mode. When the resource starts, the window opens, and asks me for the permission, but when I grant it, does nothing. How can I solve and begin this new login resource? Thanks
  12. Thanks for the explanation I understood. Now, I want to know if a variable/function declared in a lua file is visible: in a lua file of another resource in a http file of the same resource Thanks
  13. Dear users, if in a resource I create many lua files, one for functions, one for variables, one for events, ecc..., are they all visible between them? If I declare a variable in a.lua, can I edit it in b.lua and output in c.lua? I need some particular declaration? Thanks
  14. If it is so, I can place new level crossings where I want, and GTA will execute the open/close command?
  15. So, I did two screenshots: the first without train (link) the second with train (link) As you can see, if there isn't a train near the level crossing, it is open. If there is a train, it closes. I think in the game programming there is an action radius (number) for each level crossing, and if there is a train in that radius, the level crossing closes. Now I want to increase the number of that action radius. Is it possible? Thanks
  16. Dear users, I noticed when I drive a train ad I'm close to a level crossing, it starts to close too late, in fact if I drive in high speed, the train arrives there when the bars are still raised. I think in the game development there is a radius for each level crossing, and if in that radius there is a train, it starts closing. I want to increase that radius. How can I do? Thanks
  17. And serverside what source I need to write? I saw it isn't exactly what I want, because it returns tick count, but I need the timestamp as PHP time() function. Thanks
  18. I added debug functions in my code as outputChatBox(), to test it. Now this is the code serverside: function scatta(risx, risy) outputChatBox('fase 2 - x: '..tostring(risx)..' - y: '..tostring(risy)) takePlayerScreenShot(client, risx, risy, getPlayerName(client), 100, 10000000) end function salvala(ris, stato, immstr, secondi, param) local mom = getRealTime() if(stato == 'ok') then local ha = fileCreate('imm-'..param..'-'..tostring(mom['timestamp'])..'.jpg') if(ha) then fileWrite(ha, immstr) fileClose(ha) end end outputChatBox('fase 3 - nome: imm-'..param..'-'..tostring(mom['timestamp'])..'.jpg - stato: '..stato) triggerClientEvent(getPlayerFromName(param), 'fotoritorno', '', stato) end addEvent('fotofalla', true) addEventHandler("fotofalla", getRootElement(), scatta) addEventHandler("onPlayerScreenShot", getRootElement(), salvala) And this is clientside: function falla() local x,y = guiGetScreenSize() outputChatBox('fase 1 - x: '..tostring(x)..' - y: '..tostring(y)) triggerServerEvent('fotofalla', x, y) end function risu(stato) outputChatBox('Risultato funzione: '..stato) end addCommandHandler('faifoto', falla) addEvent('fotoritorno', true) addEventHandler("fotoritorno", getRootElement(), risu) And this is meta.xml <meta> <info author="dam034" version="1.1" type="misc" /> <script src="foto-s.lua" type="server" /> <script src="foto-c.lua" type="client" /> </meta> Testing all the code, trying with the command /faifoto, in the chatbox I see only "fase 1 - ...", so I think it work up to the function falla(). So I want to know: where I did wrong? Thanks
  19. Can I use outputConsole(), so it's easier for me?
  20. The screenshot is surely enabled in MTA settings because before this script, I used one only serverside, without take the screen resolution from the client and it worked. Then, where can I see the debug console to read the messages I'll write? Thanks
  21. Dear users, as you know, I'm scripting a MTA server on my LAN test server. I have problems about screenshots, this is the resource code serverside: function scatta(risx, risy) takePlayerScreenShot(client, risx, risy, getPlayerName(client), 100, 10000000) end function salvala(ris, stato, immstr, tick, param) local mom = getRealTime() if(stato == 'ok') then local ha = fileCreate('imm-'..param..'-'..tostring(mom['timestamp'])..'.jpg') if(ha) then fileWrite(ha, immstr) fileClose(ha) end end triggerClientEvent(getPlayerFromName(param), 'fotoritorno', '', stato) end addEvent('fotofalla', true) addEventHandler("fotofalla", getRootElement(), scatta) addEventHandler("onPlayerScreenShot", getRootElement(), salvala) And this is clientside: function falla() local x,y = guiGetScreenSize() triggerServerEvent('fotofalla', x, y) end function risu(stato) outputChatBox('Risultato funzione: '..stato) end addCommandHandler('faifoto', falla) addEvent('fotoritorno', true) addEventHandler("fotoritorno", getRootElement(), risu) As you can see, I wrote the variables' name in my language (so you know), and I can use serverside only to take screenshot, except for taking screen resolution from client. This script doesn't work. Where I did mistakes? Thanks
  22. I solved the problem changing the old dbConnect() code with this: db = dbConnect('mysql', 'dbname=mtasa;host=localhost;port=3306;unix_socket=/var/run/mysqld/mysqld.sock;charset=utf8;', 'mtasa', '', "share=1;autoreconnect=1;") Now if you want, you can trash this topic. Bye!
  23. Actually, I'm developing/testing my MTA server in LAN, then without public IP, and then I don't want to grant mysql connections outside localhost, due to security problems. How can I fix this issue (unix socket) using localhost address? Thanks
  24. Dear users, I created a test resource called "prova". When I try to start it, I get this error: [12:50:25] start: Requested by Console [12:50:25] Resource 'prova' changed, reloading and starting [12:50:25] Starting prova [12:50:25] WARNING: [mie]/prova/mysql.lua:4: Bad usage @ 'dbConnect' [Can't connect to local MySQL s erver through socket '' (111)] [12:50:25] start: Resource 'prova' started As it appears, the problem is in the mysql.lua file, executed serverside, this is the code: db = nil function conn() db = dbConnect('mysql', 'dbname=mtasa;host=localhost;port=3306;', 'mtasa', '', "share=1") end function disc() destroyElement(db) end function segnalo(msg, tipo) dbExec(db, 'INSERT INTO provatab(testo, soldi, spotf) VALUES(?, ?, ?)', 'Msg-'..tostring(tipo)..': '..msg, 2500, 1) end function giraarma(prima, mo) dbExec(db, 'INSERT INTO provatab(testo, soldi, spotf) VALUES(?, ?, ?)', 'Arma da '..tostring(prima)..' a '..tostring(mo)..' - Chi: '..getPlayerName(source), 2500, 1) end addEventHandler('onResourceStart', getResourceRootElement(), conn) addEventHandler('onResourceStop', getResourceRootElement(), disc) addEventHandler("onPlayerChat", getRootElement(), segnalo) addEventHandler("onPedWeaponSwitch", getRootElement(), giraarma) I thought it could be a mysql problem, but when I try to access to my database via phpmyadmin on localhost server, I can access without problems. What can it be? Please help!
  25. Can I use only one resource to create RPG? I thought I could create mysql.lua in rpg resource to export its functions to all the others lua files in the resource. How can I do? Thanks
×
×
  • Create New...