Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. You could try to resave the files with ANSI or UTF-16(not sure if UTF-16 is supported in MTA) encoding.
  2. Yes it is possible. I just don't know how to do it with the shader file. But you can do it with lua: First draw the image: https://wiki.multitheftauto.com/wiki/DxDrawImage And then draw a section of the same image on top of it: https://wiki.multitheftauto.com/wiki/DxDrawImageSection
  3. If you do not want to contact the owner then it means it is leaked. I can understand that you want to get rid of me if that is the case. But even so I gave you a legal and cheap way to solve your problem and yet you call that not helping, OK. Good luck with it.
  4. Go to the owner of the script and inform him about it. You are now posting his code on the community. I am not sure if you are using a leaked version, but technically this is not allowed to be post without reference to the owner.
  5. IIYAMA

    optimize

    It looks fine to me as it is. If you want super - super optimization. You could pre-define the colors on top of the function. Not using a table on line 3, but 2 separated variables. (indexing tables cost time) Put this on top of the function: local ceiling = math.ceil Even though I do not recommend you to optimize it that far, except if you execute 100+ dx functions per frame. Scripts should stay readable. And you can also compile it to improve the performance.
  6. https://wiki.multitheftauto.com/wiki/GetSoundWaveData (There is an example included)
  7. Oh ops, misread that. What is the timer for? If you want to use the method, I would recommend you to add this: addEvent("onMapStarting", true) function setLicencePlate() setTimer(function() for k,v in ipairs(getElementsByType("player")) do local account = getPlayerAccount(v) if account and isGuestAccount(account) then return end local veh = getPedOccupiedVehicle(v) local plateText = getElementData(v, "plate") if veh and plateText and plateText ~= nil then -- if getVehiclePlateText ( v ) ~= plateText then setVehiclePlateText(veh, plateText) end -- end end end, 50, 1) end addEventHandler("onMapStarting", root, setLicencePlate) addEventHandler("onPlayerSpawn", root, setLicencePlate) addEventHandler("onPlayerJoin", root, setLicencePlate) It will save you MAX 100% network bandwidth.(that's when no plates have been changed) Even if the plate is the same as before, the server will send a message to all the clients that the value has changed. This due the fact that clients can modify this value and serverside has to overwrite it. You should compare it. Even so, it is not an efficient method > performance.
  8. It will reset the health to the max player health, which is limited by the playerstats: https://wiki.multitheftauto.com/wiki/SetPedStat (default is 100 health, but can be increased to 200)
  9. Will kill your performance and with a lot of players even your server. With this you create infinity infinity-timers. This might work better.(serverside) But you have to test if it also works the first time you set the elementdata. addEventHandler("onElementDataChange", root, function (dataName,oldValue) if dataName == "plate" and getElementType(source) == "player" then local account = getPlayerAccount(source) if account and not isGuestAccount(account) then local vehicle = getPedOccupiedVehicle (source) if vehicle then local newPlate = getElementData(source, "plate") or math.random(4000,5000) setVehiclePlateText(vehicle, newPlate) iprint("onElementDataChange, vehicle:", vehicle, ", player:", source, ", new plate:", newPlate) end end end end) --[[ Also: addEventHandler("onPlayerLogin" > set plate text ]] Else you also have to change this clientside: function visual_ButtonHandler() if source == GUIEditor.button["plate"] then local nr = guiGetText(GUIEditor.edit["plate"]) if not nr then outputChatBox("Please insert a string to use as your licence plate before clicking ok.") return end if nr == nil or nr == "" or nr == " " or nr == " " or nr == " " or nr == " " or nr == " " or nr == " " or nr == " " or nr == " " then outputChatBox("Your licence plate cannot be empty. Changed to default one. ") nr = string.sub(getPlayerName(localPlayer):gsub('#%x%x%x%x%x%x', ''), 1, 8) end local veh = getPedOccupiedVehicle(localPlayer) if veh then if getElementData(localPlayer, "LoggedIn") ~= true then outputChatBox("You need to register and login in order to set a custom licence plate!", 255, 153, 0, true) return end setVehiclePlateText(veh, nr) -- change -- if getElementData(localPlayer, "plate") == nil then setElementData(localPlayer, "plate", false) end -- setElementData(localPlayer, "savedPlate", nr) setElementData(localPlayer, "plate", nr) visual["plate"] = nr v_setSaveTimer() end end end end addEventHandler("onClientGUIClick", resourceRoot, visual_ButtonHandler)
  10. You need to respawn a player in order to reset his health.
  11. IIYAMA

    About SLUA

    Also it is not handy to give lua files different extensions, since text editors do rely on them for applying the syntax. (Even if your own editor does know what to do with it, your friends * editor might not)
  12. IIYAMA

    FPS drops

    function Switch(button,press) wep = getPedWeaponSlot(localPlayer) a= {} for z=0,12 do a[z] = exports.SMGsettings:getSetting(tostring(z)) end for z= 0,12 do if button == a[0] then if(press) then setPedWeaponSlot(localPlayer, 0) end end if a[0] == a[z+1] then addEventHandler("onClientKey", root, function (button, press) if button == a[0] then if (press) then if wep == 0 then setPedWeaponSlot(localPlayer, z+1) else setPedWeaponSlot(localPlayer,0) end end end end) end end for z= 0,12 do if button == a[2] then if(press) then setPedWeaponSlot(localPlayer, 2) end end if a[2] == a[z+3] then addEventHandler("onClientKey", root, function (button, press) if button == a[2] then if (press) then if wep == 2 then setPedWeaponSlot(localPlayer, z+3) else setPedWeaponSlot(localPlayer,2) end end end end) end end for z= 0,12 do if button == a[3] then if(press) then setPedWeaponSlot(localPlayer, 3) end end if a[3] == a[z+4] then addEventHandler("onClientKey", root, function (button, press) if button == a[3] then if (press) then if wep == 3 then setPedWeaponSlot(localPlayer, z+4) else setPedWeaponSlot(localPlayer,3) end end end end) end end for z= 0,12 do if button == a[4] then if(press) then setPedWeaponSlot(localPlayer, 4) end end if a[4] == a[z+5] then addEventHandler("onClientKey", root, function (button, press) if button == a[4] then if (press) then if wep == 4 then setPedWeaponSlot(localPlayer, z+5) else setPedWeaponSlot(localPlayer,4) end end end end) end end for z= 0,12 do if button == a[5] then if(press) then setPedWeaponSlot(localPlayer, 5) end end if a[5] == a[z+6] then addEventHandler("onClientKey", root, function (button, press) if button == a[5] then if (press) then if wep == 5 then setPedWeaponSlot(localPlayer, z+6) else setPedWeaponSlot(localPlayer,5) end end end end) end end for z= 0,12 do if button == a[6] then if(press) then setPedWeaponSlot(localPlayer, 6) end end if a[6] == a[z+7] then addEventHandler("onClientKey", root, function (button, press) if button == a[6] then if (press) then if wep == 6 then setPedWeaponSlot(localPlayer, z+7) else setPedWeaponSlot(localPlayer,6) end end end end) end end for z= 0,12 do if button == a[7] then if(press) then setPedWeaponSlot(localPlayer, 7) end end if a[7] == a[z+8] then addEventHandler("onClientKey", root, function (button, press) if button == a[7] then if (press) then if wep ==7 then setPedWeaponSlot(localPlayer, z+8) else setPedWeaponSlot(localPlayer,7) end end end end) end end for z= 0,12 do if button == a[8] then if(press) then setPedWeaponSlot(localPlayer, 8) end end if a[8] == a[z+9] then addEventHandler("onClientKey", root, function (button, press) if button == a[8] then if (press) then if wep ==8 then setPedWeaponSlot(localPlayer, z+9) else setPedWeaponSlot(localPlayer,8) end end end end) end end end addEventHandler("onClientKey", localPlayer, Switch) Adding infinity addEventHandlers, to new created functions and not clearing the Switch function block after every execution. That is what causing the lagg. Your friend should be the one posting the code. If he wants to fix his code, he should start with making a flowchart to figure out which steps he has to make to rewrite his code. Because it is extremely unoptimised and should be recreated.
  13. local playercar1 = executeSQLQuery("SELECT Model FROM vehicleSlot1 WHERE PlayerName = ?",targetAccount) if #playercar1 > 1 then local playercar1 = executeSQLQuery("SELECT Model FROM vehicleSlot1 WHERE PlayerName = ? LIMIT 1",targetAccount) if #playercar1 == 1 then LIMIT 1 = max 1 result, useful for optimisation of the queries.
  14. local playercar1 = executeSQLQuery("SELECT Model FROM vehicleSlot1 WHERE PlayerName = ?",targetAccount) if #playercar1 > 1 then outputChatBox(getVehicleNameFromModel(playercar2[1].Model),source) else outputChatBox("slot 1 empty",source) end Typo. And download a SQL viewer from internet to check your data.
  15. Press brake before hitting them, no binds required afaik. Note: You are posting on the wrong section.
  16. if col and #getElementsWithinColShape(col, "player") > 1 or getNetworkStats().packetlossLastSecond > 1 then You cannot get the elements within a colshape, if the colshape doesn't exist. So you have to check if it exist, before doing the rest. if col and #getElementsWithinColShape(col, "player") > 1 or getNetworkStats().packetlossLastSecond > 1 then
  17. IIYAMA

    Image

    Then do not scale it. But keep it the same size... If you are not satisfied with my help, then please ask somebody else to help you with this.
  18. IIYAMA

    Image

    @Tekken How is that different from the screenshots?
  19. IIYAMA

    Image

    De-increase, not increase. Which should happen when you move away. Check the screenshots. Image1 Image2 Image3 Image4 If this is not what you want, then you should rewrite the concept so I can understand what you want.
  20. IIYAMA

    Image

    This topic has the awnser:
  21. With: https://wiki.multitheftauto.com/wiki/SetWeaponOwner ? Then it is probably a bug. You could try to fix it with: https://wiki.multitheftauto.com/wiki/OnClientWeaponFire
  22. Why don't you search a little bit better? I am sure there are a lot of Ammunition scripts on the community you can edit.
  23. Login as Admin and write: /debugscript 3 Also: Check this topic, it will show you all possible debug functions.
  24. Ah thx. Everything is set up now. After testing I noticed that when I used my browser it returns the correct hostname. But for mta it returned the 'Standaardgateway' address of my router. That is obvious because I was testing it on a local server. (except for the API of course) This fixed that for me while testing, but it wouldn't work at a default server because it retrieves the server ip/hostname instead. <?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); echo $hostname; ?>
  25. That is impossible, there is always one internet packet first and after all LUA can only process one piece of code at the same time. If LUA could execute multiple pieces of the code at the exact same time, this would be devastated when the two executions influence each other.
×
×
  • Create New...