Jump to content

Remp

Members
  • Posts

    210
  • Joined

  • Last visited

Everything posted by Remp

  1. its treated like a gamemode because its marked as one in the meta.xml (type="gamemode"), so just change that to something more suitable ("misc" or "script" should be fine) alternatively, you could use guiCreateStaticImage and guiGetScreenSize with a little maths to create an image in the bottom corner yourself
  2. its treated like a gamemode because its marked as one in the meta.xml (type="gamemode"), so just change that to something more suitable ("misc" or "script" should be fine) alternatively, you could use guiCreateStaticImage and guiGetScreenSize with a little maths to create an image in the bottom corner yourself
  3. do you have a dual core cpu? sounds very similar to this problem: https://forum.multitheftauto.com/viewtop ... 89&t=23858 https://forum.multitheftauto.com/viewtop ... 89&t=22237 https://forum.multitheftauto.com/viewtop ... 89&t=23535 https://forum.multitheftauto.com/viewtop ... 54&t=20826
  4. move your onClientGUIClick event handler into your weedspeedtrains function. currently you are trying to add the event when the button doesnt actually exist (when the script is loaded), so it wont attach and consequently button clicks wont trigger this will also cause some issues: addEventHandler( "onMarkerHit", trainsf, weedspeedtrains ) currently that will recreate the gui every time you step into the marker (ie: if you step into the marker twice, you will have 2 guis and so on) you may want to change it so it only makes the gui visible instead
  5. Remp

    [REL] Snow 1.0.3

    This is just so people have a little more control and can toggle it on and off whenever they want. You could make the snow start automatically when you join the server with a simple edit to the code: Open snow.lua (in the unzipped snow resource folder), copy and paste this onto the bottom of the file, then save it and then restart the resource: addEventHandler("onClientResourceStart",resourceRoot,startSnow) this will automatically start the snow whenever the snow resource starts or the person joins the server you can also use the exported functions to control the snow if you wanted, but this is probably the easiest way to do it
  6. works alright for me (tested with map editor, gui editor, snow)
  7. Remp

    [REL] Snow 1.0.3

    unfortunately this is a limitation of the method i used for creating snow and i cant think of any feasible way around it. feel free to play around with code if you (or anyone) can think of a way to do it
  8. Remp

    [REL] Snow 1.0.3

    Hankey: in my experience of snow (which being a brit is about once every 3 years ) this doesnt actually happen. i did briefly toy around with writing some code to automatically generate wind patterns to give it a bit more energy, so theoretically you could add horizontal waving through the exported functions if you wanted Dragon: yes, 4:3 on youtubes HD setting looks silly, it barely takes up half the available space so i stretched it to fill a little better. currently there are no size alterations at all based on distance/perspective, id have liked to add them in but its a question of speed over features. the less things we compute every frame the higher snow density people will be able to have (this is also why things like ground detection and seeing snow through objects are not very accurate)
  9. This resource creates a fully customisable snowing effect Download: https://community.multitheftauto.com/index.php?p= ... ils&id=538 Example video (with "cartoon" type snow): To activate the snow, hold down ctrl and press s (or type /snow). Do this again to stop the snow To access and manipulate the snow settings, hold down shift and press s (or type /snowsettings) If you experience lag with snow, reduce the settings to a more comfortable level Settings: - Snow density - Snow type ("real" or "cartoon") - Snow wind direction - Snow wind speed - Snow fall speed - Snowflake size - Snowflake jitter Exported functions (clientside): - updateSnowType(type) - "real" or "cartoon" - updateSnowDensity(new_density, blend) - blend indicates whether the new density should blend into the old density, rather than just appear all at once - updateSnowWindDirection(x, y) - between 1 and 0 - updateSnowWindSpeed(speed) - updateSnowflakeSize(min_size, max_size) - updateSnowJitter(true/false) - startSnow() - stopSnow() - setGuiEnabled(enabled) - true or false (this controls whether players will have access to their own snow settings gui, also available in the meta.xml) - setSnowToggle(enabled) - true or false (this controls whether players will be able to turn the snow on and off, also available in the meta.xml)
  10. not at the moment, i will look into adding that when i get a spare few minutes
  11. getLocalPlayer() only exists clientside and this is a serverside script the easiest way is probably to just check which vehicle is triggering the event (vehicles trigger onMarkerHit as well as players): function drugboatJobMarkerHit ( hitElement, matchingDimension ) theMarkerID = getElementID (theEndMarker) if (source == theEndMarker) and ( hitElement == drugboat ) then local hitPlayer = getVehicleOccupant(hitElement,0) if hitPlayer then setPlayerWantedLevel ( hitPlayer, 6 ) ... you can use removePedFromVehicle to force the player out of the vehicle before it respawns, and you could use setVehicleLocked in onPlayerVehicleExit if they get out voluntarily to stop them getting back in you will probably also want to watch out for people jacking the boat, or the player leaving the boat and/or dying mid-way through (perhaps automatically failing and resetting the mission if you leave the boat)
  12. your drugboat variable is local, so it doesnt exist in your drugboatJob function. It also doesnt exist when you add your onVehicleEnter event handler (anything outside a function is run as soon as the code is loaded). Make your vehicle and marker variables global and move your events inside the functions that define the variables they use: ... createObject ( 3361, 4979.3408203125, -2556.3525390625, 0.24394765496254, 0, 0, 98.432006835938 ) drugboat = createVehicle ( 446, 4964.63, -2521.94, 1.92, 0, 0, 275 ) destination = createBlip ( 4964.63, -2521.94, 0, 19, 2, 255, 0, 0, 255, 0, 99999.0 ) addEventHandler ("onVehicleEnter", drugboat, drugboatJob) -- move the event handler here end end addEventHandler ( "onResourceStart", getRootElement(), Load ) ... ... function drugboatJob ( thePlayer, seat) if ( thePlayer ) and ( seat == 0 ) and ( source == drugboat ) then outputChatBox ("Deliver the drugs to the storehouse!.", thePlayer, 255, 0, 0, false) theEndMarker = createMarker ( -1862.27, -1511.58, 0, "cylinder", 16, 0, 255, 0, 90, thePlayer ) theEndBlip = createBlip ( -1862.27, -1511.58, 0, 53, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) addEventHandler ("onMarkerHit", theEndMarker, drugboatJobEnd) -- move the event handler here ... There should be no need to use getVehicleOccupant either as onVehicleEnter has player and seat parameters already try doing something like this instead: function drugboatJob ( thePlayer, seat) if ( thePlayer ) and ( seat == 0 ) and ( source == drugboat ) then outputChatBox ("Deliver the drugs to the storehouse!.", thePlayer, 255, 0, 0, false) ... you should always try debugging problems like this first, simply adding some outputChatBox lines at various points in the code will give you a better idea of where the problem lies and make solving it much easier
  13. Remp

    Writing a file

    you arent incrementing carCount, it will always be 0 so every new car you make just overwrites the previous one ... local pX, pY, pZ = getElementPosition ( player ) local pRZ = getPedRotation ( player ) if carCount <= maxCarCount then carCount = carCount + 1 -- increment the car count car[carCount] = {} car[carCount].car = createVehicle ( getVehicleModelFromName(vehicleName), pX, pY + 5, pZ + 1, 0, 0, pRZ ) ...
  14. Remp

    Writing a file

    are you sure you are properly indexing your car table? how many times do you see "File Processed"? i tried it out with my own test code and it works ok (assuming you are also using sequential numerical indexing): local car = { [1] = {car = createVehicle(432,10,10,10)}, [2] = {car = createVehicle(433,10,10,20)} } though i did notice the index in the output code will always be the total number of vehicles, so you might want to use your own variable to track the index instead. you also dont need to use car[k] in the loop, car[k] is the same as v, so you can just do v.car: ... local count = 0 for _,v in pairs ( car ) do if v.car then count = count + 1 local vx, vy, vz = getElementPosition ( v.car ) local vehName = getVehicleName ( v.car ) local realID = getVehicleModelFromName ( vehName ) fileWrite ( file, "car[" ..count.. "] = createVehicle ( " ..realID.. ", " ..vx.. ", " ..vy.. ", " ..vz.. " ) -- " ..vehName.. " \r\n" ) outputChatBox ( "File processed", player, 0, 255, 0 ) end end ...
  15. use my second suggestion then, that is how ive worked around this problem before. store whichever gui element you are hovering over in a global variable, then you can just use onClientClick and check your variable to see if you clicked on gui
  16. string.find is a function in luas string library, it isnt mta specific so it wont be covered on the mta wiki: http://lua-users.org/wiki/StringLibraryTutorial onClientClick will never detect a gui element, it only triggers on real-world entities so the error in the code you posted is probably because clickedWorld == nil, therefore you are attempting to string.find on a variable that is not a string if you want to detect clicks on a gui element you could either use onClientGUIClick, or use onClientClick but track the gui element you are on with onClientMouseEnter, onClientMouseLeave and a global variable
  17. uploaded version 2.1.0 - you can now hold down shift while creating/moving elements for "loose manipulation", the editor will stop enforcing parent border integrity allowing you (for example) to position an image partially beyond the edge of its parent - added missing "Create Image" option for tabs - added minimum element size of 5x5 to prevent accidental creation of 0x0 elements which you cannot see/select/remove - added "Parent" right click option allowing manipulation of the selected elements direct parent (even if it cannot be seen or selected normally)
  18. source in your code would be the root element, you would have to use setCameraTarget(client,client)
  19. new version uploaded with audio compression, zipped resource is now 182kb (from 340kb) https://community.multitheftauto.com/index.php?p= ... ils&id=471 i am hesitant to compress it any further because the loss of quality is quite apparent (even with the current compression), but you can always compress them further yourself if you want original quality (uncompressed) files are available here if anyone wants them
  20. This resource adds vending machine functionality, just like in single player download: https://community.multitheftauto.com/index.php?p= ... ils&id=471 Features: - buying of food/drink from all possible vending machine types - different sounds for different foods - different animations for each vending machine Vending machines can be used with the enter/exit key as normal. You must have enough money and less than full health to be able to buy from a vending machine Some vending machines may have been missed and therefore not work, if you find one please post the rough coordinates (and interior if necessary) so it can be added (you can also add it to the map file yourself) Exported functions (for full explanations see the meta file): - plotMachine(machine) - plotMachineServer(player,machine) - disableMachine(machine) - disableMachineServer(player,machine) - useVendingMachine(machine) - useVendingMachineServer(player,machine) - stopVendingMachineAnimation(local player) - stopVendingMachineAnimationServer(player) - isPlayerInFrontOfVendingMachine() - isPlayerUsingVendingMachine() Using these functions you are given full control over the vending machines in the game. You can enable or disable them as you please, enable or disable them for only specific people and create your own. All vending machine objects created by the server will, by default, be added as a working vending machine. You can set the element data "dont_plot_machine" on the object to prevent them being automatically included Events (clientside): - onClientPlayerUseVendingMachine() - called before the player begins using the machine, can be canceled to stop the machine being used (source is the player using the machine) - onClientPlayerUsedVendingMachine() - called once the player has finished using the vending machine (source is the player who used the machine) Known issues: - the first time the animation is used it may result in the animation becoming "stuck", this can be fixed by simply forcing an animation change (eg: jumping,shooting) - the fast food stands can be destroyed, but this is not synced by mta, leaving a working marker without a stand. The stand will reappear when you restream the area
  21. topics like this tend to give a very broad idea of what they actually want and most people wont like committing to a potentially huge project which they may very well not be able to honor. Nobody likes to be constrained to the timetable of internet strangers with something they do in their spare time, so offering their help whenever and wherever they reasonably can without a commitment is perfect for most people. If people come with more specific or refined problems/ideas i think others will be much more receptive, though finding someone else who has the same drive as you do for the topic at hand is quite uncommon
  22. uploaded version 2.0.1: - reverted compatibility changes made in version 2.0, all versions of guieditor should work with mta 1.0.1 (if you are still using mta 1.0 this version of guieditor will not work for you) - fixed small issue with canceling underneath right click menus of variable heights - added header slot to right click menus indicating which element you right clicked on if any problems arise as a result of this update (especially from reverting the dodgy 2.0 code) please post here or find me on irc
  23. You are also using a variable theVehicle which does not exist local player = getLocalPlayer outputChatBox("PRESSED 1") local playervehicle = getPedOccupiedVehicle ( player ) if isPedInVehicle ( player ) then local engine1 = getVehicleEngineState ( theVehicle ) ... you should be using playervehicle instead
  24. I have updated the resource to allow easy manipulation of the default commands and binds for grab/drop You can now set the names of the commands or the keys/controls you want to bind through the settings in the meta.xml to streamline the process of changing the binds should you want to The default commands/binds are now: to grab - /grab, /heligrab or your jump key to drop - /drop, /helidrop or your backspace key
  25. assuming i understand you correctly, could you not just check for other images when you show one, eg: function HighJump ( HighJumptext ) CheckOnScreenText() HighJumptext = guiCreateStaticImage(0.22,0.88,0.30,0.08,"menupic/HighJump.png",true) HighJumpTimer = setTimer ( destroyElement, 3000, 1, HighJumptext, source ) end addEvent( "HighJumpasend", true ) addEventHandler( "HighJumpasend", getRootElement(), HighJump ) function WaterJump ( WaterJumptext ) CheckOnScreenText() WaterJumptext = guiCreateStaticImage(0.22,0.88,0.30,0.08,"menupic/WaterJump.png",true) WaterJumpTimer = setTimer ( destroyElement, 3000, 1, WaterJumptext, source ) end addEvent( "WaterJumpsend", true ) addEventHandler( "WaterJumpsend", getRootElement(), WaterJump ) function CheckOnScreenText() if ( WaterJumpText ) then destroyElement ( WaterJumpText ) WaterJumpText = nil if WaterJumpTimer then killTimer(WaterJumpTimer) WaterJumpTimer = nil end end if ( HighJumptext ) then destroyElement ( HighJumptext ) HighJumptext = nil if HighJumpTimer then killTimer(HighJumpTimer) HighJumpTimer = nil end end end
×
×
  • Create New...