Jump to content

[DooD]Heavyair

Members
  • Posts

    264
  • Joined

  • Last visited

Everything posted by [DooD]Heavyair

  1. thanx for your reply TMA i have got this working ( hurray ) it detects player inside collision sphere and repeatedly fires until u leave collision sphere. it gives two errors in debugscript 3 one is event allready handled which i think is because the removeEventHandler isnt right second is attempt to call nil value when it stops firing but i think that is the removeEventHandler again but it works and it looks pretty cool. i will try and do some screenshots but it shoots pretty fast. the only way i could get isElementWithinColShape to work was by making collision spheres for client and server but it doesnt seem to be a problem. i am going to try and get the rest of the sam sites firing now ( maybe add some hidden / pop up ones ) server side area69samsphere = createColSphere ( 354, 2027, -10, 150 ) function setarea69samsite ( player ) setElementPosition ( area69samsphere, 354, 2027, 25 ) outputChatBox ( "Ready To Fire" ) end function area69samtargeting ( player, matchingDimension ) if ( getElementType ( player ) == "player" ) then triggerClientEvent ( player, "onarea69samfire", getRootElement() ) end end addCommandHandler ( "sam69", setarea69samsite ) addEventHandler ( "onColShapeHit", area69samsphere, area69samtargeting ) client side previousTick = getTickCount() area69samfiredelay = 500 area69samsphere = createColSphere ( 354, 2027, 25, 150 ) function area69samsitefire ( player, matchingDimension ) detection = isElementWithinColShape ( getLocalPlayer(), area69samsphere ) if detection == true then if ( getTickCount () > previousTick + area69samfiredelay ) then local px,py,pz = getElementPosition ( getLocalPlayer() ) local glow1 = createMarker ( 353, 2030, 30, "corona", 5, 255, 0, 0, 150 ) local shot1 = createObject ( 3106, 353, 2030, 30 ) attachElementToElement ( glow1, shot1, 0, 0, 0 ) setTimer ( moveObject, 50, 1, shot1, 500, px, py, pz ) setTimer ( destroyElement, 570, 1, shot1 ) setTimer ( destroyElement, 570, 1, glow1 ) setTimer ( createExplosion, 550, 1, px, py, pz, 0 ) previousTick = getTickCount() end end end function area69samtarget () addEventHandler ( "onClientRender", getLocalPlayer(), area69samsitefire ) setTimer ( removeEventHandler, 3500, 1, "onClientRender", getLocalPlayer(), area69samsitefire ) end addEvent ( "onarea69samfire", true ) addEventHandler ( "onarea69samfire", getLocalPlayer(), area69samtarget )
  2. after looking through the LUA tutorials for MTA i saw a function using a WHILE command. i dont know where to look to find out if i can use this command or how i can use it. it looks to me like the easiest way to get the samsite to repeatedly fire would be to use the While command for something like While player is within collision sphere then do the sam site fire function anybody know where to look or even how to use this command thanx for any help
  3. maybe call a function that uses setTimer to do the engineImportTXD and DFF . if u call it with onPlayerJoin and give it a 20 - 30 second delay it might work. u could even set a second timer to do it again 5- 10 seconds later to get past the sometimes white car issue. ill give it a go when i have time ( hopefully tonight )
  4. this scripting stuff is getting to be quite fun the script works but it only fires once ( trying to figure out multiple shots at the moment ) here u go server side area69samsphere = createColSphere ( 354, 2027, -10, 150 ) function setarea69samsite ( player ) setElementPosition ( area69samsphere, 354, 2027, 25 ) outputChatBox ( "Ready To Fire" ) end function area69samtargeting ( player, matchingDimension ) if ( getElementType ( player ) == "player" ) then triggerClientEvent ( player, "onarea69samfire", getRootElement() ) end end addCommandHandler ( "sam69", setarea69samsite ) addEventHandler ( "onColShapeHit", area69samsphere, area69samtargeting ) client side local previousTick = getTickCount() local area69samfiredelay = 500 function onClientRender ( player ) if ( getTickCount () > previousTick + area69samfiredelay ) then local px,py,pz = getElementPosition ( getLocalPlayer() ) local glow1 = createMarker ( 353, 2030, 30, "corona", 5, 255, 0, 0, 150 ) local shot1 = createObject ( 3106, 353, 2030, 30 ) attachElementToElement ( glow1, shot1, 0, 0, 0 ) setTimer ( moveObject, 50, 1, shot1, 500, px, py, pz ) setTimer ( destroyElement, 570, 1, shot1 ) setTimer ( destroyElement, 570, 1, glow1 ) setTimer ( createExplosion, 550, 1, px, py, pz, 0 ) previousTick = getTickCount() end end addEvent ( "onarea69samfire", true ) addEventHandler ( "onarea69samfire", getLocalPlayer(), onClientRender ) will post changes when i have multiple shots working thanx again ACE_GAMBIT EDIT::: im a bit confused about how to make the function loop so that it fires at u more than once. i thought that it would detect player hitting collision sphere then fire and then continue checkin the tick count and then fire again after 500ms. i tried using onClientRender to repeatedly do the check on tick count but it just created explosions as soon as i joined the server. i will keep trying though
  5. awesome thank u ACE_GAMBIT i remembered seeing that in one of your previous posts but couldnt remember it exactly to find it on wiki i think that should be perfect
  6. i am trying to make my own take on the sam site script but when i use onClientRender to fire the sam site things go a bit wrong. everything works fine but i cant stop the explosions and it fires way to fast with onClientRender is there a way of repeatedly firing without using onClientRender or loads of setTimers. oh well here is the script. server side area69samsphere = createColSphere ( 354, 2027, -10, 150 ) function setarea69samsite ( player ) setElementPosition ( area69samsphere, 354, 2027, 25 ) outputChatBox ( "Ready To Fire" ) end function area69samtargeting ( player, matchingDimension ) if ( getElementType ( player ) == "player" ) then triggerClientEvent ( player, "onarea69samfire", getRootElement() ) end end addCommandHandler ( "sam69", setarea69samsite ) addEventHandler ( "onColShapeHit", area69samsphere, area69samtargeting ) client side function area69samfiring ( player ) local px,py,pz = getElementPosition ( getLocalPlayer() ) local glow1 = createMarker ( 353, 2030, 30, "corona", 5, 255, 0, 0, 150 ) local shot1 = createObject ( 3106, 353, 2030, 30 ) attachElementToElement ( glow1, shot1, 0, 0, 0 ) setTimer ( moveObject, 50, 1, shot1, 500, px, py, pz ) setTimer ( destroyElement, 570, 1, shot1 ) setTimer ( destroyElement, 570, 1, glow1 ) setTimer ( createExplosion, 550, 1, px, py, pz, 0 ) end function area69samfire ( player ) addEventHandler ( "onClientRender", getLocalPlayer(), area69samfiring ) setTimer ( removeEventHandler, 1000, 1, "onClientRender", getLocalPlayer(), area69samfiring ) end addEvent ( "onarea69samfire", true ) addEventHandler ( "onarea69samfire", getLocalPlayer(), area69samfire ) i am just messing around with scripting at the moment trying to get an idea of what im doing while i wait for the map editor to come out. any help appreciated. thanx for l kin
  7. thanx 50P i just tried it like this but same result function sayit ( player ) inthebox = textCreateTextItem ( "YEEeee HAAAwwww!!", 0.5, 0.5, 2, 255, 0, 0, 1.0, center, center ) thebox = textCreateDisplay () textDisplayAddText ( thebox, inthebox ) textDisplayAddObserver ( thebox, player ) setTimer ( textDestroyDisplay, 3000, 1, thebox ) end addCommandHandler( "saysomething", sayit ) i have been looking at a number of resources ( deathmessages / killmessages / stunt ) and they all seem to create the text display when the player joins or resource starts and then use a ( field or array not sure what its called ) to fill in the text. would i be better off trying it like that. oh well ill give it a go and see what happens EDIT::: managed to get this working thebox = textCreateDisplay () inthebox = textCreateTextItem ( "YEEeee HAAAwwww!!", .5, .5, "low", 255, 0, 0, 255, 1.0, "center" ) function sayit ( player ) textDisplayAddText ( thebox, inthebox ) textDisplayAddObserver ( thebox, player ) setTimer ( textDestroyDisplay, 3000, 1, thebox ) end addCommandHandler( "saysomething", sayit ) text is quite small though so if anyone wants to use it u will probably want to make it bigger ( im about to do so myself ) EDIT 2::::: and at last the fully working THRILLCAM screenshots http://www.fileshack.us/get_file.php?id=900341&file=mta-screen0003.png http://www.fileshack.us/get_file.php?id=986821&file=mta-screen0004.png http://www.fileshack.us/get_file.php?id=523180&file=mta-screen0005.png and script server side thrillcammarker = createColSphere ( -724, 693, -200, 5 ) local root = getRootElement() local thebox = textCreateDisplay () inthebox = textCreateTextItem ( "YEEeee HAAAwwww!!", .5, .5, "low", 255, 0, 0, 150, 4.0, "center" ) function setcam ( element ) setElementPosition ( thrillcammarker, -724, 693, 20 ) outputChatBox ( "1" ) end function thrillcam ( player ) triggerClientEvent ( player, "oncamtest", getRootElement () ) setTimer ( setElementPosition, 1000, 1, thrillcammarker, -724, 693, -200 ) textDisplayAddText ( thebox, inthebox ) textDisplayAddObserver ( thebox, player ) setTimer ( textDisplayRemoveObserver, 3000, 1, thebox, player ) setGameSpeed ( 0.3 ) setTimer ( setGameSpeed, 4000, 1, 1.0 ) outputChatBox ( "2" ) end addEventHandler ( "onColShapeHit", thrillcammarker, thrillcam ) addCommandHandler ( "startcamera", setcam ) client side local root = getRootElement() local localPlayer = getLocalPlayer () local update = false function camTrack() setCameraLookAt(getElementPosition(getLocalPlayer())) end function camTrackOn() addEventHandler("onClientRender",getLocalPlayer(),camTrack) end function camTrackOff() removeEventHandler("onClientRender",getLocalPlayer(),camTrack) end function camTrackStart(duration) local x,y,z = getElementPosition(getLocalPlayer()) toggleCameraFixedMode(false) toggleCameraFixedMode(true) setTimer(setCameraPosition, 50, 1, -717, 710, 20 ) setTimer(camTrackOn,100,1) setTimer(camTrackOff,duration - 100,1) setTimer(toggleCameraFixedMode,duration,1,false) end function camteset() camTrackStart(5000) end addEvent ( "oncamtest", true ) addEventHandler ( "oncamtest", getLocalPlayer(), camteset ) with debugscript 3 on i get no errors so it should be ok to run for everyone forgot to add the ramp put this line in your map file <object model="16303" posX="-740.47650146484" posY="700.71752929688" posZ="13.409936904907" rotX="359.5" rotY="0" rotZ="350"/>
  8. the camera is working great now ( thank u so much guys ) the falling through the world thing isnt a problem now ( turned the time down to 5 seconds ) it still happens but the way im using it the camera resets before you get to the point where u fall through the world ( awesome ) i am now trying to display a text message on screen when the camera change is triggered but i cant get it workin. i have written an extra function just to see if i could get the text workin and i was going to add it to the camera change function later. here is what ive got so far server code only function sayit ( player ) thebox = textCreateDisplay () inthebox = textCreateTextItem ( "YEEeee HAAAwwww!!", 0.5, 0.5, 2, 255, 0, 0, 1.0, center, center ) textDisplayAddObserver ( thebox, player ) textDisplayAddText ( thebox, inthebox ) setTimer ( textDestroyDisplay, 3000, 1, thebox ) end addCommandHandler( "saysomething", sayit ) it doesnt give me any errors but no text either. i have been looking through the forums ( theres loads of threads about text ) but i cant find one about just displaying a simple message to screen. all i want it to do is say "YEEeee HAAAwwww!!" in middle of screen and then disappear after 3 seconds. i am going to trigger it at the same time as the camera change so when you do the jump game slows down / camera changes / it prints YEEeee HAAAwwww!! as your jumping / then camera returns and game speeds up . i did notice this in another thread but i dont know if this is what im missing. not sure about the setElementData part ( do i need it ) because there is no mention of it in the wiki example. as always any help appreciated
  9. thanx guys thats pretty cool ill see what i can do EDIT ::: just had a quick look at the wiki and INTERIORS resource. i think this might be a bit out of my league at the moment. couldnt see an example / function for interiors on the wiki so i think i will just keep waiting for DP3 map editor and ill build an island somewhere. EDIT 2::: sorry i have found the interiors example on the wiki now
  10. TALIDAN when you say use interiors what exactly do u mean ( i have never messed with interiors before ). if it is really complicated dont worry to much about a reply but if its not to complex could u give me an idea of how i would do this. i have read a few threads about warping into interiors and other people using them for bank / food / and mod shop scripts but i dont really know what u do with them ( or even how to find them ). thanx for any replys
  11. that is AMAZING TMA thank u very much. how on earth did u figure that out. it still gives the problem with falling through the world but when camera resets everything is fine again. i cant imagine how you got this workin. once again THANK U SO MUCH you have made my day.
  12. thanx for the reply ACE_GAMBIT i have just tried it without the onClientRender and it works but the camera doesnt look at the player. on the wiki there are two rotate camera functions ( thought that might work better than setCameraLookAt ) but when i try to view them it says this does this mean i cant use it or is there just no example yet. i was also looking at setCameraTarget but it looks like that would just follow the player as normal ( and id need extra player ) is there any way around this ( possibly in DP3 / maybe even PED CAMs ) forgot to put the script in LOL client side local root = getRootElement() local localPlayer = getLocalPlayer () local update = false function changeCamera() local x, y, z = getElementPosition ( localPlayer ) if ( update == false ) then update = true toggleCameraFixedMode ( true ) setCameraPosition ( -681, 662, 18 ) setCameraLookAt ( x, y, z ) setTimer ( toggleCameraFixedMode, 3000, 1, false ) else update = false toggleCameraFixedMode ( false ) end end addEvent ( "onchangeCamera", true ) addEventHandler ( "onchangeCamera", getRootElement (), changeCamera ) i have also tried putting a timer on setCameraLookAt ( 1 tenth of a second ) just to see if it didnt like me trying to setCameraPosition and setCameraLookAt at the same time but no difference EDIT ::: i just tried using rotateCameraRight but it doesnt have an example on the wiki so im not sure if i have syntax right does anyone know how to use rotateCamereaRight and rotateCameraUp.
  13. i am trying to create a thrill camera ( like in stuntman ps2 ) this is the script server side thrillcammarker = createColSphere ( -724, 693, -200, 5 ) function setcam ( element ) setElementPosition ( thrillcammarker, -724, 693, 20 ) outputChatBox ( "1" ) end function thrillcam ( element ) triggerClientEvent ( element, "onchangeCamera", getRootElement () ) setTimer ( setElementPosition, 1000, 1, thrillcammarker, -724, 693, -200 ) setGameSpeed ( 0.3 ) setTimer ( setGameSpeed, 3000, 1, 1.0 ) outputChatBox ( "2" ) end addCommandHandler ( "startcamera", setcam ) addEventHandler ( "onColShapeHit", thrillcammarker, thrillcam ) client side local root = getRootElement() local localPlayer = getLocalPlayer () local update = false function updateCameraPos() local x, y, z = getElementPosition ( localPlayer ) setCameraLookAt ( x, y, z ) end function changeCamera() if ( update == false ) then update = true toggleCameraFixedMode ( true ) setCameraPosition ( -681, 662, 18 ) addEventHandler ( "onClientRender", root, updateCameraPos ) setTimer ( toggleCameraFixedMode, 3000, 1, false ) else update = false toggleCameraFixedMode ( false ) removeEventHandler ( "onClientRender", root, updateCameraPos ) end end addEvent ( "onchangeCamera", true ) addEventHandler ( "onchangeCamera", getRootElement (), changeCamera ) and here are some screenshots to help explain http://www.fileshack.us/get_file.php?id=377157&file=mta-screen0040.png the collision sphere that changes camera and sets game speed is at the top of the ramp http://www.fileshack.us/get_file.php?id=529932&file=mta-screen0041.png this is where u land after the jump and is safe to drive on but if u go a little further down the road this happens http://www.fileshack.us/get_file.php?id=257015&file=mta-screen0050.png u just fall straight through like there is no road. this only happens after you have hit the collision sphere and the camera is moved and put back on the player. if i just type the command startcamera but dont hit the collision sphere every thing is fine. i have tried driving cars and bikes and planes and even the jetpack but everything falls through the ground and trees and buildings are no longer solid either. i havent tested the whole map but it seems everything beyond where i set the camera is gone and everything before where i set the camera is ok ( even the water ) i think this is a really cool script and the results ( when they work ) are pretty neat. another issue i have with this is that the camera change only works every other time you use it. if i join the game and type startcamera then hit collision sphere it puts the camera in a totally different place ( the farm i think ) and the second time it works properly but the third time game slows down i get chatbox message "1" but no camera change but the fourth time it works perfect and from there on it works every other time. i have tried to test it as much as i could but i dont know what else to try. i can live with it not working perfect every time but the non solid world is a major problem LOL any help / ideas really appreciated thanx
  14. you have to load the new TXD and DFF twice and that usually does the trick if you search the forums for TXD and DFF its all explained
  15. have you checked the ip you use to access the router ( mines 192.168.2.1 but i dont know if thats universal ) with the manufacturers website. as soon as you login it should display your internet ip address which is what your friend needs to join with
  16. what is the engineReplaceModel for. i have a number of modded vehicles running but i have only needed engineReplaceTXD and engineReplaceDFF and mostly they work ( have found a few that dont ). im very new to scripting and was just wondering if i might need to replace model to get the not working vehicles to load ( sorry to butt in on your thread )
  17. <config> <!-- This parameter specifies the name of the server, visible in the ingame server browser or in ASE. It's a required parameter. --> <servername>[DooD]'s Freeroam Fun</servername> <!-- This parameter specifies the IP address on which the server. It's useful for servers which have multiple IP addresses attached to them. If left blank, it will default to server's standard local IP. --> <serverip></serverip> <!-- This parameter specifies the Maximum Transmission Unit or maximum packet size that the server will use. This will depend on the nature of your clients, as well as the network medium your server is connected to. --> <mtusize>1264</mtusize> <!-- This parameter specifies the UDP port on which the server will be accepting incoming player connections; default value: 22003. It's a required parameter. --> <serverport>22004</serverport> <!-- This parameter specifies the number of maximum player slots available on the server; default value: 32. It's a required parameter. --> <maxplayers>16</maxplayers> <!-- This parameter specifies whether the builtin http server is going to be used. Values: 0 - disabled , 1 - enabled ; default value: 1. Optional parameter. --> <httpserver>1</httpserver> <!-- This parameter specifies the TCP port on which the server will be accepting incoming http connections. It can be set to the same value as <serverport>. It's a required parameter if <httpserver> is set to 1. --> <httpport>22005</httpport> <!-- This parameter specifies whether connecting players will be able to download needed resources for them from an external site rather than from the server. 0 - disabled , 1 - enabled; default value: 0. --> <httpdownload>1</httpdownload> <!-- If set, this parameter specifies the external URL from which clients will be able to download needed resources ingame. Required parameter if <httpdownload> is set to 1. --> <httpdownloadurl></httpdownloadurl> <!-- This parameter can be used to make the server report to ASE master servers, allowing it to be visible in the ingame server browser. An additional UDP port needs to be available for this to work (value from <serverport> + 123 , so on a default <serverport> value 22003 the right port will be 22126 ). Available values: 0 - disabled , 1 - enabled. Optional parameter, defaults to 0. --> <ase>0</ase> <!-- If set, players will have to provide a password specified below, before they can connect to the server. If left blank, server doesn't require a password from them. --> <password></password> <!-- Specifies a location and name of the main server log file. If left blank, server won't be saving this file. --> <logfile>logs/server.log</logfile> <!-- This parameter specifies a location and name of the Access Control List settings file. If left blank, server will use acl.xml file. --> <acl>acl.xml</acl> <!-- Specifies a location and name of the debugscript log file. If left blank, server won't be saving this file. --> <scriptdebuglogfile>logs/scripts.log</scriptdebuglogfile> <!-- Specifies a level of the debugscript log file. Available values: 0, 1, 2, 3. When not set, defaults to 0. --> <scriptdebugloglevel>0</scriptdebugloglevel> <!-- Specifies a level of the html debug. Available values: 0, 1, 2, 3. When not set, defaults to 0. --> <htmldebuglevel>0</htmldebuglevel> <!-- Specifies the module(s) which are loaded with the server. To load several modules, add more <module> parameter(s). Optional parameter. --> <!-- <module>sample_win32.dll</module> --> <!-- <module>sample_linux.so</module> --> <!-- Specifies resources that are loaded when the server starts and/or which are protected from being stopped. To specify several resources, add more <resource> parameter(s). --> <resource src="admin" startup="1" protected="0"/> <resource src="helpmanager" startup="1" protected="0"/> <resource src="mapcycler" startup="1" protected="0"/> <resource src="mapmanager" startup="1" protected="0"/> <resource src="resourcebrowser" startup="1" protected="1" default="true"/> <resource src="resourcemanager" startup="1" protected="1"/> <resource src="scoreboard" startup="1" protected="0"/> <resource src="spawnmanager" startup="1" protected="0"/> <resource src="votemanager" startup="1" protected="0"/> <resource src="webadmin" startup="1" protected="0"/> </config>
  18. every once in a while i get the same sort of error it seems to be some sort of lag between client and server when you try to spawn and the server gets confused because there should be a player to spawn ( youve just connected ) but it cant find you ( i think this is where the lag problem is ) and then server just prints tons of errors about spawn player. i run mine on LAN and it still happens ( must admit my router is very busy ) some times but i just restart and its fine. if you are using a router how many people / pcs are on it and how much do they use internet or connect to each other. that may be the issue but if you are running internet server im not to sure what else it might be. if u are on LAN try stopping all other pcs accessing network for a few minutes and see if that helps.
  19. when u start a gamemode ( TDMA / INTERSTATE / CTF / etc. ) u need to start a map as well i think the only gamemode that has map built in is freeroam ( BROPH RESOURCE ) for all the others u need to look at mta resources and there should be maps for each ( names usually start the same ) if u start a gamemode ( TDMA ) for example connect to server then open console and type votemode ( votemanager resource starts by default ) and then it will give u a little screen with list of playable maps so just select one and game should start. i have noticed with interstate 69 u need 2 or more players or game wont start ( not sure about others ) just looked really quick. if u start TDMA the associated maps are called ( tdma-arena1 / tdma-canals / tdma canyonburst / and so on ) hope that helps a bit
  20. [DooD]Heavyair

    Mta codes

    if u are trying to move an object that is created by the game it is very difficult ( not even sure if possible ) it looks like you are trying to open the gate to something but the only way i know to move things is to create it yourself with a script or map file and then write a function to move it. i have read that there are ways of moving world objects but it is very very complicated and i dont really understand it. i know thats not much help but if you are trying to make an object and move it i can probably help if by codes u mean object ID numbers someone has link to a full list of objects. i will try to find it for u when i have time but if u just search objects in the scripting thread it should be there somewhere.
  21. thats wild cannonball LOL same sort of idea but i put it inside the car so it looks like its coming from the underside of car havent had a chance to do screenshot yet but will a soon as i can EDIT ::: SCREENSHOTS! http://www.fileshack.us/get_file.php?id=643769&file=mta-screen0040.png http://www.fileshack.us/get_file.php?id=666744&file=mta-screen0041.png http://www.fileshack.us/get_file.php?id=731873&file=mta-screen0043.png http://www.fileshack.us/get_file.php?id=133847&file=mta-screen0044.png http://www.fileshack.us/get_file.php?id=485693&file=mta-screen0046.png http://www.fileshack.us/get_file.php?id=248831&file=mta-screen0047.png http://www.fileshack.us/get_file.php?id=945346&file=mta-screen0050.png i am considering putting more than one smoke machine in the car for more smoke but when you stop the vehicle or even drive slow it gets really hard to see depending on how close the camera is EDIT 2:::: small update just added extra smoke machine but seems to make quite a difference here u go function carsmoke ( player, command ) local vehicle = getPlayerOccupiedVehicle ( player ) local x, y, z = getElementPosition ( vehicle ) local smoker1 = createObject ( 2780, x, y, z ) local smoker2 = createObject ( 2780, x, y, z ) attachElementToElement ( smoker1, vehicle, 0, 0, -1 ) attachElementToElement ( smoker2, vehicle, 0, -1, -1 ) outputChatBox ( "BURNIN RUBBER! cough cough" ) setTimer ( destroyElement, 30000, 1, smoker1 ) setTimer ( destroyElement, 30000, 1, smoker2 ) end
  22. i dont know how to post screenshots sorry
  23. sorry about triple post 50P ( wont happen again ) thank u very much hope somebody sees this i have now got the script working ( THANK U ALL ) but the camera only works every other time player hits collision sphere and the first time it sets camera to very strange position ( farm i think ) and u cant see player. it is a bit jumpy but its still pretty cool but was wondering if i had done something wrong to cause it not to work every time you hit collision sphere. server side thrillcammarker = createColSphere ( -724, 693, -200, 5 ) function setcam ( element ) setElementPosition ( thrillcammarker, -724, 693, 20 ) outputChatBox ( "1" ) end function thrillcam ( element ) triggerClientEvent ( element, "onchangeCamera", getRootElement () ) setTimer ( setElementPosition, 1000, 1, thrillcammarker, -724, 693, -200 ) outputChatBox ( "2" ) end addCommandHandler ( "startcamera", setcam ) addEventHandler ( "onColShapeHit", thrillcammarker, thrillcam ) client side local root = getRootElement() local localPlayer = getLocalPlayer () local update = false function updateCameraPos() local x, y, z = getElementPosition ( localPlayer ) setCameraLookAt ( x, y, z ) end function changeCamera() if ( update == false ) then update = true toggleCameraFixedMode ( true ) setCameraPosition ( -681, 662, 18 ) addEventHandler ( "onClientRender", root, updateCameraPos ) setTimer ( toggleCameraFixedMode, 3000, 1, false ) else update = false toggleCameraFixedMode ( false ) removeEventHandler ( "onClientRender", root, updateCameraPos ) end end addEvent ( "onchangeCamera", true ) addEventHandler ( "onchangeCamera", getRootElement (), changeCamera ) i put the timer to move the sphere back to the original position in hoping that if i had to restart the function with the startcamera command it would stop the weird behavior but it did not help. really not sure if this is my fault or not in this one. it looks ok to me and it does work ( sort of ) but i dont know much about scripting yet so any ideas appreciated thanx. THANX AGAIN
  24. i am now trying to do it like this but it gives me nothing and as far as i can see it should work ( no errors, no object, no message ) server side thrillcammarker = createCollisionSphere ( -735, 790, -200, 5 ) function setcam ( player ) setElementPosition ( thrillcammarker, -735, 790, 14 ) createObject ( 16303, -740.47650146484, 700.71752929688, 13.409936904907, 359.5, 0, 350.5 ) outputChatBox ( "1" ) end function thrillcam ( element ) triggerClientEvent ( element, "onchangeCamera", getRootElement () ) outputChatBox ( "2" ) end addCommandHandler ( "startcamera", setcam ) addEventHandler ( "onColShapeHit", thrillcammarker, thrillcam ) client side local root = getRootElement() local localPlayer = getLocalPlayer () local update = false function updateCameraPos() local x, y, z = getElementPosition ( localPlayer ) setCameraLookAt ( x, y, z ) end function changeCamera() if ( update == false ) then update = true toggleCameraFixedMode ( true ) setCameraPosition ( -681, 662, 18 ) addEventHandler ( "onClientRender", root, updateCameraPos ) else update = false toggleCameraFixedMode ( false ) removeEventHandler ( "onClientRender", root, updateCameraPos ) end end addEvent ( "onchangeCamera", true ) addEventHandler ( "onchangeCamera", getRootElement (), changeCamera ) i know the basic client side script works if its used with a command handler but i cant see what ive done wrong with the server side. i think it is probably something to do with the trigger client event but from what i can tell from the other scripts i use this should be ok. what i want to do is create a ramp with a collision sphere on it so that when you jump off the ramp it switches the camera to a fixed point and follows the car while staying in one place. i am also going to put another collision sphere to switch back to normal camera or maybe just a timer. thanx for any help
×
×
  • Create New...