Jump to content

jkub

Members
  • Posts

    342
  • Joined

  • Last visited

Everything posted by jkub

  1. I got the reaction time going good. The only problem is if u launch before the go time it will either give not time at all or give a crazy time. Like I went 1.05 seconds before the starting time and it would say somthing like "Reaction Time: 12.48" other then that it works smooth. can u help please?
  2. Ya thats what I though it would of been. I went ahead and tried spacing the timers out overa longer time like 8 seconds and Ive repeatedly stress tested the new code with the lights over a longer time and more organized so It would give the server room to breathe and It hasent crashed yet:) Thanks I hope this is fulproof. Im gonna work on reaction time now on the launch. Its all good so far:)
  3. Ive been working on the same script for a while now the drag track im doing this for. anyway At the moment the script is solid in most areas and there are no small bugs that I know of. But there is a critical bug thats gonna stop me from ever legitly running it on my server. And that is somewhere on the trackstart function. Sometimes but not everytime when a vehicle pulls up to the startline it will comepletly crash the server and I have to restart it. Im pretty sure it is the script thats causing it to crash because It happens only when I pull up to the start but as I said not always. I would Really like to get this on its feet. Do u know of anything that I might be doing wrong for it do do this. The only thing I could see at the moment is that i am using alot of arguments on one function. and alot of setTimer arguments. But I don't really know if that would cause the prob here is the trackstart part of the script again I have now function trackStart ( thePlayer, matchingDimension ) if source == raceTrackStagingColCube then if getElementData ( thePlayer, "usingtrack", true ) then if isPlayerInVehicle ( thePlayer ) then local veh = getPlayerOccupiedVehicle ( thePlayer ) local driver = getVehicleController ( veh ) if driver then vehx, vehy, vehz = getElementPosition ( veh ) ------------------------------------------------------------ redLight = createMarker ( 1498.9, -2492.93, 18.6, "corona", 0.3, 255, 0, 0, 255, getRootElement() ) yellowLight1 = createMarker ( 1498.9, -2493.23, 18.05, "corona", 0.3, 255, 255, 0, 0, getRootElement() ) yellowLight2 = createMarker ( 1498.9, -2492.6, 18.05, "corona", 0.3, 255, 255, 0, 0, getRootElement() ) greenLight1 = createMarker ( 1498.9, -2492.6, 17.5, "corona", 0.3, 0, 255, 0, 0, getRootElement() ) greenLight2 = createMarker ( 1498.9, -2493.23, 17.5, "corona", 0.3, 0, 255, 0, 0, getRootElement() ) ----- triggerLights () ----- destroyLights () ------------------------------------------------------------ setVehicleFrozen ( veh, true ) setVehicleEngineState ( veh, false ) setVehicleRotation ( veh, 0, 0, -90 ) setElementPosition ( veh, 1471.8747, vehy, vehz ) setTimer ( setVehicleEngineState, 5000, 1, veh, true ) setTimer ( setVehicleFrozen, 5000, 1, veh, false ) moveObject ( endBarrier1, 3000, 2115.0461, -2480.4794, 11.2991 ) moveObject ( endBarrier2, 3000, 2115.0461, -2489.8593, 11.2991 ) moveObject ( endBarrier3, 3000, 2115.0461, -2499.2392, 11.2991 ) moveObject ( endBarrier4, 3000, 2115.0461, -2508.6191, 11.2991 ) finishCol = createColCuboid ( 2051.1867, -2511.3623, 12.5, 25, 31.8, 5 ) setTimer ( beginTimeHax, 5000, 1 ) end else outputChatBox ( "You are not running this one on foot. Get a car", thePlayer, 255, 0, 0 ) end else outputChatBox ( "You do not have track using hax", thePlayer, 255, 0, 0 ) end end end function triggerLights () setTimer ( setMarkerColor, 4000, 1, redLight, 255, 0, 0, 0 ) setTimer ( setMarkerColor, 4000, 1, yellowLight1, 255, 255, 0, 255 ) setTimer ( setMarkerColor, 4000, 1, yellowLight2, 255, 255, 0, 255 ) setTimer ( setMarkerColor, 5000, 1, yellowLight1, 255, 255, 0, 0 ) setTimer ( setMarkerColor, 5000, 1, yellowLight2, 255, 255, 0, 0 ) setTimer ( setMarkerColor, 5000, 1, greenLight1, 0, 255, 0, 255 ) setTimer ( setMarkerColor, 5000, 1, greenLight2, 0, 255, 0, 255 ) end function destroyLights () setTimer ( destroyElement, 10000, 1, redLight ) setTimer ( destroyElement, 10000, 1, yellowLight1 ) setTimer ( destroyElement, 10000, 1, yellowLight2 ) setTimer ( destroyElement, 10000, 1, greenLight1 ) setTimer ( destroyElement, 10000, 1, greenLight2 ) end I understand some of the way this code is written may be a little ludacris or somthin but any thoughs on how to solve this problem?
  4. Didnt see anything there that would apply. I already got the speed but its in the wrong format ex: 128mph 1.28458259blahblah I figured that string.format function could somehow work this out how would it be done through there if not then?
  5. How would I go about displaying a speed in mph. For instance 280mph. I pretty much used the example from the getElementVelocity part on the wiki and how would I format that long result to get 280 instead of 2.874572305969 blah blah blah
  6. I renamed the time functions like u said and it was not accumulating any longer:) Thank you thank you!
  7. Here is some code im using:) function trackStart ( thePlayer, matchingDimension ) if source == raceTrackStagingColCube then if getElementData ( thePlayer, "usingtrack", true ) then if isPlayerInVehicle ( thePlayer ) then local veh = getPlayerOccupiedVehicle ( thePlayer ) local driver = getVehicleController ( veh ) if driver then setVehicleFrozen ( veh, true ) setVehicleEngineState ( veh, false ) setTimer ( setVehicleEngineState, 5000, 1, veh, true ) setTimer ( setVehicleFrozen, 5000, 1, veh, false ) finishCol = createColCuboid ( 2051.1867, -2511.3623, 12.5, 10, 31.8, 3 ) countdown () end else outputChatBox ( "You are not running this one on foot. Get a car", thePlayer, 255, 0, 0 ) end else outputChatBox ( "You do not have track using hax", thePlayer, 255, 0, 0 ) end end end function finish ( thePlayer, matchingDimension ) if source == finishCol then if isPlayerInVehicle ( thePlayer ) then local veh = getPlayerOccupiedVehicle ( thePlayer ) local driver = getVehicleController ( veh ) if driver then if getElementData ( thePlayer, "usingtrack", true ) then destroyElement ( finishCol ) removeElementData ( thePlayer, "usingtrack" ) removeElementData ( raceTrackColCube, "use" ) tickEnd = getTickCount() time = ( tickEnd - tickStart ) finalTime = ( time / 1000 ) numberStr = string.format( "%.2f", finalTime ); outputChatBox ( "Run Complete. Your time was #FFFF00 " ..numberStr, thePlayer, 255, 255, 255, true ) end end end end end function time ( ) tickStart = getTickCount() end
  8. Ya I have tickStart = getTickCount() as soon as the player hits the beginning collision and the next tickEnd = getTickCount() is triggered when they hit the finish line collision I have set up and it works and the split thing u suggested works too:) Thanks but it Still is stacking up times and accumulating? How do I reset or perhapse destroy the first time?
  9. Also I just figured out that after you complete one run on the track and do another one the time does not reset and Instead accumulates after each run making each finish time larger. so How do I reset the time after each run?
  10. Hy I have made a little script of a drag strip at the los santos airport and when U start it gets your time lapsed when u reach the end of the track and I use getTickCount() to do this at both the starting point and end point to do this. But the time elapsed will look like this. So for example if the time was 20.14 seconds it will say 20147 Is there a way I can get rid of that last number from the result and also is there a way I could put a dot after the first 2 numbers so it is easily readable as seconds like 20.14 instead of 20147 ? How do I do this
  11. haha why dont I ever catch the funny shit first?!?!
  12. lol let me see them duckets at least take the time yourself to give it a try before asking strait up...
  13. jkub

    Scripter needed...?!

    wat kind of scripting are u talking about
  14. ok:) Thank you so much. that seemed to work:)
  15. jkub

    onPlayerWasted

    I feel offended as of everyone else in this forum probably does by his attitude. Can someone please do somthihng about this guy p
  16. I renamed the function and still nothing. It says that the spawnPlayer line is a bad argument
  17. When I put my first version of this in debug It did say somthing about a "stack overflow" Could that be what you guys are referring to?
  18. I have made 4 spawn points and I would like to where when someone joins they spawn randomly to one of those points using the mat.random function. ive tried this but it seems to be inaffective g_root = getRootElement() spawnPoints = { } function spawnPlayer ( ) spawnPoints[1] = 0, 0, 5 spawnPoints[2] = 0, 500, 5 spawnPoints[3] = 500, 0, 5 spawnPoints[4] = 1000, 0, 5 randomSpawn = math.random ( 1, #spawnPoints ) spawnPlayer ( source, randomSpawn ) end addEventHandler ( "onPlayerJoin", g_root, spawnPlayer )
  19. I myself have made a script for this before<< But anyway it is saying access denied because you have not gaven that resource admin rights. If I am correct any element that wants to kick players needs admin rights rather its a player or a resource The easiest way to solve this would be to add this resource under the acl.xml under the admin section try putting this in there name="resource.yourresourcenamehere" />
  20. also to clear this up. I use debug script every time I test anything even if its the smallest thing. And it is telling me that there is a bad argument at line 5 I already know that there is a problem but I cant seem to fix it
  21. Ya ive switched it around a bit and that didnt seem to work. I went back to the wiki and took another look at the function and tried doing first the parentnode then the subnode then the index number like it said. Ive tried both index as 0 and 1 and this didnt seem to work neither
  22. Ive put in a base that works by password and I am trying to store it in an xml and trying to use a scripted function to output the pass from the xml into the chatbox but is inaffective Here is the script below function readPassToPlayer ( thePlayer ) local passwordXML = xmlLoadFile ( "base.xml", getThisResource() ) if passwordXML then local passNode = xmlFindSubNode ( base.xml, "basepass" ) local nodeReading = xmlNodeGetValue ( passNode ) outputChatBox ( tostring(nodeReading), getRootElement() ) else outputChatBox ( "Error Loading File" ) end end addCommandHandler ( "getbasepass", readPassToPlayer ) And here below is the actual xml file > >cannonballjenkins>> and below is my resources meta.xml ="samClient.lua" type="client" /> ="lvairbase.lua" type="server" /> ="samServer.lua" type="server" /> src="base.xml" type="client" />
  23. jkub

    4 scripts

    It must be nice to just fill out a wish list like that
  24. jkub

    Taxi Script?

    Hy again:) I don't really have enough ways to make money on my server and I was thinking about doing a small taxi script for players to get money by simply haveing a driver picking up people and driving them places. Ive gave this a try and Does not really seem to be affective... any thoughts? rootElement = getRootElement() function enterTaxi ( enteredPlayer ) -------------------------------------------------------------------------------- local veh = getPlayerOccupiedVehicle ( enteredPlayer ) local vehID = getVehicleID ( veh ) local vehName = getVehicleName ( veh ) ---- local taxiDriver = getVehicleController ( veh ) local passenger1 = getVehicleOccupant ( veh, 2 )--Back Seat left side local playerSeat = getPlayerOccupiedVehicleSeat ( enteredPlayer ) ---- local passenger1Wallet = getPlayerMoney ( passenger1 ) ---- if vehID == 420 then --If the vehicle is a taxi if playerSeat == 0 then --If the player entered the driver seat setElementData ( enteredPlayer, "taxiDriver", veh ) setElementData ( veh, "workingTaxi", enteredPlayer ) outputChatBox ( "TEST You are in the driver seat TEST", enteredPlayer ) elseif playerSeat == 2 then --If the player is in seat 2 setElementData ( enteredPlayer, "taxiPassenger", veh ) outputChatBox ( "TEST You are in the passenger seat TEST", enteredPlayer ) chargeFare ( passenger1, taxiDriver ) end end end function chargeFare ( passenger1, taxiDriver ) if ( taxiDriver ) then --If there is a Driver charge = setTimer ( setPlayerMoney, 1000, 0, passenger1, passenger1Wallet - 1 ) --Charge the passenger payment = setTimer ( setPlayerMoney, 1000, 0, taxiDriver, getPlayerMoney ( taxiController ) + 1 ) --Pay the Taxi Driver else outputChatBox ( "TEST There seems to be no driver TEST", passenger1 ) end end function killPayments ( thePlayer ) local veh = getPlayerOccupiedVehicle ( thePlayer ) if getElementData ( veh, "workingTaxi", true ) then --If this vehicle was a working taxi killTimer ( charge ) killTimer ( payment ) removeElementData ( enteredPlayer, "taxiPassenger" ) end end addEventHandler ( "onVehicleEnter", rootElement, enterTaxi ) addEventHandler ( "onVehicleExit", rootElement, killPayments ) addEventHandler ( "onVehicleExplode", rootElement, killPayments ) I want the cash flow to start up when a passenger enters the correct seat and to stop when either the driver or passenger leaves the vehicle and when the vehicles is destroyed?
  25. Does anyone know the object id for the atm machine? I have looked everywhere and have used the object_browser script in the server and I cannot find it anywhere?
×
×
  • Create New...