Miika Posted August 10, 2014 Author Posted August 10, 2014 addEventHandler("onMarkerHit", finalMarker, Remove) 'finalMarker' wasn't yet created and so not defined. That's why it's not working. Try this: missionMarker = createMarker ( -1305.2, -120.3, 13.4, "cylinder", 2, 0, 255, 255, 170 ) addEventHandler("onResourceStart", resourceRoot, function ( ) missionBlip = createBlipAttachedTo(missionMarker,53) outputChatBox( "[Plane Mission] Älä vielä mene lentokone missionille. se on kesken", source, 0, 255, 255 ) end ) addEventHandler("onMarkerHit", missionMarker, function ( hitElement ) if (getElementType ( hitElement ) == 'player' ) then local plane = createVehicle ( 519, -1654, -162, 14, 0, 0, -45 ) warpPedIntoVehicle ( hitElement, plane ) outputChatBox( "[Plane Mission] Lennä punaiselle lipulle.", hitElement, 0, 255, 255 ) finalMarker = createMarker ( 338, 2505, 16, "checkpoint", 6, 255, 255, 0, 170 ) finalBlip = createBlipAttachedTo(finalMarker,19) end end ) function Remove( ) if (finalMarker ~= nil) and (source == finalMarker) then if isElement(finalMarker) then removeEventHandler("onMarkerHit", finalMarker, Remove) destroyElement(finalMarker) end if isElement(finalBlip) then destroyElement(finalBlip) end end end addEventHandler("onMarkerHit", getRootElement(), Remove) It working! Yeah Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Miika Posted August 10, 2014 Author Posted August 10, 2014 Next problem :DD It not give cash. Code: missionMarker = createMarker ( -1305.2, -120.3, 13.4, "cylinder", 2, 0, 255, 255, 170 ) addEventHandler("onResourceStart", resourceRoot, function ( ) missionBlip = createBlipAttachedTo(missionMarker,53) outputChatBox( "[Plane Mission] Älä vielä mene lentokone missionille. se on kesken", player, 0, 255, 255 ) end ) addEventHandler("onMarkerHit", missionMarker, function ( hitElement ) if (getElementType ( hitElement ) == 'player' ) then local plane = createVehicle ( 519, -1654, -162, 14, 0, 0, -45 ) warpPedIntoVehicle ( hitElement, plane ) outputChatBox( "[Plane Mission] Lennä punaiselle lipulle.", hitElement, 0, 255, 255 ) finalMarker = createMarker ( 338, 2505, 16, "checkpoint", 6, 255, 255, 0, 170 ) finalBlip = createBlipAttachedTo(finalMarker,19) end end ) function Remove( ) if (finalMarker ~= nil) and (source == finalMarker) then if isElement(finalMarker) then givePlayerMoney ( thePlayer, 10000 ) removeEventHandler("onMarkerHit", finalMarker, Remove) destroyElement(finalMarker) outputChatBox( "[Plane Mission] Kiitos kun veit lentokoneen huoltoon. Saat 10K palkkiota.", hitElement, 0, 255, 255 ) end if isElement(finalBlip) then destroyElement(finalBlip) end end end addEventHandler("onMarkerHit", getRootElement(), Remove) Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Et-win Posted August 10, 2014 Posted August 10, 2014 'thePlayer' is not defined. Also, agian, check or theElement is a player. PS: Remember this is server-sided, which means, EVERY PLAYER can now touch that marker, and 'steal' the job. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Miika Posted August 10, 2014 Author Posted August 10, 2014 'thePlayer' is not defined. Also, agian, check or theElement is a player.PS: Remember this is server-sided, which means, EVERY PLAYER can now touch that marker, and 'steal' the job. givePlayerMoney ( theElement, 10000 ) Not working Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Max+ Posted August 10, 2014 Posted August 10, 2014 'thePlayer' is not defined. Also, agian, check or theElement is a player.PS: Remember this is server-sided, which means, EVERY PLAYER can now touch that marker, and 'steal' the job. givePlayerMoney ( theElement, 10000 ) Not working change it to source - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Miika Posted August 10, 2014 Author Posted August 10, 2014 change it to source givePlayerMoney ( source, 10000 ) Not working Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Et-win Posted August 10, 2014 Posted August 10, 2014 Dudes... Srsly? missionMarker = createMarker ( -1305.2, -120.3, 13.4, "cylinder", 2, 0, 255, 255, 170 ) addEventHandler("onResourceStart", resourceRoot, function ( ) missionBlip = createBlipAttachedTo(missionMarker,53) outputChatBox( "[Plane Mission] Älä vielä mene lentokone missionille. se on kesken", player, 0, 255, 255 ) end ) addEventHandler("onMarkerHit", missionMarker, function ( hitElement ) if (getElementType ( hitElement ) == 'player' ) then local plane = createVehicle ( 519, -1654, -162, 14, 0, 0, -45 ) warpPedIntoVehicle ( hitElement, plane ) outputChatBox( "[Plane Mission] Lennä punaiselle lipulle.", hitElement, 0, 255, 255 ) finalMarker = createMarker ( 338, 2505, 16, "checkpoint", 6, 255, 255, 0, 170 ) finalBlip = createBlipAttachedTo(finalMarker,19) end end ) function Remove(thePlayer) if (getElementType(thePlayer) == "player") then if (finalMarker ~= nil) and (source == finalMarker) then if isElement(finalMarker) then givePlayerMoney ( thePlayer, 10000 ) removeEventHandler("onMarkerHit", finalMarker, Remove) destroyElement(finalMarker) outputChatBox( "[Plane Mission] Kiitos kun veit lentokoneen huoltoon. Saat 10K palkkiota.", hitElement, 0, 255, 255 ) end if isElement(finalBlip) then destroyElement(finalBlip) end end end end addEventHandler("onMarkerHit", getRootElement(), Remove) Just define theElement in the function ('thePlayer') and check or it's a player. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Miika Posted August 10, 2014 Author Posted August 10, 2014 Dudes... Srsly? missionMarker = createMarker ( -1305.2, -120.3, 13.4, "cylinder", 2, 0, 255, 255, 170 ) addEventHandler("onResourceStart", resourceRoot, function ( ) missionBlip = createBlipAttachedTo(missionMarker,53) outputChatBox( "[Plane Mission] Älä vielä mene lentokone missionille. se on kesken", player, 0, 255, 255 ) end ) addEventHandler("onMarkerHit", missionMarker, function ( hitElement ) if (getElementType ( hitElement ) == 'player' ) then local plane = createVehicle ( 519, -1654, -162, 14, 0, 0, -45 ) warpPedIntoVehicle ( hitElement, plane ) outputChatBox( "[Plane Mission] Lennä punaiselle lipulle.", hitElement, 0, 255, 255 ) finalMarker = createMarker ( 338, 2505, 16, "checkpoint", 6, 255, 255, 0, 170 ) finalBlip = createBlipAttachedTo(finalMarker,19) end end ) function Remove(thePlayer) if (getElementType(thePlayer) == "player") then if (finalMarker ~= nil) and (source == finalMarker) then if isElement(finalMarker) then givePlayerMoney ( thePlayer, 10000 ) removeEventHandler("onMarkerHit", finalMarker, Remove) destroyElement(finalMarker) outputChatBox( "[Plane Mission] Kiitos kun veit lentokoneen huoltoon. Saat 10K palkkiota.", hitElement, 0, 255, 255 ) end if isElement(finalBlip) then destroyElement(finalBlip) end end end end addEventHandler("onMarkerHit", getRootElement(), Remove) Just define theElement in the function ('thePlayer') and check or it's a player. I get cash but other players wont get cash Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Et-win Posted August 10, 2014 Posted August 10, 2014 Ehum, no they won't... That's the point of your script? >.> ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Miika Posted August 10, 2014 Author Posted August 10, 2014 Now I'm making client side and panel. [server side error] WARNING: Plane-mission.lua:6: Bad argument @ 'WarpPedIntoVehicle' [server] missionMarker = createMarker ( -1305.2, -120.3, 13.4, "cylinder", 2, 0, 255, 255, 170 ) -- Trigger -- function MarkerHit( hitElement, matchingDimension ) local plane = createVehicle ( 519, 70.21049, -233.00739, 2.33665 ) warpPedIntoVehicle ( hitElement, plane ) outputChatBox( "[Plane Mission] Test", source, 0, 255, 255 ) end addEvent ( "onMissionAccept", true ) addEventHandler ( "onMissionAccept", root, MarkerHit ) function createMissionMarker() missionBlip = createBlipAttachedTo(missionMarker,53) outputChatBox( "[Plane Mission] Älä vielä mene lentokone missionille. se on kesken", source, 0, 255, 255 ) end addEventHandler("onResourceStart", resourceRoot, createMissionMarker) function MarkerHit( hitElement, matchingDimension ) triggerClientEvent( hitElement, "createMissionGui", hitElement ) outputChatBox( "[Plane Mission] Test", source, 0, 255, 255 ) end addEventHandler("onMarkerHit", missionMarker, MarkerHit) [Client] function createAcceptPanel() missionGui = guiCreateWindow(250,100,445,445,"Plane mission",false) guiWindowSetSizable(missionGui, false) showCursor( true ) missionGuiButton1 = guiCreateButton(14, 50, 136, 58, "Accept", false, missionGui) missionGuiButton2 = guiCreateButton(160, 50, 136, 58, "Cancel", false, missionGui) addEventHandler ( "onClientGUIClick", missionGuiButton1, takeMission, false ) addEventHandler ( "onClientGUIClick", missionGuiButton2, cancelMission, false ) end addEvent ( "createMissionGui", true ) addEventHandler ( "createMissionGui", root, createAcceptPanel ) function takeMission() triggerServerEvent("onMissionAccept", localPlayer ) end function cancelMission() guiSetVisible(missionGui, false) showCursor( false ) end Where is the problem? Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Et-win Posted August 10, 2014 Posted August 10, 2014 Again, first check or 'hitElement' is a player. >.> Also, you have 2 functions with the same name. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Miika Posted August 10, 2014 Author Posted August 10, 2014 Again, first check or 'hitElement' is a player. >.> Also, you have 2 functions with the same name. I fix it but same problem... Code: missionMarker = createMarker ( -1305.2, -120.3, 13.4, "cylinder", 2, 0, 255, 255, 170 ) -- Trigger -- function MarkerHit( hitElement, matchingDimension ) local plane = createVehicle ( 519, -1654, -162, 14, 0, 0, -45 ) warpPedIntoVehicle ( hitElement, plane ) outputChatBox( "[Plane Mission] Aja perseeseen! Muista pitää hauskaa!", hitElement, 0, 255, 255 ) finalMarker = createMarker ( 338, 2505, 16, "checkpoint", 6, 255, 255, 0, 170 ) finalBlip = createBlipAttachedTo(finalMarker,19) end addEvent ( "onMissionAccept", true ) addEventHandler ( "onMissionAccept", root, MarkerHit ) function createMissionMarker() missionBlip = createBlipAttachedTo(missionMarker,53) outputChatBox( "[Plane Mission] Älä vielä mene lentokone missionille. se on kesken", player, 0, 255, 255 ) end addEventHandler("onResourceStart", resourceRoot, createMissionMarker) function MarkerHit( hitMarker, matchingDimension ) triggerClientEvent( hitMarker, "createMissionGui", hitMarker ) outputChatBox( "[Plane Mission] Test", hitMarker, 0, 255, 255 ) end addEventHandler("onMarkerHit", missionMarker, MarkerHit) Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Et-win Posted August 10, 2014 Posted August 10, 2014 No, you didnt... ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Max+ Posted August 10, 2014 Posted August 10, 2014 --Server missionMarker = createMarker ( -1305.2, -120.3, 13.4, "cylinder", 2, 0, 255, 255, 170 ) -- Trigger -- function MarkerHit( hitElement, matchingDimension ) if getElementType ( hitElement ) == 'player' then local plane = createVehicle ( 519, 70.21049, -233.00739, 2.33665 ) warpPedIntoVehicle ( hitElement, plane ) outputChatBox( "[Plane Mission] Test", source, 0, 255, 255 ) end addEvent ( "onMissionAccept", true ) addEventHandler ( "onMissionAccept", root, MarkerHit ) function createMissionMarker() missionBlip = createBlipAttachedTo(missionMarker,53) outputChatBox( "[Plane Mission] Älä vielä mene lentokone missionille. se on kesken", source, 0, 255, 255 ) end addEventHandler("onResourceStart", resourceRoot, createMissionMarker) function MarkerHit2( hitElement, matchingDimension ) if getElementType ( hitElement ) == 'player' then triggerClientEvent( hitElement, "createMissionGui", hitElement ) outputChatBox( "[Plane Mission] Test", source, 0, 255, 255 ) end end end addEventHandler("onMarkerHit", missionMarker, MarkerHit2) - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Miika Posted August 10, 2014 Author Posted August 10, 2014 --Server missionMarker = createMarker ( -1305.2, -120.3, 13.4, "cylinder", 2, 0, 255, 255, 170 ) -- Trigger -- function MarkerHit( hitElement, matchingDimension ) if getElementType ( hitElement ) == 'player' then local plane = createVehicle ( 519, 70.21049, -233.00739, 2.33665 ) warpPedIntoVehicle ( hitElement, plane ) outputChatBox( "[Plane Mission] Test", source, 0, 255, 255 ) end addEvent ( "onMissionAccept", true ) addEventHandler ( "onMissionAccept", root, MarkerHit ) function createMissionMarker() missionBlip = createBlipAttachedTo(missionMarker,53) outputChatBox( "[Plane Mission] Älä vielä mene lentokone missionille. se on kesken", source, 0, 255, 255 ) end addEventHandler("onResourceStart", resourceRoot, createMissionMarker) function MarkerHit2( hitElement, matchingDimension ) if getElementType ( hitElement ) == 'player' then triggerClientEvent( hitElement, "createMissionGui", hitElement ) outputChatBox( "[Plane Mission] Test", source, 0, 255, 255 ) end end end addEventHandler("onMarkerHit", missionMarker, MarkerHit2) Not working. It not create window Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Max+ Posted August 10, 2014 Posted August 10, 2014 That's odd show meta.xml and make sure my Code is ServerSide and the window is clientside /debugscript 3 .. also you must enter the marker on foot not in cars . - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
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