Jump to content

RizoN

Members
  • Posts

    27
  • Joined

  • Last visited

Posts posted by RizoN

  1. Hello, I'm trying to do this:
     

    
    
    function testFunction(sData, sSomething)
    
    	local callbackFunction = function(result) outputChatBox(tostring(result)) end
    
    	-- callback function is defined properly here
    
    	Database:query(MyHandlerFunction, {callbackFunction, sData}, "SELECT * FROM my_database_table WHERE something=?", sSomething)
    
    end
    
    
    
    function MyHandlerFunction(query, func, data)
    	-- func is nil here, but data is not nil
    	func("hello") -- returns error, as it says that func is nil
    end
    
    testFunction("mydata", "123")


    I'm using OOP
    the query function doesn't seem to want to transport my callback function to my handler function, is it a query function limit or something? like it cant transport functions?

  2. I have pretty much similar questions as @ut0pic

    Would this only increase streaming limit of elements like in MTA:Eir project so that we could basically render whole SA map at once without glitching, or does it extend also to adding new IDs for weapons, vehicles, objects, and so on? If it would also enable us to add custom IDs, would we be able to make a custom weapon/vehicle system for players?
    Having those new potentional functions in Lua would be really awesome.

    Edit: oh and, what about CLEO mods and custom animations?

  3. 20 minutes ago, LoPollo said:

    Do not expect me to help you, i'm noob at this. Sorry :(

    If i understand with colliding you mean overwriting right? so both first and second, 2 different objects (that's why you get 2 differents "signature"), will have same data

     

    But does this happen if you make 2 copy of the .fx shader file?

     

    In the code i can't see any cause of overwriting... even the only variable with the same name in the script is tTable which is local.... but i'm a noob at this.

    I just want to make this as clear as possible.

    2 Instances of same shader file can co-exist and have different data for same attributes. Yes it's impossible that they overwrite each other but still it's happening for unknown reason. Making copies of .fx is not a solution I'm looking for because it should be possible to do with dxCreateShader in multiple instances. (In fact in my actual script, the first table already has in each instance of itself the same shader, and it works with seperate images, but when second table gets created, it somehow overwrites first table even though they're not connected in any way.)

    I have no idea how to fix this issue.

  4. Hello. I've ran into some strange issue.

    I've got two seperate tables which store to themselves shader from same location e.g files/shaders/hud_mask.fx
    so to show it as an example, it'd look like this:
     

    Spoiler
    
    FirstTable = {}
    FirstTable.__index = FirstTable
    
    function FirstTable:new()
    
    	local tTable = setmetatable({}, FirstTable)
    
    	tTable.hudMaskShader = dxCreateShader("files/shaders/hud_mask.fx")
    	tTable.radarTexture = dxCreateTexture("files/images/map.png")
    	tTable.maskTexture = dxCreateTexture("files/images/circle_mask.png")
    
    	dxSetShaderValue( tTable.hudMaskShader, "sPicTexture", tTable.radarTexture )
    	dxSetShaderValue( tTable.hudMaskShader, "sMaskTexture", tTable.maskTexture )
    
    	return tTable
    
    end
    
    
    
    SecondTable = {}
    SecondTable.__index = SecondTable
    
    function SecondTable:new()
    
    	local tTable = setmetatable({}, SecondTable)
    
    	tTable.otherShader = dxCreateShader("files/shaders/hud_mask.fx")
    	tTable.otherTexture = dxCreateTexture("files/images/other.png")
    	tTable.otherMaskTexture = dxCreateTexture("files/images/other_mask.png")
    
    	dxSetShaderValue( tTable.otherShader, "sPicTexture", tTable.otherTexture )
    	dxSetShaderValue( tTable.otherShader, "sMaskTexture", tTable.otherMaskTexture )
    
    	return tTable
    
    end
    
    
    local myFirstTable = FirstTable:new()
    local mySecondTable = SecondTable:new()

     

     

    This is just an example code.

    My problem with this system of usage is, i am expecting when i use dxCreateShader for same file twice but in two different tables that it will return me two different instances of the same shader so that they don't collide with each other. But for me, they do collide for unknown reason.

    The second shader and its data stored in sPicTexture and sMaskTexture overwrite first shader even though they shouldn't be connected at all.

    How can i solve this?

    Thanks for reading.

  5. 3 hours ago, NeverGiveup said:

    Compile and Create a backdoor for yourself for example;

    You set a root element data like

    setElementData(root, "mapSecure", "randomCodes") and then in your every map put a check on very top before your main script if the elment data is right otherwise return false and not loading the maps.

    Eg: 

    if getElementData(root, "mapSecure") ~= "randomCodes" then return false end

    --rest of the codes---

    Could you please explain what is this useful for? I don't think there's a need for this since everything here is happening at server-side, and using root on setElementData is a little bit inefficient, don't you think? :P

  6. 49 minutes ago, Gravestone said:

    Are you sure? The website is online for me.

    You've misread my post. I said: in case of being offline, I haven't said that it's offline :P
     

    48 minutes ago, GTX said:

    It really depends: Are you making a multigamemode? If so, go for client side because if you do it on server side, you will load map for every player in the server, which is not good. On the other hand, if you want to load a map for all players in the server, you should go for server side.

    Thanks for replying,
    What about the security issues? Maps could be stolen this way

    Also, another question popped in my head. Which way would be recommended to download maps? (I believe you have experience with this)
    There are couple of things that get transferred from a custom maploader to client
    1. Map settings (extracted from .map file) (is sending this to a client via triggerClientEvent bad?)
    2. Map files(sounds, mods) (would downloadFile be fine, or do i need to download it from a server via fetchRemote? there's also latent events, but I hear they're bad impact on server when lots of players)

    I hope you or somebody else could give me a clear thought about this, since I'm not really sure anymore which is the best way.

  7. 7 minutes ago, Gravestone said:

    This is the most important point you should consider, since the performance of the server matters alot. I know an idea about having the map's on client sided. You can convert your maps to lua form using something like this and then use any client file protecting way for example the most common, 'cache=false' attribute in the meta. However this does not fully protect your files but there are many other tutorials by forum members, you can go look for them. :)

    Thanks for replying,
    I am already extracting XML data from .map files and placing it inside of a Lua table containing all elements. Using external convertor is a much slower method of achieving this, and in case of the website being offline/having bugs, I wouldn't be able to do anything about it. The maps when transferred to client are already in his computer's memory and are deleted when all necessary elements(objects, vehicles, etc) are created.

  8. Hello there.

    I'm having a dilemma about this.

    Is it better to create all elements(like objects) on client side, or server side?

    Of course, there are lot of things which could determine which option is better. 

    Pros of client-side
    1. Creating thousands of objects on client-side is far better than on server-side (example: DM Maps)
    2. Good for gamemodes which don't require too much sync

    Cons of client-side
    1. Vehicles, peds, breakable objects aren't that well synced as if they would be on server-side
    2. Security issues (everything on client side could be manipulated into malicious client's will)
    3. Maps could be stolen


    Pros of server-side
    1. Great sync for vehicles, peds, breakable objects
    2. Clients cannot manipulate or steal server-sided elements by themselves
     

    Cons of server-side
    1. Huge performance impact when dealing with lot of elements(objects, vehicles)
    2. Makes server laggy after some time
     

    So, what do you think?
    Is it better to sacrifice security for better loading or should the server handle it?
    Should map loading type be based on gamemode/what we're loading?
    Any better ideas?

    Thanks for reading
    I would appreciate if someone with experience could reply to this topic.

  9. If you would develop your own map loader, you could simply transfer map data from server to client and keep it there and load when needed (however keeping .map file on client without encrypting it will result in your maps to be easily stolen)

    • Like 1
  10. Try checking if db even exists.

    I believe that there's an error in Database:new function

    You've coded Database:new function in a way that it expects 'obj' to be a table, but instead, you're sending filepath of database which is probably why it doesn't even create the db at all.

    local db = Database:new{ ":db/dev.sql" } -- This is part where you're sending a filepath instead of a table to Database:new function

  11. Don't, because if oop is enabled in meta.xml file in Class resource, export won't work. However I've noticed this part in Class resource's script:

     

    -- Properties
    Database = {
    
        db_file_path = nil -- <- This
    
    }

    I suppose this is the reason why it's nil. Try updating it at function/place where you're creating the database at.

×
×
  • Create New...