tinnetju Posted June 11, 2011 Share Posted June 11, 2011 Im not sure if the other post i posted got deleted or something , but ye i coudn't find it anywhere so i just post it again... Its a long time ago i scripted, well like 2 years, and decided to script again. I got rid of all the weird bugs and stuff, and now it loads, and doesn't show anything. It was the idea that, if someone gets the hunter pickup (which is in the huntermarker) the tank in the middle will sink with his platform, but there is no platform and there are no markers... script_s rootElement = getRootElement() local tankZinkDing=createObject ( 5804, 372.6845703125, -2393.951171875, -3.0999999046326, 359.46716308594, 0, 0 ) local huntermarker1=createMarker ( 376.87030029297, -2241.505859375, 44.539859771729, "corona", 2, 0, 255, 0 ) local huntermarker2=createMarker ( 372.12600708008, -2480.0295410156, 45.837253570557, "corona", 2, 0, 255, 0 ) function tankVerdrinkt () if ( source == huntermarker1 ) then outputChatBox ( "OMFG THE TANK IS SINKING, so the cars won. GZ. Now kill eachother with the hunter! \"{SMILIES_PATH}/icon_biggrin.gif\" alt=\"\" title=\"Very Happy\" />", getRootElement(), 255, 0, 0, true ) moveObject ( tankZinkDing, 10000, 372.6845703125, -2393.951171875, -8.0999999046326 ) elseif ( source == huntermarker1 ) then outputChatBox ( "OMFG THE TANK IS SINKING, so the cars won. GZ. Now kill eachother with the hunter! \"{SMILIES_PATH}/icon_biggrin.gif\" alt=\"\" title=\"Very Happy\" />", getRootElement(), 255, 0, 0, true ) moveObject ( tankZinkDing, 10000, 372.6845703125, -2393.951171875, -8.0999999046326 ) cancelEvent () end end addEventHandler( "onPlayerMarkerHit", rootElement, tankVerdrinkt ) script_c (its not added in meta because everything in here is in the server side script to) rootElement = getRootElement() local tankZinkDing=createObject ( 5804, 372.6845703125, -2393.951171875, -3.0999999046326, 359.46716308594, 0, 0 ) local huntermarker1=createMarker ( 376.87030029297, -2241.505859375, 44.539859771729, "corona", 2, 0, 255, 0 ) local huntermarker2=createMarker ( 372.12600708008, -2480.0295410156, 45.837253570557, "corona", 2, 0, 255, 0 ) function tankVerdrinkt () if ( source == huntermarker1 ) then outputChatBox ( "OMFG THE TANK IS SINKING, so the cars won. GZ. Now kill eachother with the hunter! \"{SMILIES_PATH}/icon_biggrin.gif\" alt=\"\" title=\"Very Happy\" />", getRootElement(), 255, 0, 0, true ) moveObject ( tankZinkDing, 10000, 372.6845703125, -2393.951171875, -8.0999999046326 ) elseif ( source == huntermarker1 ) then outputChatBox ( "OMFG THE TANK IS SINKING, so the cars won. GZ. Now kill eachother with the hunter! \"{SMILIES_PATH}/icon_biggrin.gif\" alt=\"\" title=\"Very Happy\" />", getRootElement(), 255, 0, 0, true ) moveObject ( tankZinkDing, 10000, 372.6845703125, -2393.951171875, -8.0999999046326 ) cancelEvent () end end addEventHandler( "onPlayerMarkerHit", rootElement, tankVerdrinkt ) meta "race" type="map" name="Tank VS Cars" author="Tinnetju[NL]" version="1.0" /> "TankVSCars.map" dimension="0" /> Link to comment
tinnetju Posted June 11, 2011 Author Share Posted June 11, 2011 wtf the outputchatbox messages are all screwed up, they should be outputChatBox ( "OMFG THE TANK IS SINKING, so the cars won. GZ. Now kill eachother with the hunter! :D", getRootElement(), 255, 0, 0, true ) Link to comment
SDK Posted June 11, 2011 Share Posted June 11, 2011 The source for onPlayerMarkerHit is a player, you need the first argument passed for the marker. You most likely don't need the cancelEvent, and there is only one lua file (and it's serverside). local tankZinkDing = createObject( 5804, 372.684, -2393.951, -3.099, 359.467, 0, 0 ) local huntermarker1 = createMarker( 376.870, -2241.505, 44.539, "corona", 2, 0, 255, 0 ) local huntermarker2 = createMarker( 372.126, -2480.029, 45.837, "corona", 2, 0, 255, 0 ) function tankVerdrinkt (marker, dimension) if ( marker == huntermarker1 or marker == huntermarker2) then outputChatBox ( "OMFG THE TANK IS SINKING, so the cars won. GZ. Now kill eachother with the hunter! : D", getRootElement(), 255, 0, 0, true ) moveObject ( tankZinkDing, 10000, 372.684, -2393.951, -8.0999 ) end end addEventHandler( "onPlayerMarkerHit", getRootElement(), tankVerdrinkt ) or you can do it easier like this: local tankZinkDing = createObject( 5804, 372.684, -2393.951, -3.099, 359.467, 0, 0 ) local huntermarker1 = createMarker( 376.870, -2241.505, 44.539, "corona", 2, 0, 255, 0 ) local huntermarker2 = createMarker( 372.126, -2480.029, 45.837, "corona", 2, 0, 255, 0 ) function tankVerdrinkt () outputChatBox ( "OMFG THE TANK IS SINKING, so the cars won. GZ. Now kill eachother with the hunter! : D", getRootElement(), 255, 0, 0, true ) moveObject ( tankZinkDing, 10000, 372.684, -2393.951, -8.0999 ) end addEventHandler( "onPlayerMarkerHit", huntermarker1, tankVerdrinkt ) addEventHandler( "onPlayerMarkerHit", huntermarker2, tankVerdrinkt ) Is this for a DM/DD map? Because this is using the onPlayerMarkerHit event, and I'm not sure if it works when players are in a vehicle. Link to comment
tinnetju Posted June 11, 2011 Author Share Posted June 11, 2011 Ye, its a DM map, and ye, you were right. He doesnt respond when i hit the marker, so i changed it to onMarkerHit, and now it works!! But, when i hit the marker, he outPutChatBox's it 2 times! You know how to fix this? Link to comment
SDK Posted June 11, 2011 Share Posted June 11, 2011 Yes, it's probably because the player AND the vehicle hit the marker. Also, your marker script would keep working, even if other players would hit it. Fix: add a global boolvariable hasMarkerBeenHit=false and check if the marker already has been entered. If not: output, move and hasMarkerBeenHit=true. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now