Jump to content

joaosilva099

Members
  • Posts

    199
  • Joined

  • Last visited

Everything posted by joaosilva099

  1. It's a nice question, I don't know too.
  2. well i dont usually create tables using sql language i let the hard work to phpmyadmin but i am sure u will find on google dbFree is not needed when the query is done by dbExec or handled with dbPoll
  3. Then OnClientVehicleDamage triggerServerEvent triggerClientEvent --to sync to other players
  4. If you set AUTO_INCREMENT on the id field on that table, just pass NULL to the id field when executing an INSERT query and it will auto increment the id. If you want to get the ID which the db incremented to your query use this: local _, _, last_insert_id = dbPoll(dbQuery(CONNECTION_HANDLER, QUERY), -1) Another way to get the next ID is: local table = dbPoll(...) local next_id = table[#table]["id"]+1
  5. onPlayerJoin will only trigger when all resources are started clientside, so try changing onPlayerJoin with onPlayerConnect Do not forget to fade in the camera and focus it on the player who joined fadeCamera(source, true) setCameraTarget(source, source) onClientFileDownloadComplete won't work since it's meant to be used with downloadFile function and not with server scripts
  6. joaosilva099

    Split

    This can help you understanding: function string.explode(self, separator) Check("string.explode", "string", self, "ensemble", "string", separator, "separator") if (#self == 0) then return {} end if (#separator == 0) then return { self } end return loadstring("return {\""..self:gsub(separator, "\",\"").."\"}")() end
  7. onVehicleDamage triggerClientEvent getVehicleWheelStates setVehicleWheelStates Maybe... I think it would work
  8. it will return that obviously since you are typing the command in the server console.
  9. The problem with this is: You must be logged into an account which is in the Admin ACL, otherwise it won't work... so better to change onPlayerJoin by onPlayerLogin
  10. You must be knowing math for this. First of all, ignore Z of blips (you can use it if you want Ordering in your blips...) Then, you must use getPlayerMapBoundingBox to get the Map size (or get it by your drawing funcition), And finaly, play around with direct proportionality to transform 3000x3000 into YOURMAPXxYOURMAPY
  11. local localPlayer = getLocalPlayer() local screenWidth, screenHeight = guiGetScreenSize() local position_lbl = guiCreateLabel( 10, screenHeight-24, screenWidth, 22, " ", false ) function renderPosition() if not isPlayerMapVisible( ) then return guiSetText(position_lbl, "") end local _x, _y, _z = getElementPosition( localPlayer ) local _rot = getPlayerRotation( localPlayer ) guiSetText( position_lbl, "X: " .. tostring( _x ) .. "; Y: " .. tostring( _y ) .. "; Z: " .. tostring( _z ) .. "; RotZ: " .. tostring(_rot) ) end addEventHandler( "onClientRender", getRootElement(), renderPosition ) Should work
  12. They might use the command 'refreshall' or maybe even 'refresh' when that happens. Or just simply run a server-sided code which takes a lot of time. (Like I've seen on DayZ servers about ~2 years ago) Yee it's a nice startpoint... but if I run the code, the server will only stop when the code ends, so it's the same thing... /refreshall won't work in this case, as I want to restart the server to update it's MTA version, and not resources.
  13. I see in some servers.... You get NT and then you connect back (in that while, it's suposed that the server restarted)
  14. Does someone know how do shutdown the MTA Server and then start it again without the players being disconnected. I mean, when the server is back, they synchronize again. I am using Winodws
  15. Oh forget the question, I solved it changing, first load the txd and then the Dff. Resolved
  16. Thanks man but I have a question. Is there a correct order to import txd and dff? like first DFF or first the TXD?
  17. Sorry guys. I have been sleeping since my last post and now I will have classes. I will post it later. The mod is here @2:40 Download and is the Mobile Command Center in the RAR
  18. Oh ty i checked it and no errors. The file gets downloaded correctly and replaced. It is simply white!
  19. Hi all, I have a script to load mods, the script is working fine for all mods, but this Mod is not loading correctly. The DFF file loads fine and the model gets changed, but it becomes white when I load the TXD, Look at the screenshots: I hope someone can help me
  20. Its very nice!! Just a little "bug" that i fixed easily. When a Gui Tab is disabled you can't se it's name because tab background is black and tab name font color is black too. I whitened a little bit the tab background and now it's working
  21. rotation never gets negative, you should do this: if (rx < 360-29) and (rx > 360-32 ) then
  22. Hi all. I am good at maths but not so good. I want to get the world position when a player clicks the screen and the F11 map is opened. I though in screen rate (x/y) and then some maths. I would want the reverse too if it is possible. Thanks anyways!
  23. Totally pointless, it will do the exact same result. Here is the reason: When the setElementVisibleTo is called you (aliensky) get the "Criminal" team element with his members as children. So imagine you are "Player1" and you are not in the Criminal team, but there is "Player2" and "Player3" in the Criminal team, when this piece of code is called, it will set the visibility to true for only "Player2" and "Player3" and then it's over ! It won't update automatically if "Player1" joins the team ! So you have to set the visibility to true for anyone who will join this team, and to false for anyone who will leave that team. A good way to do that would be to listen for an event such as "onPlayerTeamChange" but this event doesn't exist. So I did this instead: -- Table that will store the teams that have elements only visible for their members. local teamVisibilityBindings = {} -- Copying the original setElementVisibleTo function into _setElementVisibleTo: local _setElementVisibleTo = setElementVisibleTo -- Replacing setElementVisibleTo function by our own for the whole resource: _G.setElementVisibleTo = function ( theElement, visibleTo, visible ) if isElement(visibleTo) and getElementType(visibleTo) == "team" then addTeamVisibilityBinding(visibleTo, theElement, visible) end end local function addTeamVisibilityBinding(team, element, visibility) local bindings = teamBindings[team] if not bindings then teamBindings[team] = {} bindings = teamBindings[team] end local notFound = true for elem, vis in pairs(bindings) do if elem == element then -- if there is already an entry for that team and element local notFound = false if vis ~= visibility then -- if we are changing the visibility teamBindings[team][elem] = visibility -- Update it refreshVisibility(true) end end end -- We checked all the bindings for that team if notFound then -- It's a new element to bind its visibility to a team teamBindings[team][element] = visibility -- Add it refreshVisibility(true) end end local teamMembersCache = {} function refreshVisibility( forced ) for team, bindings in pairs(teamVisibilityBindings) do local nbMembers = #getPlayersInTeam(team) if teamMembersCache[team] ~= nil or nbMembers ~= teamMembersCache[team] or forced then --if the number of members changed or we are forcing it for elem, vis in pairs(bindings) do _setElementVisibleTo(elem, root, not vis) _setElementVisibleTo(elem, team, vis) end end end end setTimer(refreshVisibility, 1000, 0) This should work but I didn't tested it (I can't for now). Here is what your code should now looks like: local crMarker = createMarker(1863.6999511719,-1598.6999511719,12.89999961853, 'cylinder', 2, 255, 0,0, 150) setElementVisibleTo (crMarker, getTeamFromName ("Criminal"), true) You are right. I didnt understood that part when he asks for the blip to get shown when he joins the team
×
×
  • Create New...