LasHa Posted May 7, 2015 Share Posted May 7, 2015 (edited) solved delete! Edited May 7, 2015 by Guest Link to comment
Walid Posted May 7, 2015 Share Posted May 7, 2015 Try this one local TimeTable = {} local waitTime = 3000 -- 3 seconds local Markers = { {411, 2015, 1543.4, 10.5, 5000}, -- Marker 1 {411, 2020, 1543.4, 10.5, 5000}, -- Marker 2 } for i , v in pairs (Markers) do HitMarker = createMarker ( v[2], v[3], v[4], "corona", 2, 255, 0, 0, 255 ) setElementData ( HitMarker, "model", v[1] ) setElementData ( HitMarker, "cash", v[5] ) end function allowedVehicles( hitElement, matchingDimension ) if matchingDimension and isElement(hitElement) and getElementType(hitElement) == "player" then if isPedInVehicle ( hitElement ) then local vehicle = getPedOccupiedVehicle ( hitElement ) if vehicle then if getElementModel ( vehicle ) == getElementData ( source, "model" ) then TimeTable[hitElement] = setTimer(StuntComplete, waitTime, 1, hitElement,source) setElementData ( hitElement, "entered.marker", true ) end end end end end addEventHandler( "onMarkerHit", resourceRoot, allowedVehicles ) function StuntComplete ( player,marker) if isElement ( player ) then if getElementData ( player, "entered.marker" ) then givePlayerMoney ( player, tonumber(getElementData (marker, "cash"))) setMarkerColor ( marker, 0, 255, 0, 255 ) outputChatBox ( "You completed the Stunt", hitElement, 0, 255, 0 ) end end end addEventHandler ( "onMarkerLeave", resourceRoot, function ( leaveElement ) if ( isElement ( leaveElement ) and getElementType ( leaveElement ) == "player" ) then if isTimer ( waitTime ) then killTimer ( waitTime ) setElementData ( leaveElement, "entered.marker", false ) outputChatBox("You failed the Stunt!", player, 255, 0, 0) end end end ) Link to comment
LasHa Posted May 7, 2015 Author Share Posted May 7, 2015 Thannks works really good. :* Link to comment
Walid Posted May 7, 2015 Share Posted May 7, 2015 Thannks works really good. :* You are welcome. Link to comment
LasHa Posted May 7, 2015 Author Share Posted May 7, 2015 Walid one more question. i want to use red small square as Blip its a 0(Marker) but when its higher then player its triangle with corner up and when its lower then player corner down how to freeze its with just small red square? Link to comment
Walid Posted May 7, 2015 Share Posted May 7, 2015 Walid one more question. i want to use red small square as Blip its a 0(Marker) but when its higher then player its triangle with corner up and when its lower then player corner down how to freeze its with just small red square? sorry i don't undrestand ur english Link to comment
LasHa Posted May 7, 2015 Author Share Posted May 7, 2015 nothing bad with English just a bad explanation. okay i will show you with pictures look createBlipAttachedTo ( HitMarker, 0 ) i want this marker to be small square always but http://i.imgur.com/ZeoqWJn.jpg http://i.imgur.com/tSWnctZ.jpg http://i.imgur.com/63Na05o.jpg look how this small red blip changes itself how to freeze it as square? Link to comment
Walid Posted May 7, 2015 Share Posted May 7, 2015 look how this small red blip changes itself how to freeze it as square? You can't. Link to comment
LasHa Posted May 7, 2015 Author Share Posted May 7, 2015 okay and how to change single blip color? like if i enter in the marker with this code local blips = getElementsByType ( "blip" ) for blipKey, blipValue in ipairs ( blips ) do local red, green, blue, alpha = getBlipColor ( blipValue ) if ( red ~= 0 or green ~= 255 or blue ~= 0 or alpha ~= 255 ) then setBlipColor ( blipValue, 0, 255, 0, 255 ) end end every blip color changes to green. http://i.imgur.com/bpfJf1r.jpg http://i.imgur.com/WkiAQ5m.jpg my code local TimeTable = {} local waitTime = 3000 -- 3 seconds local Markers = { {522, -1204, -1057, 155, 5000}, -- Marker 1 {522, -1204, -1090, 155, 5000}, -- Marker 2 {522, -1204, -1150, 155, 5000}, -- Marker 3 {522, -1204, -1200, 155, 5000}, -- Marker 4 {522, -1204, -1250, 155, 5000}, -- Marker 5 } for i , v in pairs (Markers) do HitMarker = createMarker ( v[2], v[3], v[4], "corona", 1.20, 255, 0, 0, 255 ) createBlipAttachedTo( HitMarker, 0 ) setElementData ( HitMarker, "model", v[1] ) setElementData ( HitMarker, "cash", v[5] ) end function allowedVehicles( hitElement, matchingDimension ) if matchingDimension and isElement(hitElement) and getElementType(hitElement) == "player" then if isPedInVehicle ( hitElement ) then local vehicle = getPedOccupiedVehicle ( hitElement ) if vehicle then if getElementModel ( vehicle ) == getElementData ( source, "model" ) then TimeTable[hitElement] = setTimer(StuntComplete, waitTime, 1, hitElement,source) setElementData ( hitElement, "entered.marker", true ) else outputChatBox ( "You have entered in Stunt with wrong vehicle", hitElement, 255, 0, 0 ) end end end end end addEventHandler( "onMarkerHit", resourceRoot, allowedVehicles ) function StuntComplete ( player,marker) if isElement ( player ) then if getElementData ( player, "entered.marker" ) then givePlayerMoney ( player, tonumber(getElementData (marker, "cash"))) outputChatBox ( "You have completed the Stunt", hitElement, 0, 255, 0 ) local blips = getElementsByType ( "blip" ) for blipKey, blipValue in ipairs ( blips ) do local red, green, blue, alpha = getBlipColor ( blipValue ) if ( red ~= 0 or green ~= 255 or blue ~= 0 or alpha ~= 255 ) then setBlipColor ( blipValue, 0, 255, 0, 255 ) end end end end end addEventHandler ( "onMarkerLeave", resourceRoot, function ( leaveElement ) if ( isElement ( leaveElement ) and getElementType ( leaveElement ) == "player" ) then if isTimer ( waitTime ) then killTimer ( waitTime ) setElementData ( leaveElement, "entered.marker", false ) outputChatBox("You failed the Stunt!", player, 255, 0, 0) end end end ) Link to comment
Walid Posted May 7, 2015 Share Posted May 7, 2015 try this : local TimeTable = {} local waitTime = 3000 -- 3 seconds local Blips = {} local Markers = { {522, -1204, -1057, 155, 5000}, -- Marker 1 {522, -1204, -1090, 155, 5000}, -- Marker 2 {522, -1204, -1150, 155, 5000}, -- Marker 3 {522, -1204, -1200, 155, 5000}, -- Marker 4 {522, -1204, -1250, 155, 5000}, -- Marker 5 } for i , v in pairs (Markers) do HitMarker = createMarker ( v[2], v[3], v[4], "corona", 1.20, 255, 0, 0, 255 ) Blips[HitMarker] = createBlipAttachedTo( HitMarker, 0 ) setElementData ( HitMarker, "model", v[1] ) setElementData ( HitMarker, "cash", v[5] ) end function allowedVehicles( hitElement, matchingDimension ) if matchingDimension and isElement(hitElement) and getElementType(hitElement) == "player" then if isPedInVehicle ( hitElement ) then local vehicle = getPedOccupiedVehicle ( hitElement ) if vehicle then if getElementModel ( vehicle ) == getElementData ( source, "model" ) then TimeTable[hitElement] = setTimer(StuntComplete, waitTime, 1, hitElement,source) setElementData ( hitElement, "entered.marker", true ) else outputChatBox ( "You have entered in Stunt with wrong vehicle", hitElement, 255, 0, 0 ) end end end end end addEventHandler( "onMarkerHit", resourceRoot, allowedVehicles ) function StuntComplete ( player,marker) if isElement ( player ) then if getElementData ( player, "entered.marker" ) then givePlayerMoney ( player, tonumber(getElementData (marker, "cash"))) outputChatBox ( "You have completed the Stunt", hitElement, 0, 255, 0 ) if isElement(Blips[marker]) then setBlipColor (Blips[marker], 0, 255, 0, 255 ) end end end end addEventHandler ( "onMarkerLeave", resourceRoot, function ( leaveElement ) if ( isElement ( leaveElement ) and getElementType ( leaveElement ) == "player" ) then if isTimer ( waitTime ) then killTimer ( waitTime ) setElementData ( leaveElement, "entered.marker", false ) outputChatBox("You failed the Stunt!", player, 255, 0, 0) end end end ) Link to comment
LasHa Posted May 7, 2015 Author Share Posted May 7, 2015 Thanks it works. and the last the last Question can you add in function StuntComplete that the Marker which i will enter it will become green? please :* Link to comment
Walid Posted May 7, 2015 Share Posted May 7, 2015 Thanks it works. and the last the last Question can you add in function StuntComplete that the Marker which i will enter it will become green? please :* add function StuntComplete ( player,marker) if isElement ( player ) then if getElementData ( player, "entered.marker" ) then givePlayerMoney ( player, tonumber(getElementData (marker, "cash"))) outputChatBox ( "You have completed the Stunt", hitElement, 0, 255, 0 ) if isElement(Blips[marker]) then setBlipColor (Blips[marker], 0, 255, 0, 255 ) end setMarkerColor (marker,0, 255, 0, 255 ) end end end Link to comment
LasHa Posted May 7, 2015 Author Share Posted May 7, 2015 Okay thank you much with every single help <3 can i add you in skype? i have few more questions and please delete all of your comments to prevent scamers from st ealing this simple script Link to comment
SpecT Posted May 7, 2015 Share Posted May 7, 2015 Okay thank you much with every single help <3 can i add you in skype? i have few more questions and please delete all of your comments to prevent scamers from st ealing this simple script Sorry for the Off-topic but ... If it's a simple script then what's the problem to let the others see how the problem was solved ? You don't deserve to get helped anymore! Link to comment
LasHa Posted May 7, 2015 Author Share Posted May 7, 2015 dude i'm going to use this simple script on my own server thats why i don't want others to have this Link to comment
Walid Posted May 7, 2015 Share Posted May 7, 2015 Okay thank you much with every single help <3 can i add you in skype? i have few more questions and please delete all of your comments to prevent scamers from st ealing this simple script Your script is nothing why i need to delete it let the others see how the problem was solved . Anyways i can't gave you my skype , if u have a question ask it here 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