Om. Posted October 23, 2014 Share Posted October 23, 2014 I'm noob in server sided scripts, halp pls. local markers { createMarker ( 0, 0, 5, "marker", 1, 0, 255, 0, 0 ) createMarker ( 50, 50, 50, "marker", 1, 0, 255, 0, 0) } function markerfix(hitElement) if ( source == markers ) then if ( isElement ( hitElement ) and getElementType ( hitElement ) == "player" ) then local ve = getPedOccupiedVehicle(hitElement) fixVehicle(ve) takePlayerMoney ( hitElement, 350 ) end end end addEventHandler("onMarkerHit", getResourceRootElement(getThisResource()), markerfix) Link to comment
xeon17 Posted October 23, 2014 Share Posted October 23, 2014 Proper Way of Asking Questions: Many people here ask for help without giving us much details about their problem. So, we have to ask the author of the topic to give us some more details. If you want us to help you and you don't explain what your problem is about, it doesn't help us to help you. WRONG way of asking for help: I have problem with my script it doesn't work.. help me! What information does this sentence give to us? We know that script doesn't work but we don't know why and in what way it doesn't work. We'll never know that unless you give us some more information about your problem. CORRECT way of asking for help: I have problem with my script it doesn't work.. It doesn't start when I try to run it I don't know why... Here is my code: LINE NUMBER ON/OFF | EXPAND/CONTRACT | SELECT ALL -- some Lua code tagged with or [lua][/ lua] It helps us straight away. We know your script doesn't start when you try to run it and we have some of the code that we can tell you what you did wrong. What information should my question contain? - What is the reason you make new topic? Whether it's problem with your script or need help with something else. - Explain what is wrong? Tell us what happens when you test your script and what is that you want it to do. - Give us some of your code so that we can help you correct it. - Tell us if you get any error or warning messages and what they are. We can determine what causes the script not to work quicker. Link to comment
Anubhav Posted October 23, 2014 Share Posted October 23, 2014 The code doesn't make any sense. Link to comment
TAPL Posted October 23, 2014 Share Posted October 23, 2014 local marker1 = createMarker(0, 0, 5, "cylinder", 2, 0, 255, 0, 255) local marker2 = createMarker(50, 50, 50, "cylinder", 2, 0, 255, 0, 255) function markerfix(hitElement) if (source == marker1) or (source == marker2) then if getElementType(hitElement) == "player" then local ve = getPedOccupiedVehicle(hitElement) if ve then fixVehicle(ve) takePlayerMoney(hitElement, 350) end end end end addEventHandler("onMarkerHit", root, markerfix) Link to comment
Anubhav Posted October 23, 2014 Share Posted October 23, 2014 TAPL, sometimes error occur of getElementType so I use local marker1 = createMarker(0, 0, 5, "cylinder", 2, 0, 255, 0, 255) local marker2 = createMarker(50, 50, 50, "cylinder", 2, 0, 255, 0, 255) function markerfix(hitElement) if (source == marker1) or (source == marker2) then if getElementType(hitElement) and getElementType(hitElement) == "player" then local ve = getPedOccupiedVehicle(hitElement) if ve then fixVehicle(ve) takePlayerMoney(hitElement, 350) end end end end addEventHandler("onMarkerHit", root, markerfix) Link to comment
Moderators IIYAMA Posted October 23, 2014 Moderators Share Posted October 23, 2014 It never gives an error, unless it has been destroyed by another script. Link to comment
TAPL Posted October 23, 2014 Share Posted October 23, 2014 TAPL, sometimes error occur of getElementType so I use local marker1 = createMarker(0, 0, 5, "cylinder", 2, 0, 255, 0, 255) local marker2 = createMarker(50, 50, 50, "cylinder", 2, 0, 255, 0, 255) function markerfix(hitElement) if (source == marker1) or (source == marker2) then if getElementType(hitElement) and getElementType(hitElement) == "player" then local ve = getPedOccupiedVehicle(hitElement) if ve then fixVehicle(ve) takePlayerMoney(hitElement, 350) end end end end addEventHandler("onMarkerHit", root, markerfix) hitElement is always there, otherwise the event won't get trigger. Obviously you are talking about onPlayerWasted which sometimes does not have killer and this occur if the player jump from high place and died. 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