Dutchman101

Moderators
  • Content count

    1,067
  • Joined

  • Last visited

  • Days Won

    9

Dutchman101 last won the day on July 31

Dutchman101 had the most liked content!

Community Reputation

342 Superstar

About Dutchman101

  • Rank
    Global Moderator

Recent Profile Visitors

8,978 profile views
  1. why is MTA closed after adding clothes?

    I believe that clothes modding always means multi-clump DFF (like CJ skin), which is tricky to export correctly. Thus, someone who has no experience exporting multi-clump skin models, can easily generate a corrupt DFF which can lead to a MTA crash.
  2. removePedFromVehicle not sync

    Show us your full code and tests first, assuming (or the suggestion by pirulax) it's a bug is kinda hurried.
  3. pls help me with this welcoming letter

    It is.. my advice is more for general purpose.
  4. pls help me with this welcoming letter

    You can easily find the resource/piece of code responsible for anything you'd like to locate, by using certain tools. My favourite method: - download & install Notepad++ (https://notepad-plus-plus.org/download) - go to the main folder (parent to all your resource folders) and use Windows explorer to perform a file search for: *.lua like this; Depending on the size of your gamemode, all script files (.lua) will be the search result after a while. Now, select all of them (CTRL + A) and rightclick, "Edit with Notepad++". Notepad++ will take a while to open all files at the same time, again depending on the amount and size of them (trust me, it's never a hang.. just wait). The final step is, once Notepad has the files open, to press CTRL + F which is the "Find" window. Now, enter the keyword or what you need to locate in which script it is (in your case the "OMG ...arabic text.. OMG") and don't just hit enter or search, but click: "Find All in All Opened Files". It's exactly this button: Now we're done, all results from any script files are listed at the bottom of your screen, nicely sorted. Ofcourse grep is easier and quicker ('better' editors like VS code can even include similar functionality), this is just for beginners. You can use these instructions for any type of file if you change the search query in explorer (like .xml, .fx, .js, anything that can be found in resources and contains code or text). Novice tip: you could search (in Notepad++) for anything you see visually in-game (in text form) to identify the resource and part of the code responsible, just write it over from your screen or copy it. These methods are especially helpful when you're not very familiar with your codebase.
  5. Error CD16/CD09 MTA SA

    Read this about CD16 error: https://forum.mtasa.com/topic/105515-help-cd16/?do=findComment&comment=908569 https://forum.mtasa.com/topic/90317-disconnecting-for-no-reason/?do=findComment&comment=819646 https://forum.mtasa.com/topic/95511-error-cd16/?do=findComment&comment=855986 I will have to lock this topic because the problem is most often different for those getting these errors and the troubleshooting process therefore is individual. I'm planning to write a general-purpose guide on the most commonly effective fixes for the problem soon. Anyone reading this and is encountering the same problem should create a new topic to post in and get help there
  6. HELP - LOD OBJECT SCRIPT

    use SetObjectScale and setElementDoubleSided after creation.. the .map to LUA converter at http://mta.cemgokmen.com/converter/converter.php even features keeping scale and doublesizing information, for easy applying in batch. If you prefer tho, you can easily go back to using .map and utilize the LOD functionality in mapEditorScriptingExtension_s and mapEditorScriptingExtension_c (a common mistake of mappers is not retaining these files, or not using the neccesary setting "useLODs" on affected maps)
  7. HELP - LOD OBJECT SCRIPT

    The object creation is a server-side script, and it's supposed to create the objects only once. So if there is any lag at all, it would only be at the start of MTA server and before any players join, or maybe when you restart the resource due to changing something in the resource. It's not heavier than regular .map files though as far I know, so it shouldn't really have additional impact to begin with.
  8. HELP - LOD OBJECT SCRIPT

    The first 2 pages of results on https://www.google.com/search?q=mta+map+to+lua contain quite a few useful .map to lua createObject converters. I would just append the function embed and eventhandler, and automatise embedding the assignLod call; if you got a huge table of objects it's most convenient to use something like Notepad++, CTRL + F, replace tab, input (find what): "createObject" and replace with: "assignLOD(createObject" and then hit "Replace all". After that, you just add the assignLod function code at the bottom. And yes, applying assignLod to a table itself shouldn't be a problem.
  9. HELP - LOD OBJECT SCRIPT

    I don't really work with LOD's very often so not sure about your problem (could open a new topic in this section to see why something that should work isn't with your code), but I advise you to just use assignLod. Also take a look at; engineSetModelLODDistance Let me know if assignLod works out for you
  10. master list mta IP

    whitelist these IP's: 46.105.46.97 91.121.44.90 5.135.237.224 91.134.123.236 213.239.211.214 213.239.211.202 74.86.68.204
  11. Errror

    Go to your GTA installation folder > audio > streams, and replace that file with this backup: https://www.dropbox.com/s/nnvxxme2gltpysm/AA?dl=1 If that doesn't solve it, re-install GTA with a clean, unmodded version. @SoFunny
  12. MTA crash problem

    All of your recent crashes are offset 0x002FEC20 which is related to GTA engine loading/handling roadsigns. I suspect that your GTA installation contains modded roadsigns, please re-install with a clean GTA (not pre-modded). @Tank13
  13. Drift points on scoreboard

    You can add the stats to scoreboard like this; for _,v in ipairs({"Best Drift","Total Drift","Last Drift"}) do exports["scoreboard"]:addScoreboardColumn(v) end Calculate the drift scores on client, insert it to scoreboard and save the personal topscore to db (in this case preferably sqlite); connection = Connection("sqlite",":/drifttab.db") connection:exec("CREATE TABLE IF NOT EXISTS records (username TEXT, playername TEXT, score NUMBER)") Rather than a vast set of scripting functions, the code used to calculate/detect drifting is more utility-like. It's hard to point it out without looking at the complete picture, so I will just post the code of a recent drifting score resource; (you can study it to see how it calculates drifting scores) CLIENT: local screenWidth,screenHeight = guiGetScreenSize() local score = 0 local combo = 0 local multiplier = 1 local failDrift = false local size = 0.9 local fps = getFPSLimit() local vehicle local inVehicle = false local multipliers = { {100000,5}, {50000,4}, {25000,3}, {10000,2}, {0,1}, } local textX = screenWidth/2 local textY = screenHeight/4 local lineY = 45 local textScale = 0.95 local red = tocolor(255,0,0) local green = tocolor(0,255,0) local font = "bankgothic" local alignX = "center" local alignY = "center" local gui = {} local allowedType = { ["Automobile"] = true, ["Quad"] = true, ["Monster Truck"] = true, } local forcedEvents = { ["onClientElementDestroy"] = true, ["onClientPlayerWasted"] = true, } local function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1 %2') if ( k==0 ) then break end end return formatted end local function checkVehicleHandling() local flags = getVehicleHandling(vehicle)["handlingFlags"] if (bitAnd( flags, 32 ) == 32) or (bitAnd( flags, 64 ) == 64) then return true end end local function driftEnd (endscore,endcombo) local oldBestDrift = getElementData (localPlayer,"Best Drift") or 0 local oldTotalDrift = getElementData (localPlayer,"Total Drift") or 0 score = 0 combo = 0 if endscore ~= 0 then setElementData(localPlayer,"Total Drift",math.floor(endscore+oldTotalDrift)) setElementData(localPlayer,"Last Drift",math.floor(endscore)) end if endscore > oldBestDrift then setElementData(localPlayer,"Best Drift",endscore) end if endscore >= 2000 then triggerServerEvent("onDriftEnd",localPlayer,endscore) triggerEvent("onClientDriftEnd",localPlayer,endscore) end end local function calculateAngle () if not allowedType[vehicle.vehicleType] then return 0,0 end if not isVehicleOnGround(vehicle) then return 0,0 end if failDrift then return 0,0 end local vx,vy,vz = getElementVelocity(vehicle) local rx,ry,rz = getElementRotation(vehicle) local sn,cs = -math.sin(math.rad(rz)), math.cos(math.rad(rz)) local speed = (vx^2 + vy^2 + vz^2)^(0.5) local modV = math.sqrt(vx*vx + vy*vy) local cosX = (sn*vx + cs*vy)/modV if modV <= 0.2 then return 0,0 end if cosX > 0.966 or cosX < 0 then return 0,0 end return math.deg(math.acos(cosX))*0.5,speed end local function updateFPS(msSinceLastFrame) fps = (1 / msSinceLastFrame) * 1000 end local function resetFail() failDrift = false showScore=false end local function onCollide(attacker) if attacker or failDrift then return end failDrift = true driftEnd(0,0) setTimer(resetFail,2000,1) end local function drawMeter () if isWorldSpecialPropertyEnabled("hovercars") then return end if checkVehicleHandling() then return end if localPlayer.vehicle ~= vehicle then removeEventHandler("onClientVehicleDamage",vehicle,onCollide) removeEventHandler("onClientElementDestroy",vehicle,checkVehicle) removeEventHandler("onClientPlayerWasted",localPlayer,checkVehicle) removeEventHandler("onClientRender",root,drawMeter) removeEventHandler("onClientPreRender", root, updateFPS) vehicle=nil inVehicle=false checkVehicle() return end local angle,speed = calculateAngle() if isTimer (resetTimer) and angle ~= 0 then killTimer(resetTimer) showScore = true if comboReady then combo = combo + 1 comboReady = false end end if angle == 0 then if not isTimer(resetTimer) then comboReady = true resetTimer = setTimer (function() if score == 0 then return end driftEnd (score,combo) score = 0 combo = 0 showScore = false end,1300,1) end end local gameSpeed = getGameSpeed() for k,v in ipairs(multipliers) do local pointsNeeded,multi = unpack(multipliers[k]) if score > pointsNeeded then multiplier = multi break end end local fpsMultiplier = 100/fps local angleScore = angle/2 local speedScore = speed*3 local driftScore = angleScore*speedScore local addScore = math.floor(driftScore*multiplier) local gameSpeedFixedScore = math.floor(gameSpeed*addScore) score = score + math.floor(fpsMultiplier*gameSpeedFixedScore) if showScore then local color = (failDrift and red or green) dxDrawText ("Drift points x"..tostring(combo),textX,0,textX,textY-lineY,color,textScale,font,alignX,alignY) dxDrawText (score,textX,0,textX,textY,color,textScale,font,alignX,alignY) end end function checkVehicle(vehicleEntered) local isForcedFalse = forcedEvents[eventName] ~= true if localPlayer.inVehicle == inVehicle and isForcedFalse then return end local tempVehicle = vehicleEntered or getPedOccupiedVehicle(localPlayer) local seat = getPedOccupiedVehicleSeat(localPlayer) inVehicle = ((seat == 0 and allowedType[tempVehicle.vehicleType]) and (isForcedFalse and localPlayer.inVehicle or false) or false) if inVehicle and seat==0 then vehicle = tempVehicle addEventHandler("onClientVehicleDamage",vehicle,onCollide) addEventHandler("onClientElementDestroy",vehicle,checkVehicle) addEventHandler("onClientPlayerWasted",localPlayer,checkVehicle) addEventHandler("onClientRender",root,drawMeter) addEventHandler("onClientPreRender", root, updateFPS) elseif not inVehicle and vehicle then removeEventHandler("onClientVehicleDamage",vehicle,onCollide) removeEventHandler("onClientElementDestroy",vehicle,checkVehicle) removeEventHandler("onClientPlayerWasted",localPlayer,checkVehicle) removeEventHandler("onClientRender",root,drawMeter) removeEventHandler("onClientPreRender", root, updateFPS) vehicle=nil end end local function loadRecords(records,maxPosition,myAcc) guiSetText(gui.window,"Top "..tostring(maxPosition).." drifters") guiGridListClear(gui.list) local guestID = 0 for position,record in ipairs(records) do local player,score,name,isGuest = record.username,record.score,record.playername,record.isGuest if isGuest == "true" then guestID=guestID+1 if myAcc == "guest" then myAcc = hash("sha512",getPlayerSerial()) end end local row = guiGridListAddRow(gui.list,"#"..tostring(position).." "..name,(isGuest == "true" and "guest_"..tostring(guestID) or player),convertNumber(score)) if player == myAcc then guiGridListSetItemColor(gui.list,row,gui.namecolumn,0,255,0,255) guiGridListSetItemColor(gui.list,row,gui.usercolumn,0,255,0,255) guiGridListSetItemColor(gui.list,row,gui.scorecolumn,0,255,0,255) end end end local function toggleGUI() local isVisible = guiGetVisible(gui.window) if isVisible then guiSetVisible(gui.window,false) showCursor(false) else guiSetVisible(gui.window,true) showCursor(true) end end local function initScript() addEvent("onClientDriftEnd",false) addEvent("Drift:loadRecords",true) gui.window = guiCreateWindow(0.35,0.15,0.3,0.7,"",true) gui.list = guiCreateGridList(0,0.05,1,0.95,true,gui.window) gui.namecolumn = guiGridListAddColumn(gui.list,"Player",0.4) gui.usercolumn = guiGridListAddColumn(gui.list,"User",0.3) gui.scorecolumn = guiGridListAddColumn(gui.list,"Score",0.2) guiGridListSetSortingEnabled(gui.list,false) guiSetVisible(gui.window,false) bindKey("F5","down",toggleGUI) checkVehicle() addEventHandler("Drift:loadRecords",localPlayer,loadRecords) addEventHandler("onClientPlayerVehicleEnter",localPlayer,checkVehicle) addEventHandler("onClientPlayerVehicleExit",localPlayer,checkVehicle) triggerServerEvent("Drift:scriptLoaded",localPlayer) end addEventHandler("onClientResourceStart",resourceRoot,initScript) SERVER: local connection local driftRecords = {} local loadedClients = {} local recordListMaxPosition = 50 local excludedUsernames = -- Add accountnames of who you want to blacklist from ranking, like to prevent players tracking (undercover) admins through F5 (current nick + username) { ["Adminusername1"] = true, ["Test2"] = true, } local function comp(a,b) return a.score > b.score end local function checkDriftRecord(score) if not client.account then return end if excludedUsernames[client.account.name] then return end local acc = (client.account.name~="guest" and client.account.name or hash("sha512",client.serial)) local name = client.name local oldJSON = toJSON(driftRecords) local isGuest = tostring(isGuestAccount(client.account)) if driftRecords[#driftRecords] == nil or (score > driftRecords[#driftRecords].score or #driftRecords < recordListMaxPosition) then local existingPosition = false for position,record in ipairs(driftRecords) do if record.username == acc then existingPosition = position break end end if existingPosition and score > driftRecords[existingPosition].score then driftRecords[existingPosition].score = score driftRecords[existingPosition].playername = name elseif not existingPosition then table.insert(driftRecords,{username=acc,score=score,playername=name,isGuest=isGuest}) end else return end table.sort(driftRecords,comp) if #driftRecords > recordListMaxPosition then for position=recordListMaxPosition+1,#driftRecords do driftRecords[position]=nil end end if oldJSON == toJSON(driftRecords) then return end for player,_ in pairs(loadedClients) do triggerClientEvent(player,"Drift:loadRecords",player,driftRecords,recordListMaxPosition,player.account.name) end connection:exec("DELETE FROM records") for position,record in ipairs(driftRecords) do connection:exec("INSERT INTO records VALUES (?,?,?,?)",record.username,record.playername,record.score,record.isGuest) end end local function recheckPlayer() triggerClientEvent(source,"Drift:loadRecords",source,driftRecords,recordListMaxPosition,source.account.name) end local function resetPlayer() loadedClients[source] = nil end local function clientLoaded() if source~=client then return end triggerClientEvent(client,"Drift:loadRecords",client,driftRecords,recordListMaxPosition,client.account.name) addEventHandler("onDriftEnd",client,checkDriftRecord) loadedClients[client] = true addEventHandler("onPlayerLogin",client,recheckPlayer) addEventHandler("onPlayerLogout",client,recheckPlayer) addEventHandler("onPlayerQuit",client,resetPlayer) end local function initScript() connection = Connection("sqlite",":/drift.db") connection:exec("CREATE TABLE IF NOT EXISTS records (username TEXT, playername TEXT, score NUMBER, isGuest TEXT)") local handle = connection:query("SELECT * FROM records") driftRecords = handle:poll(-1) addEvent("Drift:scriptLoaded",true) addEvent("onDriftEnd",true) addEventHandler("Drift:scriptLoaded",root,clientLoaded) for _,v in ipairs({"Best Drift","Total Drift","Last Drift"}) do exports["scoreboard"]:addScoreboardColumn(v) end end addEventHandler("onResourceStart",resourceRoot,initScript) The code originates from https://community.multitheftauto.com/index.php?p=resources&s=details&id=14911, and this resource is a little different from your wishes; it does not persistently store the scores to scoreboard, but to a GUI located in F5 rankings, and moreover it offers this storing system which you didn't mention at all. It should be easy to adapt the code a little so that it saves only to scoreboard, or you could just take out the core (calculation of drift) and write the rest from scratch to your desires. Even better it would be if you just looked at it so you know how to achieve something like that, and rewrite it. You could also review & decide that the resource fullfills most of your needs and just use it. However, I would recommend you to adapt it or reproduce the utility code so you can write your own resource, in which process you can return here with any issues you stumble upon while doing so. I hope this gave you some insights on how to achieve it
  14. HELP - LOD OBJECT SCRIPT

    Useful: https://wiki.multitheftauto.com/wiki/AssignLod
  15. banik

    You'll need to 'appeal' the ban with that server's admins through any forums or communication channels with them, because over here (MTA) has no central involvement with any server's bans. Search the server name or IP:port on Google to see if they have a site or something similar on which you can contact them or appeal bans appropiately. Będziesz musiał "odwołać" się do bana z adminami serwera za pośrednictwem forów lub kanałów komunikacyjnych z nimi, ponieważ tutaj (MTA) nie ma centralnego zaangażowania w żadne zakazy serwera. Wyszukaj nazwę serwera lub adres IP: port w Google, aby sprawdzić, czy mają witrynę lub coś podobnego, na które możesz się z nimi skontaktować, lub odwołać się od banów. @zaczepisty