Jump to content

Wojak

Members
  • Posts

    321
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Wojak

  1. Well... In theory it is possible to create a web interface that would control an avatar on the server and that avatar could interact with players in some simple ways (we already have the web chats on MTA community and they've been there since forever). As for seeing what is going on on the server the simplest way would be to display players and vehicles on GTA:SA map in the web browser (there was a time when MTA had this feature by default ), this days it is even possible to force any client on the server to take a screenshot and send that to a web client (though making a high quality stream in real time is rather impossible). That said - it would be nothing like playing MTA normally.
  2. Lines 21-23 in the code in the OP: if effectAtWheels[component] and isElement(effectAtWheels[component]) then return effectAtWheels[component] end this condition will always be met, therefor the function will be terminated in the first iteration of the for loop... What it the use of the 'waterSplash' table? If you don't use it anywhere else in the code, simply remove the 21-23 lines, if you need that table then I would suggest skipping the condition and returning the whole 'effectAtWheels' table outside the for loop.
  3. Witamy na Wojnie Ulicznej Wojowniku! Oto krótkie wprowadzenie do serwera Wciśnij przycisk „Dalej” Aby przejść do następnej strony Dalej Na serwerze są 3 drużyny: - Ballas (Don't traslate this line) - Police (Don't traslate this line) - Grove Street (Don't traslate this line) Po dokonaniu wyboru po prostu podbijaj terytoria dla twojej drużyny i walcz z przeciwnikami Specjalne wydarzenia i narkotyki Narkotyki dają ci zdolności takie jak: przyśpieszenie, więcej zdrowia... Aby otworzyć panel narkotyków wciśnij F4 Narkotyki można zdobyć poprzez udział w TDM który odbywa się co godzinę w szpitalu w LS ikona na radarze Czy jesteś gotowy Wojowniku? Jeśli dalej potrzebujesz pomocy wciśnij F1! Walcz! also change 'Drugs are get' to 'You can get Drugs'
  4. i forgot to replace shader wit shaders[ i ] on lines 81 and 82...
  5. First you need to save al the shaders, at line 77: local shaders = {} at line 80 change to: shaders[i] = dxCreateShader("texture.fx") and add the toggle function: local toggle = true function toggleradar() toggle = not toggle if toggle then for i = 2, #blips_textures do engineApplyShaderToWorldTexture(shaders[i], blips_textures[i][1]) dxSetShaderValue(shaders[i], "gTexture", dxCreateTexture(blips_textures[i][2])) end else for i = 2, #blips_textures do engineRemoveShaderFromWorldTexture ( shaders[i], blips_textures[i][1] ) end end end not tested but should be ok. I don't think that this is ever a good idea...
  6. First thing that you need to accept is that programing/scripting isn't something that can be learned in one day, even though I have several years of experience in lua I learn new stuff witch each new script I create. The requirements to get starting with programing scripting are: -patience and strong will, -understanding of English language, -basic math knowledge like operations on formulas (creating own formulas, merging formulas) and logical operations . If you have all that, then all you need to know is that programing/scripting is nothing more then talking to the computer (writing commands that the computer is able to understand and execute). To do that you need to learn a programing/scripting language like lua. Like any other language it has its rues syntax and grammar (a set of keywords and the way you use them). Unlike humans computers are very stupid, you need to tell them how to do every, even most basic operation from start to finish, without making any syntax or grammar error (luckily for us the most basic stuff are already covered by build in lua and MTA functions, so it's not that hard). So the most basic stuff you need to know about any language including lua are: variables – they are containers that hold various data like numbers or text ('strings'), depending on the data stored in them you can preform any sort of operations on them – mathematical, logical, ect. If .. else .. end statement – the way to control witch part of the code will be executed depending on the conditions functions – you may think of them like smaller scripts within a script tables – you may think of them like more powerful variables, tables are VERY important I would recommend to find a good lua tutorial and start with this topics, then jump to MTA event handlers so that you will be able to test your knowledge in game.
  7. Wojak

    Race Problem

    This problem usually happens on old MTA maps that have been converted to the current format. Some converts just skip the 'rotation' property of spawnpoints that had the rotation of 0... IMO the best way to fix this i to find the line in race_server.lua vehicle = createVehicle(spawnpoint.vehicle, x, y, z, 0, 0, spawnpoint.rotation, plate:sub(1, 8)) and add this just before that line: if not spawnpoint.rotation then spawnpoint.rotation = 0 end
  8. This information should be in the opening post, it's your fault that this problem is not solved yet... delete line 14 change line 15 to local speed = 0.5 Predicting your future problems: - its to slow/fast – change 0.5 to different value - I need to tap s for it to work – use onClientRender or setTimer + detecting if the key is pressed - I want it to accelerate – use math to change the value of speed based on the current conditions good luck.
  9. woops... function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z end function backwards() if isPedInVehicle (localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) if getElementModel(veh) == 498 then toggleControl ( "brake_reverse", false ) local x,y,z = getElementPosition(veh) local vx,vy,vz = getElementVelocity(veh) local speed = (vx^2 + vy^2 + vz^2)^0.5 vx,vy,vz = getPositionFromElementOffset(veh,0,-speed,0) setElementVelocity(veh,vx-x,vy-y,vz-z) end end end bindKey("s", "down", backwards)
  10. function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z end function backwards() if isPedInVehicle (localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) if getElementModel(veh) == 498 then toggleControl ( "brake_reverse", false ) local vx,vy,vz = getElementVelocity(veh) local speed = (vx^2 + vy^2 + vz^2)^0.5 vx,vy,vz = getPositionFromElementOffset(veh,0,-speed,0) setElementVelocity(veh,vx,vy,vz) end end end bindKey("s", "down", backwards)
  11. Not tested, but I think that you can exploit the CEF to download some files directly (website - > client): Images: local webBrowser = createBrowser(Width, Height, false, false) -- Width, Height of the image addEventHandler("onClientBrowserCreated", webBrowser, function() loadBrowserURL(webBrowser, "http://direct_hotlink_to_image.png") --note that at this point the user will likely revive a dialog to whitelist the domain, and the rest of the script will fail if he doesn't... --also there will be problems if the hosting site contains adds... end) addEventHandler ( "onClientBrowserDocumentReady" , root , function ( url ) --domain already whitelisted if source == webBrowser then encodeImage() end end) addEventHandler ( "onClientBrowserWhitelistChange" , root , function( url ) --domain whitelisted by the user if source == webBrowser then encodeImage() end end) function encodeImage() local data = dxGetTexturePixels(webBrowser) destroyElement(webBrowser) local newImg = fileCreate('img.png') fileWrite(newImg, data) fileClose(newImg) end Small text files (less then 2mb): local webBrowser = createBrowser(Width, Height, false, false) -- Width, Height do not matter addEventHandler("onClientBrowserCreated", webBrowser, function() loadBrowserURL(webBrowser, "http://direct_hotlink_to_file.txt") --note that at this point the user will likely revive a dialog to whitelist the domain, and the rest of the script will fail if he doesn't... --also there will be problems if the hosting site contains adds... end) addEventHandler ( "onClientBrowserDocumentReady" , root , function ( url ) --domain already whitelisted if source == webBrowser then getBrowserSource(webBrowser, encodeFile(code)) end end) addEventHandler ( "onClientBrowserWhitelistChange" , root , function( url ) --domain whitelisted by the user if source == webBrowser then getBrowserSource(webBrowser, encodeFile(code)) end end) function encodeFile(code) destroyElement(webBrowser) local newtxt = fileCreate('test.txt') fileWrite(newtxt, data) fileClose(newtxt) end
  12. The GTA:SA engine was newer designed to support more then one camera, so making a perfect mirror is not possible even with the Ren's script. The only idea tat come's to mind should allow to simulate left or right side mirror with full FPS and no sound issues (but testing is required): 1) You set the camera matrix to its max FOV (180) and rotate the center of viewpoint until the left (or right) side of the 180 viewpoint would show the same as 70(default) viewpoint. 2) You get the screen source. 3) You create two render targets (one full screen and one for the mirror). 4) You cut the 70/180% of the screen source from the left (or right depending on the rotation from step one), you stretch it and draw on the full screen render target 5) You cut some from the other side of the screen source and draw it to the other render target. I don't know if you understand what I mean, but in theory this should work, but there may be some other problems witch this (stretched default HUD, low quality dune to stretching and such).
  13. The script in that video was a concept made back in 2011! with many flaws, you can download the source code if you haven't yet: https://community.multitheftauto.com/index.php?p= ... ls&id=2870 There where no shader functions in it, I just wanted to find a use for dxCreateScreenSource. The main problem is that you have to devote some frames to simulate the second camera, and you need a way to render the correct image in the right place (I used 2 render targets, one is full screen and the other is the mirror)
  14. I think this should be all the files: https://dysk.onet.pl/link/EL6q2 I downloaded this about 10 months ago.
  15. http://2paq.byethost11.com/news.php This website displays in everything except MTA CEF, and i tested other website on this domain - the same problem... EDIT: Well - problem solved (for good I hope) all I needed to do was to change the hosting... So I DO NOT recommend byethost to anyone!
  16. If there is a global blacklist is it available somewhere? Sine last update my forum doesn't load in MTA CEF (id dos work in all other web browsers) 403 Forbidden nginx this problem is for all web sites on byethost11.com domain...
  17. Well there is an alternative way do make persistent, synced non player trains, and since it doesn't use the default MTA train system, it can work with custom train tracks as well: https://wiki.multitheftauto.com/wiki/MoveObject Yes I know - “You can't move vehicles using moveObject directly” However (in case of trains) You can derail a train, attach it to an transparent object without collisions and move that object. Doing it server side makes for almost perfect sync. This is a very old function that I've used in some projects: function bot:serverAI() if isElement(self.obj) then warpPedIntoVehicle(self.ped,self.veh) local x,y,z = getElementPosition(self.obj) local rx,ry,rz = getElementRotation(self.obj) local tx,ty,tz = getElementPosition(self.way) local waypointangle = ( 360 - math.deg ( math.atan2 ( ( tx - x ), ( ty - y ) ) ) ) % 360 local speedlimit = getElemetData(self.way,"speedlimit") local hangle = ( 360 - math.deg ( math.atan2 ( ( tx - x ), ( tz - z ) ) ) ) % 360 setElementRotation (self.obj,hangle,ry,waypointangle) local distance = getdistanceBetweenPoints3D(x,y,z,tx,ty,tz) local time = (10*distance)/(36*speedlimit) moveobject(self.obj,time,tx,ty,tz+1) setTimer(function(tab) if isElement(tab.obj) then local tempwayid = getElemetData(tab.way,"next_waypoint") or "" local tempway = getElementById(tempwayid) if not iselement(tempway) then tempwayid = getElemetData(tab.way,"master_waypoint") or "" tempway = getElementById(tempwayid) end tab.way = tempway tab:serverAI() end end,time+50,1,self) end end used in this video for handling vehicles without syncers: If you look at the most distant vehicles you may notice the transition between handling by server and handling by client. To use with train I think it should be handled 100% server side. The one thing that needs to be done is a path recording tool to create the waypoints (nodes). This uses one timer and moveObject function per vehicle at ay given time (may get problematic with thunders of vehicles but 15 trains x 6 wagons should be stable), the calculations are similar but executed per node, not per frame, and the sync is handled 100% by MTA.The acceleration can be simulated using strEasingType argument in moveObjest.
  18. Thank You, You've put me on the right track This solved the problem: https://wiki.multitheftauto.com/wiki/On ... rceBlocked The default webbrowser resource doesn't handle this event... (adverts may be the reason why...) Anyway this is what I did: --in "WebBrowserGUI:constructor()" addEventHandler("onClientBrowserResourceBlocked", root, function(...) self:Browser_BrowserResourceBlocked(...) end) --in "WebBrowserGUI:Browser_WhitelistChange(whitelistedURLs)" at the beginning of the function if self.m_RequestedURL == "" then self.m_RequestedURL = self.m_Browser:getBrowser():getURL() self.m_Browser:getBrowser():loadURL(self.m_RequestedURL) self.m_RequestedURL = "" return end --in main chunk local blacklist = {["partner.googleadservices.com"]=true} -- this blocks the most annoying adverts on free forums function WebBrowserGUI:Browser_BrowserResourceBlocked(url, domain, reason) local isBlocked = isBrowserDomainBlocked(url) if isBlocked and not blacklist[domain] then Browser.requestDomains({url}, true) return end end
  19. Facebook web page is not displaying properly in the browser build in MTA (it looks like all the HTML generated by javascript is missing). All other pages seem to work, and the domain is whitelisted. Also the page works fine in stand alone Chrome. I'm using Windows 7 x64 and found one more user with the same system and same problem. Since I didn't see this problem listed on bug tracker and I doubt that I'm the only one that tried to open facebook in MTA, this may by a rare bug...
  20. Thank You but it's not THAT hard, all you need is time to do it Yes it would, but the only thing that's stops me is the lack of assets. However i may thy to do it someday.
  21. This is my first attempt at HTML/javascript, the core of the site is based on the default scoreboard resource by Awwu http://88.199.98.89:23204/woj_mapselect/ features: -columns Map name, Author, Top Time, Likes, Dislikes, Played and laps with sorting buttons. -ability to search by map name and author, -ability to display full top time list (also best laps list - if a map with laps is added to the system), -ability to preview the map (shows spawn, finish and the track layout). all the features (except the map preview) are also accessible on the server when using /maps or /votemap command. I'm ok with people using the source code for their own projects, i only ask to mention both me and Awwu when releasing resources with this code. Note - since the site is accessible by anyone, I've made some server side limits, so you may sometimes get a "Try again in ... s" message.
  22. Just ignore the previous post... function requestVehicleHide(player,vehicle) if isGuestAccount(getPlayerAccount(player)) then return end --[some code] end function preRequestVehicleHide(vehicle) requestVehicleHide(source,vehicle) end addEventHandler ("onPlayerLogout", root, preRequestVehicleHide) addEventHandler ("onPlayerQuit", root, preRequestVehicleHide) addEventHandler ("requestVehicleHide", resourceRoot, requestVehicleHide) "onPlayerLogout" and "onPlayerQuit" can not be attached to "resourceRoot" Sorry if I got you confused
  23. POST EDITED my previous answer (in this post) was wrong... Apparently You can just use "client" instead of "source" and it should work (for player events anyway) https://wiki.multitheftauto.com/wiki/AddEventHandler
  24. I' guessing that you trigger the event like this: triggerServerEvent("onVehicleBuyRequest",getLocalPlayer(),model, price, px, py, pz, rx, ry, rz ) The problem is that playrs are never the children of “resourceRoot” but only “root” so using “resourceRoot” is almost like not adding the event... The solution: Client: triggerServerEvent("onVehicleBuyRequest",resourceRoot,getLocalPlayer(),model, price, px, py, pz, rx, ry, rz ) Server: addEvent("onVehicleBuyRequest", true) 1.addEventHandler("onVehicleBuyRequest", resourceRoot, function(the_player,model, price, px, py, pz, rx, ry, rz) 2. local veh = createVehicle (model, px, py, pz, rx, ry, rz) 3. --[blah blah blah] 4. outputChatBox ("Congratulations! You bought a ".. getVehicleNameFromModel(model) .."! Press F2 to see it!", the_player) 5.end) Note that in this case the Player is not longer the source of the event(Resource is used instead) so we need to add the aditional paramater to represent the player (the_player).
  25. If You are on Windows: open MS Paint Colors - > edit colors - > define custom color then you just play with the sliders
×
×
  • Create New...