Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by tosfera

  1. And after that you'll isolate again? Great strategy, kid.
  2. Worst idea ever, adding a whitelist to your server. You'll never grow like that.
  3. If I'm looping through the saveData, it's already returning 6 things. which is actually incorrect since it should return 3 collections. Looping through the saveData like this also returns the wrong collection: for i, p in ipairs ( saveData ) do outputChatBox ( i .."--".. tostring ( p ) ); end I'll just do it the ugly way since the function isn't going deep enough.
  4. Alright, I've got the following JSON saved in my mysql: [ [ { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 } ], [ { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 } ] , [ { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 } ] ] It are 6 elements inside 3 elements. Each of these 3 elements holds 6x the { "lastPlayed": 0, "experience": 0, "money": 20 }. Whenever I'm using fromJSON, it's returning the wrong information when I'm trying to access the first element out of the second collection. The code I'm using is as following: local saveData = fromJSON ( data [ 1 ].saves ); outputChatBox ( #saveData ); -- returns 6 elements (incorrect) outputChatBox ( #saveData [ 2 ] ); -- returns 3 properties (correct) outputChatBox ( tostring ( saveData [ 2 ] [ 1 ] ) ); -- returns nil The JSON is valid, I can use it in different languages too and every parser says it's correct. I'm starting to think that fromJSON is returning just the first collection instead of all 3. Has anyone encountered this problem? I'm not really a fan of putting it all into 1 collection, it's preventing me from adding more and more data later on.
  5. A wise psychologist once said: I would rather fix the problem at the roots, instead of trying to fix the symptoms.
  6. As I said, turn on debugscript 3 to read the errors. If you really can't work it out then I can, but you have to try it yourself first. We're not just giving things away without you even trying.
  7. First of all, in your server's side: local text = guiGetText(Edit) 'Edit' is nothing, you haven't declared it anywhere. Second of all, in your server's side you're expecting a playersource as first variable which you called 'plr'. In your client side, you're sending a function: triggerServerEvent( "myEvent", localPlayer, guiGetText ) If you would've put on debugscript 3, you would've gotten an error. Go to your server, turn on /debugscript 3 and read the errors.
  8. guiCreateBrowser should be used for interactive websites, where people can use the website theirself. If you still want to have the dxRender for your browser then simply draw the render over the guiCreateBrowser. the browser will do the functionality while the render does the overlay of it. No idea why you would want that but oh well, you never know!
  9. Neither does your input or hover work because you've used CreateBrowser which the wiki states as, and highlighted the part which is your problem: You're looking for input-handled functions, which can be done with GuiCreateBrowser. This would do: local browser = guiCreateBrowser ( ( x / 2 ) - 200, ( y / 2 ) - 100, x, y, true, true, false ); local theBrowser = guiGetBrowser ( browser ); addEventHandler ( "onClientBrowserCreated", theBrowser, function () loadBrowserURL ( source, "http://mta/local/login.html" ); end ); Also, you know that you can position the div with css itself and create the browser with '0, 0, x, y'. right? simply add this to your body element as a class: top: calc(50% - 100px); left: calc(50% - 200px); position: absolute;
  10. If you think about it.. it's actually quite easy to do pathfinding. You got the GPS resource which has all the nodes, if you simply modify the distances it stays away from nodes, you got the basics laid out. Then simply create a colshape around the player to see if there are any objects in their way. if so, move around them. it would be pretty hard to do since turns will mix them up, but if you're really interested in getting a basic pathfinding.. that would be the way to get started.
  11. What do you mean with 'naturally', do you want the player to walk there or rather want it to teleport there?
  12. Ya I assume it's a bug in MTA because this has been killing me slowly. guess I'll see what they do with the reports.
  13. Can't edit my post, what a joke. So that'll be a double post.. anyway, unbinding the entire key doesn't work. Any chance you got another idea?
  14. What he's trying to say is that you could turn off the cache from your client sided files in your meta.xml. This will prevent the system keeping the files on your computer. Another thing you can do is compile your scripts, they won't be able to change anything in them. If you really want to give them a pain in the ass; create a function/trigger to the server, on the server's side check for an IP. if that ip mismatches, stop the entire functionality of the entire script. Simply break the functions everywhere. They can change this theirself too if they got the server sided files, for that.. you can't protect yourself. just make sure no one has access to your files.
  15. You're almost trying to kill the client there, seriously.. don't work like that. Better use these steps; player logs in/joins the server set their data (their acl group OR a default group), something like: 'rank' in the onClientRender, loop through the players, get their rank once you got their rank, get the correct render name (make it an array/table and read it from there for ease) you're done.
  16. Without reading anything in this topic, are you sure you're running the latest client and server version? Is the file set as a client sided file in your meta? (reading the post now) The function you're using is a useful function, which means you have to include the function from the wiki in your file. function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,checkBuildings,checkVehicles,checkPeds,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getElementPosition(localPlayer) local distance = distance or 20 local height = height or 1 local checkBuildings = checkBuildings or true local checkVehicles = checkVehicles or false local checkPeds = checkPeds or false local checkObjects = checkObjects or true local checkDummies = checkDummies or true local seeThroughStuff = seeThroughStuff or false local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false local ignoredElement = ignoredElement or nil if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end end add that at the bottom or top from your file, I would go for top.
  17. That's not working, might want to attach an ID to the object/colshape and do the part where you delete everything on the server. This does mean that only 1 player can get the actual object from that colshape. If you want every client to be able to do so.. you should create the colshapes and objects on the client's side.
  18. Are the objects created on the client's side or server sided? Maybe, just maybe, we're not allowed to delete server sided objects in our client.
  19. You want to remove the attached element and the colshape? You could try something like this then: function destroyObject ( theElement, matchingDimension ) if ( theElement == getLocalPlayer() ) then local tmpObject = getElementAttachedTo ( source ); if ( tmpObject ) then -- detach everything from both elements detachElements ( tmpObject ); detachElements ( source ); -- destroy both elements destroyElement ( tmpObject ); destroyElement ( source ); end end end addEventHandler ( "onClientColShapeHit", getRootElement(), destroyObject );
  20. Only way that it can be nil is when the colshape gets deleted before the onClientKey (which should be onClientClick, my bad) gets called. We're assigning the value to tmpColshape on line 5 already so it shouldn't be nil. What other code can be found in your file?
  21. Good to know it works, enjoy it mate!
  22. That should work. even though functions should be called with a ":" but it's inside a table so the dot should work.. try using a ":" instead?
  23. I used a small L there, just change it to getLocalPlayer() with a capital L and it should work.
  24. You're unable to reposition an element when it's attached. If you're attaching an object to another element, or any element to another element. it becomes a child element from the attached to element. Which means; if the parent (the attached to element) gets removed, they get detatched. If you're trying to destroy the element you're attaching, you should first make it an element of it's own again. Else the parent will have trouble seeking it's child. The attachment functions in MTA have a higher priority than any destroy function on the attached element.
  25. I'm currently working with some pretty complex things on work in angular but that did give me an idea. Try it like; theFunctions = { }; theFunctions.checkStars = function ( thePlayer ) return getPlayerWantedLevel ( thePlayer ); end return theFunctions
  • Create New...