SkrillexX Posted March 10, 2014 Posted March 10, 2014 Greetings , as /debugscript 3 said , there's an error somewhere in line 4 , problem is that i'm unable to find it. function HitMarker(thePlayer,theMarker ) local thePlayer = getLocalPlayer() local thePlayerPos = getElementPosition(thePlayer) if (thePlayerPos == x ,y ,z) then outputChatBox ("keep inside the Marker and type /robtime to know what's the remaining time" ,thePlayer ,0 ,250 ,0 ,false ) dxDrawText("ROBBERY IS PROGRESSING ( 50000$ )", 279, 143, 661, 201, tocolor(255, 0, 0, 255), 2.00, "pricedown", "left", "top", false, false, true, false, false) setTime ( 00 , 00 ) else return end end addEventHandler("OnClientMarkerHit" ,getRootElement() ,HitMarker ) btw i precised the "x ,y ,z" on a previous function Here's debugscript's message : ERROR; Loading Script Failed : Rob\Robbery.lua:4:')' expected near '.'
Castillo Posted March 10, 2014 Posted March 10, 2014 1: getElementPosition returns 3 values: x, y and z. 2: "OnClientMarkerHit" is wrong, the event name is "onClientMarkerHit". 3: To see if the player is inside the marker use: isElementWithinMarker.
SkrillexX Posted March 10, 2014 Author Posted March 10, 2014 I tried to correct the code , check it out , i added the first part of it. function RobMarker(thePlayer) local pos = 281.12664794922 ,-1768.4904785156 ,4.5230431556702 local theMarker = createMarker ( pos, "checkpoint" ,4.0 ,255 ,0 ,0 ) createBlip ( pos ,32 ,2 ,255 ,0 ,0 ,255 ,0 ) setTimer (RobMarker , 600000 ,0 ) end addEventHandler ("onClientResourceStart" ,getRootElement() ,RobMarker) function HitMarker(thePlayer,theMarker ) local thePlayer = getLocalPlayer() local markercheck = isElementWithinMarker(thePlayer ,theMarker ) if ( markercheck ) then outputChatBox ("keep inside the Marker and type /robtime to know what's the remaining time" ,thePlayer ,0 ,250 ,0 ,false ) dxDrawText("ROBBERY IS PROGRESSING ( 50000$ )", 279, 143, 661, 201, tocolor(255, 0, 0, 255), 2.00, "pricedown", "left", "top", false, false, true, false, false) setTime ( 00 , 00 ) else return end end addEventHandler("onClientMarkerHit" ,getRootElement() ,HitMarker )
Castillo Posted March 10, 2014 Posted March 10, 2014 dxDrawText requires of the "onClientRender" event in order to keep drawing it.
SkrillexX Posted March 10, 2014 Author Posted March 10, 2014 I can't see a way of adding onClientRender , What do you think
Karuzo Posted March 10, 2014 Posted March 10, 2014 Make a function inside of the function and add the event.
SkrillexX Posted March 10, 2014 Author Posted March 10, 2014 Euh , i don't think this code is correct but anyways .. Correct me if there's mistakes function HitMarker(thePlayer,theMarker ) local thePlayer = getLocalPlayer() local markercheck = isElementWithinMarker(thePlayer ,theMarker ) end addEventHandler("onClientMarkerHit" ,getRootElement() ,HitMarker ) function dxDraw() if ( markercheck ) then outputChatBox ("keep inside the Marker and type /robtime to know what's the remaining time" ,thePlayer ,0 ,250 ,0 ,false ) dxDrawText("ROBBERY IS PROGRESSING ( 50000$ )", 279, 143, 661, 201, tocolor(255, 0, 0, 255), 2.00, "pricedown", "left", "top", false, false, true, false, false) setTime ( 00 , 00 ) else return end end addEventHandler("onClientRender" ,getRootElement() ,dxDraw )
Castillo Posted March 10, 2014 Posted March 10, 2014 function HitMarker ( thePlayer ) if ( thePlayer == localPlayer and source == theMarker ) then addEventHandler ( "onClientRender" ,getRootElement(), dxDraw ) end end addEventHandler ( "onClientMarkerHit" ,getRootElement(), HitMarker ) function dxDraw ( ) if isElementWithinMarker ( localPlayer, theMarker ) then outputChatBox ( "keep inside the Marker and type /robtime to know what's the remaining time", 0, 250, 0 ) dxDrawText ( "ROBBERY IS PROGRESSING ( 50000$ )", 279, 143, 661, 201, tocolor(255, 0, 0, 255), 2.00, "pricedown", "left", "top", false, false, true, false, false ) end end I removed setTime because that function sets the game time, maybe you thought it did something else?
SkrillexX Posted March 10, 2014 Author Posted March 10, 2014 No , in fact , It makes the ingame time 00:00 So that i can calculate the Robbery's finish time which will be 10:00 ( 5 minutes later )
Castillo Posted March 10, 2014 Posted March 10, 2014 Yes, but if you put it inside the onClientRender event, it'll be setting the time on every render.
SkrillexX Posted March 10, 2014 Author Posted March 10, 2014 I want to make the time 00:00 Each time the player hits the marker
Castillo Posted March 10, 2014 Posted March 10, 2014 Use setTime after you add the "onClientRender" event.
SkrillexX Posted March 10, 2014 Author Posted March 10, 2014 Just like that ? function HitMarker ( thePlayer ) if ( thePlayer == localPlayer and source == theMarker ) then addEventHandler ( "onClientRender" ,getRootElement(), dxDraw ) end end setTime ( 00 ,00 )
Moderators Citizen Posted March 10, 2014 Moderators Posted March 10, 2014 Hummm almost lol. Put it right next to the addEventHandler.
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