Jump to content

Miika

Members
  • Posts

    253
  • Joined

  • Last visited

Everything posted by Miika

  1. local x = 3985.1799316406 local y = -1973.4870605469 local z = 27.812973022461 function addPickup() pickup = createPickup(x, y, z, 3, 1242) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), addPickup) pickupCol = createColSphere ( x, y, z, 1) -- create colSphere for pickup addEventHandler("onColShapeHit", root, function(hitElement) if source == pickupCol then if getElementType(hitElement) == "Player" then if isElement(pickup) then destroyElement(pickup) setTimer(function() addPickup() end, 5000, 1) end end end end )
  2. Miika

    (Help)Vehicle

    In my understanding, there's no support given for people with stolen scripts.
  3. Miika

    Weapon Table

    Are you trying to save weapons when player quit?
  4. Miika

    Save data

    I would use SQLite instead of MySQL. MySQL requires 'hosted' database but SQLite just creates database file in your resource and saves all data in there. Use those functions to get started: dbConnect dbQuery dbPoll https://wiki.multitheftauto.com/wiki/Server_Scripting_Functions#SQL_function Also when using dbQuery, check out this: http://www.w3schools.com/sql/sql_datatypes.asp
  5. local missionMarker = createMarker(2153, -1799, 12.5, "cylinder", 1.1, 255, 0, 0, 100) function triggerTheEvent(hitElemet) if hitElement and getElementType(hitElement) == "Player" then triggerClientEvent(hitElement, "onTheDamnWindow", hitElement) end end addEventHandler("onMarkerHit", root, triggerTheEvent) addEvent("onTheDamnWindow", true) addEventHandler("onTheDamnWindow", resourceRoot, function () missionName = guiCreateLabel(0.64, 0.85, 0.38, 0.13, "sweet buisness", true) local font0_gtasanandreas = guiCreateFont(":freeroam_login/images/gtasanandreas.ttf", 50) guiSetFont(missionName, font0_gtasanandreas) guiLabelSetColor(missionName, 252, 226, 81) end )
  6. @iPrestege Marker alpha is not needed argument, only required arguments are x, y and z check up the wiki page; if there's no alpha set, it's automatically 255.
  7. You can track, where the error is just by adding something like outputChatBox("asd") in function. Example, add it on marker function and then hit the marker and if it outputs "asd" in chatbox, move the message to clientside function. if it outputs message in clientside function, then there's something wrong with your label.
  8. Miika

    Happy New Year

    Happy new year everyone! I hope I can start working on my new gamemode soon..
  9. local gate = createObject(10828,1838.3000488281,908.90002441406,22.10000038147,0,0,90) local col = createColSphere(1838.3000488281,908.90002441406,22.10000038147, 4) local thegang = "TheGhosts" addEventHandler("onColShapeHit", col, function(hitElement) if getElementType(hitElement) == "player" then local gang = getElementData(hitElement, "gang") if (gang and gang == thegang) then moveObject(gate, 4000,1838.3000488281,941.79998779297,22.10000038147) end end end) addEventHandler("onColShapeLeave", col, function(hitElement) if getElementType(hitElement) == "player" then local gang = getElementData(hitElement, "gang") if (gang and gang == thegang) then moveObject(gate, 4000,1838.3000488281,908.90002441406,22.10000038147) end end end) Try it Also, those ' ; ' are not needed in lua.
  10. Whoops, my bad. I wrote: setPlayerHudConponentVisible Instead of setPlayerHudComponentVisible
  11. There's no need for triggerServerEvent("nomorehud"). You can do all that stuff in clientside; addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("noMoreHud", root) mainWindow = guiCreateWindow(0.05, 0.08, 0.89, 0.83, "", true) guiWindowSetMovable(mainWindow, false) guiWindowSetSizable(mainWindow, false) guiSetAlpha(mainWindow, 0.90) mainImage = guiCreateStaticImage(845, 18, 367, 611, ":freeroam_login/images/chick.png", false, mainWindow) mainText = guiCreateLabel(0.01, 0.04, 0.68, 0.13, "Welcome to San Andreas Online. This is a pre-alpha preview of the server.", true, mainWindow) playButton = guiCreateButton(0.88, 0.93, 0.12, 0.06, "PLAY", true) setCameraMatrix(1945, -1690, 67, 1902, -1602, 13) setPlayerHudConponentVisible("all", false) showCursor(true) showChat(false) end ) function buttonPress(btn, state) if btn == "left" and state == "up" then if source == playButton then triggerServerEvent("spawnPlayerPos", resourceRoot) destroyElement(mainWindow) destroyElement(playButton) end end end Btw, when you use triggerServerEvent(), use always 'client' instead of 'source' in server side function. And when triggering serverside event, use resourceRoot instead of root (that caused your problem)
  12. Miika

    toJSON bug?

    Yeah, it's the only element, that table contains Have to check it out next time I go to PC again.
  13. Miika

    toJSON bug?

    Oh now I understand what you mean. I have saved the vehicle (element) in table (what I don't even need to) So can this be the thing causing error?: table.insert(t, wangvehicle[client]) I am not currently in computer so I can't test.
  14. Miika

    toJSON bug?

    I'm trying to save the player's elementdata (which is table value) (tested). And it saves it. I can load the same account data and use fromJSON and it works fine. But it still gives me that error.
  15. Miika

    toJSON bug?

    Hello there, I've almost finished my vehicle shop / saving / control system but i got this error when i log out or reconnect: ERROR: wangcars/shop_server.lua:16: Couldn't convert userdata argument to JSON, only valid resources can be included for this function. I've tested and the result is table but toJSON says that it is userdata. It still saves it to accountdata in toJSON and i can unpack it with fromJSON. So is this mta bug or what? Saving function: addEventHandler("onPlayerLogout", root, function(account) local data = getElementData(source, "wangcars.data") if data then if account and not isGuestAccount(account) then if isElement(wangvehicle[source]) then local id = getElementData(wangvehicle[source], "wangcars.id") local x, y, z = getElementPosition(wangvehicle[source]) local rx, ry, rz = getElementRotation(wangvehicle[source]) data[id][6] = x..", "..y..", "..z..", "..rx..", "..ry..", "..rz data[id][8] = getElementHealth(wangvehicle[source]) setElementData(source, "wangcars.data", data) destroyElement(wangvehicle[source]) wangvehicle[source] = nil end setAccountData(account, "wangcars.data", toJSON(getElementData(source, "wangcars.data"))) -- error there, but it still saves it setElementData(source, "wangcars.data", false) triggerClientEvent(source, "wangcars.refreshgrid", source) end end end ) I have almost same function when player quit but no need to post it. I could just ignore this, but it's anoying because it always outputs error in debugscript when somebody disconnects and i'm trying to keep debug clean as possible.
  16. Miika

    Team target

    So what's the problem then?
  17. Hello there, I could never figure out myself proper way to make markers bouncing like in vanilla gta sa. I have tried moveObject in clientside but doesn't seem to work well. Anyone having ideas, what functions I should use in order to create bouncing arrow marker?
  18. Miika

    [HELP]

    It means that serverside script is trying to call clientside function with triggerClientEvent. the key in triggerClientEvent, addEvent and addEventHandler is different or missing completely in clientside,
  19. onPlayerLogin setElementModel addPedClothes addEventHandler("onPlayerLogin", root, function() setElementModel(source, 0) addPedClothes(source, "afrobeard", "head", 1) end )
  20. <object name="resource.eventpanel"></object> <object name="resource.house_system"></object> Add those in admin group in acl.xml
  21. Can you explain, why they are not working? Doesn't the resources start or cant you access the gui or what? Btw, you have to be admin in order to use those resources as the info said in both resources.
  22. Miika

    Flags

    I don't think it's possible if you use default scoreboard. You can: a) download different scoreboard b) change the script to draw flags with dx using exported country function from admin panel UPDATE** I found exactly same scoreboard as in picture. Link: https://www.dropbox.com/s/6q0tbt6orj5p9s5/scoreboard.zip?dl=0
×
×
  • Create New...