Jump to content

LoPollo

Members
  • Posts

    353
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by LoPollo

  1. Didn't notice that, sorry. Are there errors clientside? Try also do some basic debug by adding some output between lines, checking also the returns of the calls. Try also temporarily commenting the call to the function scoreboardSetColumnPriority on name: int priority = slot after "name" column
  2. It doesn't matter, as long as you have the right meta.xml. Example: we have 2 resources, resA and resB. ResB require resA to be running, as it uses some exported functions from resA in it. The meta of resB has the line <include resource="resA" />
  3. I'm not an expert on scoreboards, but after reading Resource:Dxscoreboard i think i know why it's happening: ^^^that's the syntax what's below are the parameters you pass. "test", 70, "tetsefeas",17 test is the name, 70 i think it should be the width BUT is the forElement, and since it's not an element the function scoreboardAddColumn fails. The fail may cause the problem. See if this works (i just inserted root as forElement): local players = getElementsByType( "player" ) function setScoreboard( ) call ( getResourceFromName( "scoreboard" ), "scoreboardResetColumns") call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", root, "test", 70, "tetsefeas",17) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", root, "murders", 70, "Player kills", 12) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", root, "zombieskilled", 70, "Zombie kills",13) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", root, "headshots", 70, "Headshots",15) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", root, "daysalive", 70, "Days Alive",16) call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", root, "totalkills", 70, "Total Frags",14) call ( getResourceFromName( "scoreboard"), "scoreboardSetColumnPriority", "name", 11) for theKey,thePlayer in ipairs(players) do setElementData( thePlayer, "test", 20 ) outputChatBox( "3") end end addEventHandler( "onClientResourceStart", getRootElement( ), setScoreboard ) Instead it's a good idea to create another post, it's another argument. Using this general rule, everyone will be able to find what's his looking for faster, if having a similar problem.
  4. shutdown is not a command (if i didn't forget anything).. do you mean quit? when a client types quit, yes the server onPlayerQuit gets triggered. If you mean that you have a script that add the command shutdown to call the function Shutdown... then it's a good question, i don't know the answer honestly. But you can find it out testing PS: if it's a source of confusion, server events exist only for server-side scripts, and client events exist only for client-side script. EDIT: PS: in this case i'm sure onResourceStop gets called, just so you know
  5. Accounts are only serverside, so you should get that data with events, or as you said syncing it on elements. onPlayerQuit is serverside, it triggers once per player quit on the server. onClientPlayerQuit triggers once per player quit for ALL players (in their client side scripts)
  6. The double dots? It's not exactly to "connect" functions, they are string concatenation operators. getPlayerName returns a string (the name of the player, ex "Foo"), and you concatenate then with ":siema!": "Foo"..":Siema!" = "Foo:Siema!" https://www.lua.org/pil/3.4.html
  7. You can save data in lots of ways: if the data is relevant only for the current session of the server/resource, you can save the data at root/resourceRoot (this data will be lost on server restart/resource restart) You can also save data with accounts. The player must be logged in, as guests accounts will have their data deleted on disconnect You can use databases, using serials to identify the players... and many others The best way is using accounts in my opinion
  8. AFAIK you can't do this in mtaserver.conf, but in the meta of the resource you want to change priority. Also (still as far i know) there are actually only 3 queues: <0, 0 >0. So if i have 5 resources with priority 90, 1, 0, 0 i will have the first 2 (90,1) in the "high" priority queue, and the 3rd and 4th (0,0) in the "normal". When the 1st and the 2nd are downloaded, they are started. Then the 3rd and the 4th will be downloaded and then started. What do you mean?
  9. Returns This function returns a variable containing the requested element data, or false if the element or the element data does not exist. When getting data corresponding to a XML attribute, this is always a string. When the data is not found, it DOES return false. @Yazir your script seems fine. So: Are you sure the init script is called before the client? Are you sure the "player" parameter is correct? Maybe it's for some reason invalid, and the data is not set. Also an error is thrown Did you copied-pasted the scripts? (just to make sure there are no syntax errors in the script) From point 2, are there errors/warnings thrown in general? Check both clients and server As is said the script seems fine to me, setElementData by default sync the data server<->client, and it depends on elements, shared between resources (so fetching the data from different resource is not the problem as you said). Try also adding (if you haven't done it yet) output inside the code blocks, so you "see" what's happening inside your scripts (this is just to check the "logic" part of the script in case point 4 is "there are no errors": in case the server block for some reason is skipped, the data will be false) That's all i can think right now
  10. The resources are started after the resource priority queue is finished (read priority groups and include in meta.xml)
  11. drawimage in a loop drawing in the same position and in a function that i guess is not called every frame... i don't get it. Also i did not understand what do you want to achieve... what is a kicker motor? and what do you mean with you can't find "wiki community"???? do you mean wiki? Explain more... PS: you are "trying" to draw an image called damage when the vehicle is in "good" health (1/3+, if i remember correctly the cars catch fire at 250hp): is this what really want to do?
  12. LoPollo

    camera change

    drawText draws the text on the screen for one frame, so if you want to display the text you must call it inside a function that handles onClientRender. If you want some examples you can see pratically every dx function (e.g dxDrawText) at the example part.
  13. LoPollo

    table data

    i can't see any error... but alpha is 18 so maybe you can't see it due to transparency?
  14. LoPollo

    table data

    Strange.... Try to output the x,y,z values to know what's in them Are there errors logged? (debugscript 3 or the .log file) Also did you follow the syntax of createMarker? Post the code block you used
  15. I'm not a MTA DayZ player so i'm not expert on this, but i can't understand what exactly you want. That can be why no one is answering. So... what do you mean with this?
  16. does it exists? I can't see it. Are you sure the error is due to this? (If i didn't see it then tell me and sorry)
  17. LoPollo

    table data

    local bases = { {2412.8,92,26.47,1830.7,-1930.1,2955.6001,"garaza","playerserial"}, {1835.7,-1930.1,2955.6001,2412.8,92,26.40,"garaza2","playerserial"}, } --bases[1] = {2412.8,92,26.47,1830.7,-1930.1,2955.6001,"garaza","playerserial"} --so we have to do: local x,y,z = bases[1][1], bases[1][2], bases[1][3] --x,y,z are the data of the FIRST table: 2412.8, 92, 26.47 --do the same for the second table: local x2,y2,z2 = bases[2][1], bases[2][2], bases[2][3] Now do the same for the rest
  18. LoPollo

    camera change

    Depends of what you want: if you want text on screen (like hud... etc) then a simple dxDrawText is enough. You can also use render targets if you want to. If you want text on the world, there are a lot of things you can do: dxDrawText + getScreenFromWorldPosition, or a renderTarget + dxDrawLine3D and there is even more... like shaders etc
  19. LoPollo

    table data

    local table1 = {} table1[2] = someValue table.insert(table1, someValue2) --the lowest empty index is 1 (tables in lua starts from index 1) table1.somePosition = someValue3 if table1.somePosition == table1["somePosition"] then --this get executed end --table is now like { [1] = someValue2, [2] = someValue, somePosition = someValue3 } table1[1] --returns someValue2 table1[2] --returns someValue table1.somePosition --returns someValue3 table1["somePosition"] --return someValue3, as it's the same as above table1[3] --returns nil, no value was assigned here --tables can also have as index objects table1[localPlayer] = getPedOccupiedVehicle(localPlayer) if table1.localPlayer == table1[localPlayer] then --this WON'T be executed end if table1.localPlayer == table1["localPlayer"] then --this will be executed end NOTE: This is not MTA, this is lua. Next time search with google
  20. Oh, right. Didn't think about this.
  21. LoPollo

    Car colors

    Yes you can, see the wiki. Every vehicle has 4 colours, with the function setVehicleColor you give the RGB values for each color
  22. "ip" I did never use that SDK, but i guess it should be an ip... like "127.0.0.1"? But i'm certain "ip" is not an ip
  23. Jamie, i think he's talking about text that only admins can see, not commands that only admins can use... So: outputChatBox's second parameter is what you are looking for. It's defaulted to root, so the text is visible to all children of root = all players. I guess in you server there's no dummy element parent of admins (it would be not a normal thing...), so i think you should get all the admins and repeat the outputChatBox for every admin* * To get the admins, you get all players. Then get their account and check if account is in "Admin" group with isObjectInACLGroup. If it is, output the text to that player: --example local players = getElementsByType( "player" ) --get ALL players local adminACL = aclGetGroup ( "Admin" ) --get the admin acl group for _,thePlayer in pairs(players) do --loop the players if isObjectInACLGroup( getPlayerAccount( thePlayer ), adminACL ) then --check if the account of that player is an admin outputChatBox( "Your text goes here", thePlayer ) --if it is, outputChatBox to him end end
  24. LoPollo

    Setable hours

    I'm not sure, but maybe scoreboard uses element data? as soon as i return home i will see how this works
  25. LoPollo

    camera change

    oh found the problem of method 2, just a moment Edit: done local activeLocation function tutorial2() if not activeLocation then activeLocation = 1 end if activeLocation <= #cameraLocations then local location = cameraLocations[activeLocation] setCameraMatrix( location[1], location[2], location[3], location[4], location[5], location[6] ) activeLocation = activeLocation + 1 setTimer( tutorial2, 5000, 1 ) else setCameraTarget( localPlayer ) end end addEventHandler("onClientResourceStart", resourceRoot, tutorial2 )
×
×
  • Create New...