Jump to content

Ab-47

Members
  • Posts

    367
  • Joined

  • Last visited

Everything posted by Ab-47

  1. Could you elaborate your issue a bit more please?
  2. Ab-47

    The last reply

    This topic will nevahh end ;D
  3. Does 'world.png' exist in the root directory of your script folder? And is it mentioned in the meta.xml as type client?
  4. Using fetchRemote and callRemote it would be possible, but you'd also have to create a script on your forums which would be the tough part.
  5. Just use element data, set that single players element data to something, then run a loop to get all players, play the sound for players that are not in that element data. Like setElementData(getPlayerFromName("playerThatWontHear", "allowed", true) for k, v in pairs(getElementsByType("player")) do if (not getElementData(v, "allowed")) then playSound(...) end end
  6. Ab-47

    Job

    Post your code and I'll help you fix it. The function you have all your code in, how are you calling it? Command handler, event handler? What event?
  7. Ab-47

    Job

    How are you triggering the overall function? It could be that 'p' is not recognised as a player value, which returns the function to an end.
  8. function onPlaySound() local sound = playSound("file/sound.wav") setSoundVolume(sound, 0.5) end setTimer(onPlaySound, 2000, 0) This?
  9. Ab-47

    Bug in buymap

    Debug errors? And can you explain your situation a bit more, I'm finding it hard to understand you.
  10. Why not use 'setGameSpeed' client sided according to that singular ped?
  11. Should do, although I've never tried. Use a loop to get all the players, add a check to see which players have that specific character ID then add the statement which sets the players velocity in addition to the current velocity using getElementVelocity. You will have to somehow get the local players velocity and that not being in the loop, cause if you have more than 1 player with the matching character ID, the data won't sync to a singular element yet more than 1 persons data would be jumbled up and you'll be running depending on yours and his velocity state. Hope I could help
  12. Could you explain a bit better, I don't understand your needs.
  13. Ab-47

    Vehicles

    Your error is not in the code you provided. Give us the code to function "sellVehicle" in resource SAEGVehicles. And show the code where line 355 is, in your server side code "vehicles_s.lua" Else I don't know how to help.
  14. if vehicle and not windowsDown and vehicle ~= getPedOccupiedVehicle(localPlayer) then if getElementData(vehicle, "tinted") or getElementData(vehicle, "tinted2") then end end How about this? ^
  15. Well MTA does not support self-compiled codes, so they implemented luac.multitheftauto.com to use their compiler. You don't want to use that because people can decompile, so the only lasting solution on my mind is to call this simple function at the end of your code; fileDelete So when the resource is downloaded and ran, it'll delete the file from it's directory but when the player joins again, he'd have to download it again. I've never used this function, but I assume it'll permanently delete the file, or maybe from the players directory. Use it client side and see what happens, keep a backup. Sorry if I couldn't help, but that's all the knowledge I have in compiling. Also I assume such files such as .jpg or png have to be in their standard legal way to run in MTA, else it'll detect it as a threat and won't load. Afaik..
  16. Ab-47

    The last reply

    No, just lived there for a few months
  17. addEventHandler("onMarkerHit",root,onMarkerHitGiveVehicle) And when he creates another marker from another script to do something else, the action will still be taken. You're calling a global argument to classify all elements with such corresponding data, in this case, markers. Why not use the table for the required data, define such and unpack or use a loop within a function onResourceStart to add the hit handler and give the data? That'll be even more advanced, your way is still vulnerable.
  18. Can you post your full code, I fail to understand what you're trying to do with mis-leading triggers/functions and events. Edit: I wanted to help you out and I wasn't much aware of this function neither your code, so I edited a few things to try and get it to work, and here's what I concluded: --Client Side: addEvent("getGroundPosition", true) function getGround(x, y, z) local z2 = getGroundPosition(x,y,z) triggerServerEvent("sendDataToServer", localPlayer, z2) outputChatBox("triggered") end addEventHandler("getGroundPosition", getRootElement(), getGround) --Server Side: function botTest(plr) x, y, z = getElementPosition(plr) ped = createPed(217, x, y, z) addEventHandler("onPedWasted", ped, botDead) end addCommandHandler("bot", botTest) function botDead(bleh, killer, weapon, bodypart) local x, y, z = getElementPosition(source) triggerClientEvent("getGroundPosition", killer, x, y, z) end function sendDataToServer(data) o = createObject(356, x, y, data) end addEvent("sendDataToServer", true) addEventHandler("sendDataToServer", root, sendDataToServer) function getItems(player) local x, y, z = getElementPosition(player) outputChatBox("try_one", player) for _, p in ipairs(getElementsByType("object")) do outputChatBox("try_two_one", root) if (isElement(p)) then outputChatBox("hey") if isElementInRange(p, x, y, z, 50) then outputChatBox("try_two", player) if(getElementModel(p) == 356) then outputChatBox("try_three", player) destroyElement(p) end end end end end addCommandHandler("hey", getItems) function isElementInRange(ele, x, y, z, range) if isElement(ele) and type(x) == "number" and type(y) == "number" and type(z) == "number" and type(range) == "number" then return getDistanceBetweenPoints3D(x, y, z, getElementPosition(ele)) <= range -- returns true if it the range of the element to the main point is smaller than (or as big as) the maximum range. end return false end I added the debug notations, which you can remove, I added a few command handlers to call the codes, and that function "isElementWithinRange", wasn't working, so I added MTA's provided code for it and added it into the script itself. You must use /debugscript 3 to check for errors, and you must know triggering events can transfer data, numeric or string. What I did was triggered the client event to go and fetch the data, then trigger the server event with the data and triggered creating the object in the server side. Your code can be optimised much more with tables too, and you could have made things easier. But here's the outcome to your issue. Hope I helped. Also change those variables to local variables, just made it like that cause I was trying to figure out the issue.
  19. Ab-47

    Table data

    Try the useful "unpack" pre-defined variable. It's easier than loops and is simple to understand. Let me give you an example. local table = { [1] = {"hello world", "second string of data"}; [2] = {"I like MTA", "second row of the table, and second string"}; } local elements = {} local elements2 = {} function unpackTheData() if (table) then elements[1], elements[2] = unpack(table[1]) elements2[1], elements2[2] = unpack(table[2]) outputChatBox(elements[1].." : "..elements[2]) outputChatBox(elements2[1].." : "..elements2[2]) end end addEventHandler("onClientResourceStart", root, unpackTheData) Hope this example helps you find a new solution to your problem.
  20. Create the flag model as a mod, import the changes using engineLoadTXD --For TXD files engineImportTXD --Replacing TXD elements engineLoadDFF --For DFF files engineReplaceModel --Replacing DFF elements engineLoadCOL --For COL files engineReplaceCOL --Replacing COL elements You may also use engineSetModelLODDistance Which sets custom LOD distances for any object or model ID. It's just like replacing modded vehicles, but instead of replacing a vehicle, you'll be replacing any object, such as a box or a similar flag element. I hope you find a solution
  21. Try using this: local screenW, screenH = guiGetScreenSize() function centerWindow(window_element) local windowW,windowH=guiGetSize(window_element,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(window_element,x,y,false) end Call the function with centerWindow(yourwindow)
  22. Try creating a sub-domain which runs your file. That way, it'll have nothing to do with SMF. Use hyperlinks with a server redirect incase you want a back button to go back to your main webpage.
  23. Setting it's colour works, however setting it's alpha value doesn't This resource is for a big server, so settings it's dimension is a bad idea as that dimension could be used in an event or taken up already by another resource, yeah I know there's like hundreds of thousands of dimensions, but I won't take the risk. Setting marker size to 0, could do that, but I wanted to get the proper solution to this issue. At-least so I can learn from where I went wrong. Also, if I were to do a small workaround, I could use setElementVisibleTo.. I just need the proper solution. Thanks for your help though.
×
×
  • Create New...