Jump to content

DiSaMe

Distinguished Members
  • Posts

    1,461
  • Joined

  • Last visited

  • Days Won

    34

Posts posted by DiSaMe

  1. Add a little timer in server to let the client add the event before triggering it
    setTimer(function() triggerClientEvent("onDriver", resourceRoot, conductor) end,100,1) 
    

    No, don't do this. Doing this means assuming that the client-side script is guaranteed to start in 100 ms. This assumption is incorrect.

  2. When resource starts on the server, there's no way for it to have started and added an event on the client. You have to make sure that script is already running on the client when you trigger an event. There are easier ways to pass the element, such as using element ID functions:

    setElementID 
    getElementByID 
    

    It's simple, you set the element ID server-side and get the element from ID on the client. Then you can use setPedControlState on it.

  3. You're trying to delete the children of this node:

    clan="FBI">>

    Since it contains no children, nothing is deleted. It happens this way because xmlFileLoad returns this node:

    >...>

    And then you're getting its first child (FBI clan) as 'clansroot', then looping through its children (which don't exist, therefore nothing is removed). You're supposed to loop through the children of 'clans' instead.

    In addition, you're saving and unloading the XML file inside the loop - that's wrong. You should do this after the loop. If you unload the file inside the loop, it won't be available for the next iteration, causing an error. Saving the file repeatedly will have no effect on the result, but doing so will needlessly reduce the performance.

  4. Accounts used to be stored in XML files, but now the database is used. They are identified by name. If you want to have the two systems of accounts connected, then you need to use addAccount/removeAccount alongside the query which creates/destroys the account record in your MySQL database, and then you can modify your logPlayer function in such way that the player would be logged into the account of built-in system and also linked to the account of your database in some way.

    But to me, connecting the systems seems messy. Why would you do that? You could either use one system to store the data or two systems for different purposes. For example, I'm making a gamemode with a custom account system which stores the data of the players (weapons, money, etc.) and I will also be using the built-in account system to log in as admin. The two systems used for different purposes aren't linked to each other in any way (for example, I can log in/out as admin while still using the same game account) and that is much better than having the gameplay achievements tied to the admin or moderator status.

  5. They are separate resources. Just unzip them like Freddy said. Then start lavafl_ctrl and it will start lavaflood too. I made them separate because someone may want to do something more than lava simply rising (such as gamemode where you have to escape the flood).

  6. function draw3DText() 
        local x, y = getScreenFromWorldPosition(xpos, ypos, zpos) 
        dxDrawText("Text", x, y) 
    end 
    addEventHandler("onClientRender", root, draw3DText) 
    

    This draws the 3D text at position xpos, ypos, zpos (you have to replace them with actual coordinates).

  7. Why don't you just use the account functions then? It doesn't really look well with two systems of accounts mixed that way. There's no such thing as "account element", and all accounts of MTA account system are stored into the built-in database of MTA server.

  8. All scripts of the same resource on the same side (server or client) share the same global variables. That means you can call functions or just use variables in the whole resource as long as they are not defined as local.

    You can also call the exported functions of the resource from another resource. More information

    call 
    

  9. Matrix is probably the most intuitive representation of element's position and rotation. matrix[1] (X) vector points to the right from the element. matrix[2] (Y) points to the front. matrix[3] (Z) points up. matrix[4] is the position of the element. The first example in the getElementMatrix page may help you to understand how it works.

×
×
  • Create New...