• Content Count

  • Joined

  • Last visited

Community Reputation

35 Good


About Investor

  • Rank
  • Birthday 14/04/1999


  • Location
    United Kingdom
  • Occupation
    Student & 3D modeller
  • Interests
    3D modelling, law, computer gaming, game development, level design, etc

Recent Profile Visitors

1,318 profile views
  1. Investor

    Check if ped is not on ground

    bool isPedOnGround ( ped thePed ) float getGroundPosition ( float x, float y, float z ) getGroundPosition is client-side only and requires the world to be streamed in at that position at the time of calling the function, but if the player is above it it should be loaded.
  2. Investor

    [HELP] What's wrong with the script?

    Sound isn't working because you expect music_select to be 1 to play a sound but it's never defined, so it's nil, not 1. function Ativador_Musica(Musica_Selecionada) setElementData ( localPlayer, "Mensagem", "Sim ") setTimer ( function() setElementData ( localPlayer, "Mensagem", "true" ) end, 14000, 1 ) if music_select == 1 then -- where is music_select defined? did you mean Musica_Selecionada? Musica = playSound ( "sounds/lvl.mp3" ) end end addEvent( "PlaySound", true ) addEventHandler( "PlaySound", root, start_music )
  3. Investor


    A workaround to this is forcefully cutting the line with a ZWSP (zero-width space), which is an invisible character that allows word-wrappers to break apart a line at a more convenient position. Since there's no other breaking characters in a long line of text like that one, you'll probably want to insert a ZWSP right after each punctuation sign. Ultimately, the fix must come from MTA or CEGUI developers, to make the word-wrap break after punctuation signs (that would make sense, right?). function addZWSP(str) return string.gsub(str, "%p", function(x) return x..utfChar(0x200D) end) -- replace all punctuation signs (%p) with itself followed by UTF character 0x200D (ZWSP) end This will allow the word-wrapper to break after any punctuation sign, for example, question marks.
  4. Investor

    shader issue

    float gTime : TIME; float scrollSpeed = 1.0; float3x3 getTextureTransform() { float posU = -fmod((gTime/20)*scrollSpeed,1); float posV = 0; return float3x3( 0, 1, 0, 1, 0, 0, posU, posV, 1 ); } technique tec0 { pass P0 { TextureTransform[0] = getTextureTransform (); TextureTransformFlags[0] = Count2; } } Try this (no guarantee it'll work, I'm not a shader coder). Also, this will probably look glitchy if you continuously change the speed - you should set it only once and not change it once it's scrolling or it may jump forward or back instantaneously. The parameter you need to set with dxSetShaderValue is "scrollSpeed".
  5. Investor


    The first question basically depends on whether your players will tolerate lag (hint: GUI is supposed to be responsive). If it's something like GUI, it's best to update it on the client as if it was received by the server but set a timer to revert the GUI to server-state unless you hear back an acknowledgement event from the server (i.e. that the operation was executed without error) (don't unconditionally accept any sync event, in addition to any procedural checks (making sure the data is in valid format, etc) and so on, always safeguard and send back a kind of not-acceptable acknowledgement event when the event isn't accepted by the server for, among other, anti-cheat purposes). For stuff which could give an unfair advantage or other bonuses/cheats like godmode, it would definitely be better to run the request by the server and back before any client changes are actually shown. Instead of instant change, you could show a spinning progress icon until you hear an acknowledgement event from the server (i.e. that the operation was executed without error) Higher ping will make GUIs seem less responsive if you run it by the server before actually making changes visible. Additionally, make sure to saveguard the server from accepting illegitimate sync events, so clients can't change their--or others'--data on a whim. Refreshing GUI for players in same colshape would be best done on client receive sync packet, individually per player if possible, or refresh the whole list when one player's data changes.
  6. Investor

    [HELP] Dx Image Event

    dxDraws aren't element so they cannot emit events. As mentioned above, the closest thing you can use is onClientClient, and manually check if the client cursor X and Y are within the bounds of the dxDrawImage. That or use a dxgui API like dgs which already have that coded.
  7. Investor

    Converting table-stiring and backwards

    toJSON and fromJSON should work perfectly fine as long as you don't put elements and non-element userdata, which it seems you don't do. What do you mean by "it returns nil"? The triggering of the event returns nil? or it delivers a nil on the client side? Perhaps try sending it over as JSON still and fromJSON it on the client side.
  8. Investor

    teaDecode, engineLoadDFF, engineLoadTXD

    You could perhaps do a hash check. Get the SHA256 (or MD5 but it's not considered secure nowadays) hash of the decrypted data and compare it against the hash that you know it should be, and only if they match proceed to engineLoadDFF/engineLoadTXD. E.g. local dffFile = fileOpen("files/"..file_dff) local dffData = fileRead(dffFile, fileGetSize(dffFile)) dffData = base64Decode(teaDecode(dffData, file_key)) fileClose(dffFile) local txdFile = fileOpen("files/"..file_txd) local txdData = fileRead(txdFile, fileGetSize(txdFile)) txdData = base64Dec if hash("sha256", dffData) ~= "enter_the_SHA256_hash_that_the_dff_data_should_have" then return false end -- abort function if hashes mismatch after decryption if hash("sha256", txdData) ~= "enter_the_SHA256_hash_that_the_txd_data_should_have" then return false end -- ditto -- ... local dff = engineLoadDFF(dffData) -- in case of incorrect key, shows warning here local txd = engineLoadTXD(txdData) -- and here. (bad path)
  9. Investor

    teaDecode, engineLoadDFF, engineLoadTXD

    You'll probably need to use base64Encode and base64Decode (this will inflate file size to about 133% [difference is higher with very small sizes like single character being inflated to 4 characters, 300% increase] of the original) for the files, as it appears the data is not tea-encrypted properly (somewhat known issue with teaEncode/teaDecode and encoding control characters 0-30 and others, so keep it to being strictly alphanumeric [base64 is a good candidate]); this in turn causes the function to interpret the input as a filepath rather than raw (decrypted) data. Another option is encodeString/decodeString; these functions have worked more reliably for me at least with non-alphanumeric content.
  10. Investor

    Send client-side data on quit

    onClientPlayerQuit isn't called for the localPlayer. You should use onClientResourceStop (that will call when the resource is either stopped, or the client disconnects and the resource stops on his end).
  11. Investor


    If you're looking for the Z rotation (bearing, yaw) between two points: findRotation. If you need the local Y (pitch) it can be computed in a similar way to findRotation. The local X (roll) rotation is not defined, so to speak, when looking towards another 3D position (i.e. it can be anything) unless you introduce some additional reference point perhaps.
  12. Investor

    [Question]: Java SDK and Lua

    You can poll for data using the Java SDK. If you want to send unsolicited data, you'll probably need to use a fetchRemote or callRemote to a webserver and pipe that into your Java SDK (if that's possible, have never tried)
  13. Investor


    Months have variable length so I wouldn't advise using that. If you need to, use the average month length which is actually slightly >30 days, meaning 2592000 seconds (more more accurately, 30.44 days = 2630016 seconds) in a month. local years = math.floor(remaining_time / 31557600) local months = math.floor((remaining_time % 31557600) / 2592000) local days = math.floor((remaining_time % 2592000) / 86400) local hours = math.floor((remaining_time % 86400) / 3600) local mins = math.floor((remaining_time % 3600) / 60) local secs = math.floor(remaining_time % 60)
  14. Investor


    If you're asking for time remaining until a specific target timestamp, then local target = --[[ some timestamp ]] local current = getRealTime().timestamp local remaining_time = target - current local hours = math.floor((remaining_time % 86400) / 3600) local mins = math.floor((remaining_time % 3600) / 60) local secs = math.floor(remaining_time % 60)
  15. Are they running the same version? I remember a while back MTA included extra protections on HTTP logins requiring an IP associated with an authorized serial, or a httppass being postfixed to a user password. Disabling login can be done via ACLs if you so wish, but this is a security risk. You may open up the webadmin or HTTP runcode to unauthorized users this way. Adding resource.vitaStream.http in Default ACL rights (with access="true" of course) will open up http://serverip:port/vitaStream/* (including vitaStream/call/functionName which can call exported functions with http="true") to anyone without login.