Jump to content

Miika

Members
  • Posts

    253
  • Joined

  • Last visited

Everything posted by Miika

  1. I will And btw I just noticed something that can be issue too. I forgot to change different column numbers so it's just replacing same text every time guiGridListSetItemText(vlist, row, 1, table[i][1], false, false) guiGridListSetItemText(vlist, row, 1, table[i][4], false, false) guiGridListSetItemText(vlist, row, 1, table[i][3], false, false) They're all 1 instead of 2 and 3
  2. Thanks, i'll try this next time when i go to computer. This is local table and this is just part of the function. The function is called from clientside gui.
  3. Hello again. I have problem with table.insert. I have vehicle shop that saves data to tables and tables to element data. Always when you buy new vehicle, it should add sub-table to main-table and fill sub-table with data that i want to save. I also have panel where you can control your vehicles. Instead of showing data, the gridlist shows only number 1 in first column. Part of my code: [Server] local data = getElementData(client, "wangcars.data") if not data then setElementData(client, "wangcars.data", {}) end local data = getElementData(client, "wangcars.data") local ids = #data + 1 local x, y, z = getElementPosition(wangvehicle[client]) local rx, ry, rz = getElementRotation(wangvehicle[client]) local t = {} table.insert(t, getVehicleName(wangvehicle[client])) table.insert(t, tonumber(id)) table.insert(t, tonumber(ids)) table.insert(t, tonumber(price)) table.insert(t, c1 .. ", " .. c2 .. ", " .. c3 .. ", " .. c4 .. ", " .. c5 .. ", " .. c6) table.insert(t, x .. ", " .. y .. ", " .. z .. ", " .. rx .. ", " .. ry .. ", " .. rz) table.insert(t, "indrive") table.insert(data, t) setElementData(client, "wangcars.data", data) [Client] function refreshlist() guiGridListClear(vlist) guiGridListAddColumn(vlist, "Vehicle name", 0.3) guiGridListAddColumn(vlist, "Sell price", 0.3) guiGridListAddColumn(vlist, "ID", 0.3) local table = getElementData(localPlayer, "wangcars.data") if not table then setElementData(localPlayer, "wangcars.data", {}) end for i=1, #table do local row = guiGridListAddRow(vlist) guiGridListSetItemText(vlist, row, 1, table[i][1], false, false) guiGridListSetItemText(vlist, row, 1, table[i][4], false, false) guiGridListSetItemText(vlist, row, 1, table[i][3], false, false) end end The values are tested and they're working fine. No errors in debugscript.
  4. Thanks guys, forgot to check this forum for a while..
  5. Hello guys, I can't figure out, what function sets vehicle look crashed? I mean: broken doors, hood, trunk, etc I need it in my mechanic job, where it spawns random vehicles that are broken and you have to use tow truck to tow them to garage. I mean like this:
  6. Miika

    Diffrent Camera

    cameras = { {x, y, z, rx, ry, rz}; {x, y, z, rx, ry, rz}; {x, y, z, rx, ry, rz}; } local Cameramode = 0 function cameraHandler( enablecam = true timer = setTimer(function() if enablecam == true then if Cameramode == #cameras then Cameramode = 1 else Cameramode = Cameramode + 1 end setCameraMatrix(cameras[Cameramode][1], cameras[Cameramode][2], cameras[Cameramode][3], cameras[Cameramode][4], cameras[Cameramode][5], cameras[Cameramode][6]) else killTimer(timer) end end, 5000, 0) end Add this to your script. Change x, y, z, rx, ry, rz to your camera coordinates. When you want to enable camera, add cameraHandler() to your script. and when you want to disable camera, add this to your code: enablecam = false Btw, haven't tested, because I wrote this all on phone.
  7. Another method is, if you can handle html and css, you can create even better looking guis with browser. Take some examples from community scripts.
  8. Client: function getVehicleFromServer(plr) local sc = guiGridListGetSelectedItem(GUIEditor.gridlist[1]) local sctxt = guiGridListGetItemText(GUIEditor.gridlist[1], sc, 1) local plr = getPlayerFromName(sctxt) triggerServerEvent("getVeh", localPlayer, plr) end function returnVeh(vehn) guiSetText(GUIEditor.label[24], "Vehicle: "..vn) end addEvent("returnVeh_c", true) addEventHandler("returnVeh_c", localPlayer, returnVeh) Server: function getveh() local veh = getPedOccupiedVehicle(client) local vn = getVehicleName(veh) triggerClientEvent(client, "returnVeh_c", client, vn) end addEvent("getVeh", true) addEventHandler("getVeh", getRootElement(), getveh)
  9. oh, i fixed the problem. (Used getElementPosition and if)
  10. But it won't fix the problem, if someone walks in lower floor it triggers it. In my case, i have markers in smoke's crack place at drug lab and when you walk in lower floor to stairs, it triggers the marker.
  11. Hi, I have a problem. When i fly over marker that i have created, it triggers my stuff even if i don't hit the marker. Same thing happens if i go under it. Here's part of my code: for i=1, #drugs do local co = split(drugs[i][2], ", ") local col = split(drugs[i][3], ", ") marker[i] = createMarker(co[1], co[2], co[3]-1, "cylinder", 1.5, 0, 255, 255, 100) setElementInterior(marker[i], 2) setElementData(marker[i], "drugsystem:marker", i) end addEventHandler("onClientMarkerHit", resourceRoot, function(hitElement, matchingDimension) if matchingDimension == true then if not (getElementData(source, "drugsystem:marker") == false) then if (getElementType(hitElement) == "player") then if not (isPedInVehicle(hitElement)) then if (guiGetVisible(window["gui"]) == false) then markerObject = source guiSetVisible(window["gui"], true) showCursor(true) guiSetText(label["drugid"], "Drug type: " .. drugs[getElementData(source, "drugsystem:marker")][1]) guiSetText(label["duration"], "Creation time: " .. drugs[getElementData(source, "drugsystem:marker")][4] .. " seconds") guiSetText(label["effect"], "Effect: " .. drugs[getElementData(source, "drugsystem:marker")][5]) end end end end end end )
  12. Hello everybody! i'm currently scripting freeroam / rpg server. I have so much scripts, where you can make money but you can spend it only for houses, garages and weapons, so do you guys have any good script ideas for spending money?
  13. Use getElementDimension to check if player is in right dimension. Change the dimension to whatever you need. function addWeapon(leaf, amount) if (getElementDimension(localPlayer) == 2) then if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist') amount = getControlNumber(wndWeapon, 'amount') if not amount or not leaf then return end end server.giveMeWeapon(leaf.id, amount) else -- outputChatBox("You need to be at right dimension to get weapons!") end end function giveWeaponCommand(cmd, weapon, amount) if (getElementDimension(localPlayer) == 2) then weapon = tonumber(weapon) or getWeaponIDFromName(weapon) if not weapon then return end amount = amount and tonumber(amount) or 500 server.giveMeWeapon(math.floor(weapon), amount) else -- outputChatBox("You need to be at right dimension to get weapons!") end end addCommandHandler('give', giveWeaponCommand) addCommandHandler('wp', giveWeaponCommand)
  14. It means that your resource is not working correctly and gives you an error. It seems, the Mechanic and Police are trying to get your team name but you don't have same named teams in your server.
  15. Miika

    [solved]

    Thank you, matchingdimension worked perfectly. And yeah, it was hard to explain
  16. Miika

    house id

    What you mean? Zorrom just linked you list where is house interiors too.
  17. So i started making 'drug factory' script and i want to make it to crack place. I have a small problem like this: There is missing object so does anyone know the id or name of the object? I have not accidentally removed it in editor or anything.
  18. This is not requesting forum, please read rules before asking anything: https://forum.multitheftauto.com/viewtopic.php?f=91&t=47897
  19. Oh, this worked perfectly! Thank you and @GTX (used your method wrong first)
  20. --- Problem solved, code removed to make sure that somebody don't steal my script. ---
  21. Is this bug? Can't insert any values to any type of tables in serverside? I tested in clientside and insert worked perfectly.
×
×
  • Create New...