Jump to content

IIYAMA

Moderators
  • Posts

    6,063
  • Joined

  • Last visited

  • Days Won

    209

Everything posted by IIYAMA

  1. IIYAMA

    2 Questions

    if you want to use "table" which contains all table functions, you need to loop with pairs instead of ipairs. (table doesn't have a array) for index,data in pairs(table) do outputChatBox(index .. " " .. tostring(data)) end remove function: 0x421580 maxn function: 0x4219a0 insert function: 0x421800 concat function: 0x421ac0 pack function: 0x421900 unpack function: 0x4216b0 sort function: 0x4214f0 Will return all table functions + index. So now you know where the "unpack" function comes from. value1,value2,value3 = table.unpack(myTable) value1,value2,value3 = table["unpack"](myTable)
  2. IIYAMA

    2 Questions

    local theSupermarket = { "oranges", -- index 1 "apples", -- index 2 "cheese", -- index 3 "pizza", -- index 4 } for index,content in ipairs(theSupermarket) do outputChatBox("The index is: " .. index .. ", the content is: " .. content .. ", bon appetit!") end
  3. Maybe you should first correct your question before you go, , because it doesn't make sense.
  4. You need to send the spawned car(element) back to clientside(after you spawn a vehicle), so you can define the spawnCar variable. and setElementVisibleTo is a server side function. https://wiki.multitheftauto.com/wiki/Se ... tVisibleTo orange = server red = client blue = shared
  5. debug your code if it doesn't work -_-" outputDebugString(tostring(button) .. " " .. tostring(spawnCar)) anyway where is spawnCar defined?
  6. https://wiki.multitheftauto.com/wiki/On ... layerSpawn
  7. local markerTableData = destinationCoords[math.random ( #destinationCoords )] local x = markerTableData[1] local y = markerTableData[2] local z = markerTableData[3] startMarker = createMarker ( [strike]destinationCoords,[/strike] x, y, z, "cylinder", 3, 255, 255, 51 )
  8. you can cry and learn nothing or you can debugging. https://wiki.multitheftauto.com/wiki/Debugging
  9. addCommandHandler("createInvisibleBlip", function(player) local blip = createBlipAttachedTo(player, 0, 3, 200, 200, 200) outputChatBox("hide blip ".. tostring(setElementVisibleTo(blip,player,false)),player) end) Returns true, but result is incorrect. If I can't set the visibility, it should return false instead of true.
  10. Difine the variable as local, before creating the function. Local's will be active after they have been set. local initComponents addEventHandler("onResourceStart", resourceRoot, function () --[[Code... ... ...]] initComponents() end) function initComponents() -- Code... end
  11. function myFunction () end -- global access local myFunction = myFunction -- local access Well, you always can make more blocks with the same variable, can`t you? Global access for other files and a both the function. Local access for everything under the function.
  12. anyway, why are you use this variable for defining the ped that must be teleported in? Because now ped/peds will be shared with other taxi drives. and why don't you check if client1 is an element? Always keep an eye on the unpredictable. You should save everything with elementdata, tables or a database per player. Like you did on line 8. and you should debug your code before you ask again why it doesn't work. outputDebugString("It doesn't get triggered!!!! Please try again!") /debugscript 3 Here a nice example: https://wiki.multitheftauto.com/wiki/Debugging
  13. Try something like this: local markerLS = createMarker (1784.78, -1702.06, 12.50, "cylinder", 2, 255, 0, 0, 255) local blipLS = createBlipAttachedTo (markerLS, 40) local markerLV = createMarker (1074.43, 1292.71, 9.82, "cylinder", 2, 255, 0, 0, 255) local blipLV = createBlipAttachedTo (markerLV, 40) local markerSF = createMarker (-2052.80, 144.87, 27.83, "cylinder", 2, 255, 0, 0, 255) local blipSF = createBlipAttachedTo (markerSF, 40) local visibilityTable = { ["LS"]={markerLS,blipLS}, ["LV"]={markerLV,blipLV}, ["SF"]={markerSF,blipSF} } local vehicleJobSave = {} local changeVisibleJobElements = function (player,job,status) local jobTable = visibilityTable[job] if jobTable and type(status)== "boolean" then for j=1,#jobTable do local element = jobTable[j] if isElement(element) then setElementVisibleTo(element,player,status) end end end end local lsjobser = function () local carLS = createVehicle (440, 2460.52, -2004.38, 13.54) warpPedIntoVehicle(source, carLS) local lastCar = vehicleJobSave[source] if lastCar and isElement(lastCar) then destroyElement(lastCar) end vehicleJobSave[source] = carLS changeVisibleJobElements(source,"LS",true) end addEvent ("givePlayerJobLS", true) addEventHandler ("givePlayerJobLS", root, lsjobser) local moneyLS = function (attackerLS) if (attackerLS) and (attackerLS ~= source) then givePlayerMoney(attackerLS, 3000) setPlayerWantedLevel(attackerLS, getPlayerWantedLevel(attackerLS)+2) local lastCar = vehicleJobSave[attackerLS] if lastCar and isElement(lastCar) then destroyElement(lastCar) end vehicleJobSave[attackerLS] = nil changeVisibleJobElements(attackerLS,"LS",false) end end addEventHandler( "onMarkerHit", markerLS, moneyLS ) local lvjobser = function () local carlv = createVehicle (440, 2460.52, -2004.38, 13.54) warpPedIntoVehicle(source, carlv) local lastCar = vehicleJobSave[source] if lastCar and isElement(lastCar) then destroyElement(lastCar) end vehicleJobSave[source] = carlv changeVisibleJobElements(source,"LV",true) end addEvent ("givePlayerJobLV", true) addEventHandler ("givePlayerJobLV", root, lvjobser) local moneyLV = function (attackerLV) if attackerLV and attackerLV ~= source then givePlayerMoney(attackerLV, 6000) setPlayerWantedLevel(attackerLV, getPlayerWantedLevel(attackerLV)+4) local lastCar = vehicleJobSave[attackerLV] if lastCar and isElement(lastCar) then destroyElement(lastCar) end vehicleJobSave[attackerLV] = nil changeVisibleJobElements(attackerLV,"LV",false) end end addEventHandler( "onMarkerHit", root, moneyLV ) local sfjobser = function () local carSF = createVehicle (440, 2460.52, -2004.38, 13.54) warpPedIntoVehicle(source, carSF) local lastCar = vehicleJobSave[source] if lastCar and isElement(lastCar) then destroyElement(lastCar) end vehicleJobSave[source] = carSF changeVisibleJobElements(source,"SF",true) end addEvent ("givePlayerJobSF", true) addEventHandler ("givePlayerJobSF", root, sfjobser) local moneySF = function (attackerSF) if attackerSF and attackerSF ~= source then givePlayerMoney(attackerSF, 10000) setPlayerWantedLevel(attackerSF, getPlayerWantedLevel(attackerSF)+6) local lastCar = vehicleJobSave[attackerSF] if lastCar and isElement(lastCar) then destroyElement(lastCar) end vehicleJobSave[attackerSF]= nil changeVisibleJobElements(attackerSF,"SF",false) end end addEventHandler( "onMarkerHit", root, moneySF ) ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------- addEventHandler("onResourceStart",resourceRoot, function() local players = getElementsByType("player") for i=1,#players do local player = players[i] for kind,jobTable in pairs(visibilityTable) do for j=1,#jobTable do local element = jobTable[j] if isElement(element) then setElementVisibleTo(element,player,false) end end end end end) addEventHandler("onPlayerJoin",root, function () local player = source for kind,jobTable in pairs(visibilityTable) do for j=1,#jobTable do local element = jobTable[j] if isElement(element) then setElementVisibleTo(element,player,false) end end end end) addEventHandler("onPlayerQuit",root, function () local lastCar = vehicleJobSave[source] if lastCar and isElement(lastCar) then destroyElement(lastCar) end vehicleJobSave[source] = nil end)
  14. Perhaps you should try to add "not", because you are doing the opposite of what you are saying. Never use source as parameter or you will not be able to access the source element any more.(in this case the marker itself) and not isPedInVehicle(source) then You never wondering why something isn't working, don't you?
  15. They should give more priority to: onPlayerWeaponFire, since those bullets are already can be synced.
  16. hmmm, yes. Why is there a onWeaponFire event when people can't create custom weapons serverside. @-stolka- By using a timer, checking the ammo, setting the ammo.
  17. Well why don't you check if he is in a vehicle? Here you can find your solution/solutions. https://wiki.multitheftauto.com/wiki/Se ... _Functions
  18. 1. It laggs. 2. Synchronisation problems. 3. I doubt all bullets of a minigun will be synced. Since they get created every render frame.
  19. keep your patience addEventHandler ("onClientGUIClick", resourceRoot, addEventHandler ("onClientGUIClick", root,
  20. Yes ARGB, has the best quality. When I compare ARGB to DXT5, I hardly see any differences. I am not going to use DXT1 and DXT3, DXT5 fits in as replacement of ARGB. I am even recommend you it to use DXT5, in your scripts. ("large" images) Also convert the images to textures (local variables) also does speed up your lua memory and quality of textures are better then from files. Less people complaining about lagg, it is what you want. My main question was, "does it also counts for shaders". But yes it does when I think with logic.
  21. did you ever worked with time? At school? Your setup: local timeStart = getTickCount() -- get the computer time of this moment local animationTime = 3000 -- 3 seconds -- This is how long your animation would take, --futureTime = timeNow + 3000 -- the time now + 3 seconds, this is when the animation part should stop Calculate the progress:(this is when you are drawing your text) local timeNow = getTickCount() -- get the computer time of this moment local differences = timeNow - timeStart -- calculate the differences between the start time of the animation and the time now of this moment. local progress = differences/animationTime -- factor = multiplier --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- -- invert the progress? -- --progress = 1-progress ------------------------------ if progress <= 0 then -- check if the animation hasn't ended yet. local yourTextPosition = progress*distance end It is some basic math, to calculate progress. Or you can do it with a lot of timers, which I will not recommend.(and that isn't very smooth)
  22. I am not blind, I am asking this question because of the article. A shader is something I haven't much experience with, so I wanted to know that for 100% sure.
  23. --server addEventHandler("onResourceStart",resourceRoot, function () local variable = "lol" setElementData(resourceRoot,"thisIsFunny",variable) end) --client addEventHandler("onClientResourceStart",resourceRoot, function() variable = getElementData(resourceRoot,"thisIsFunny") end)
  24. triggerClientEvent setElementData
×
×
  • Create New...