I_R_Venom Posted May 26, 2008 Share Posted May 26, 2008 Well I am the Co-Scripter for TRSA and we are having trouble with our automated Job, Pizza Delivery. Well. When you get on the Bike you get a message saying press F2 to begin delivering Pizza. You press that you get another message saying go collect the pizza from the shop. The Blip and Marker are displayed but when you arrive at the Marker nothing happens. it is meant to be deleted another bit of text saying go to the customer and a new marker. But it doesn't. Me and the other Scripter have been Fiddling and Testing for the past 2 hours to no success. Please Could someone help. Here is the Code: function sendMessageOnPizzaStart ( player, seat, jacked) if ( getVehicleID ( source ) == 448 ) then outputChatBox ( "Press F2 to Begin Pizza Delivery" , player) bindKey ( player, "F2", "down", pizzaDeliveryHandler) end end function pizzaDeliveryHandler ( source, key, keystate ) pbplace = createBlip (1807.4569,944.3589,24.8906, 29,2,255,0,0,255,0, source ) pplace = createMarker ( 1807.4569,944.3589,24.8906, "cylinder", 3,240,0,0,200, source ) outputChatBox ( "Pickup the Pizza from the Pizza Blip on the Radar" , source ) end function onMarkerHitHandler ( player, matchingDimension ) if source == pplace then destroyElement ( pbplace ) destroyElement ( pplace ) pbcustomer = createBlip ( -2710.8235,969.6843,54.4609, 29,2,255,0,0,255,0,player ) local pcustomer = createMarker ( -2710.8235,969.6843,54.4609, "cylinder", 3,240,0,0,200,player ) outputChatBox ( "You have the Pizza, Now proceed to the customer", player ) -- send it to player only else if source == pcustomer then outputChatBox("you hit a marker3",player) destroyElement ( pbcustomer ) destroyElement ( pcustomer ) outputChatBox ( "You have successfully delivered the Pizza, Here is your Money", player ) -- send it to that player only givePlayerMoney ( player, 25 ) end end -- Event Handlers addEventHandler ( "onVehicleEnter", getRootElement(), sendMessageOnPizzaStart ) addEventHandler ( "onMarkerHit", getRootElement (), onMarkerHitHandler ) Link to comment
Ace_Gambit Posted May 26, 2008 Share Posted May 26, 2008 pplace is not known outside the pizzaDeliveryHandler function. You are trying to compare source in onMarkerHitHandler but this function does not know pplace exists. Link to comment
I_R_Venom Posted May 26, 2008 Author Share Posted May 26, 2008 I cannot see why it does not know pplace. Could you suggest how i could overcome this? Link to comment
Ace_Gambit Posted May 26, 2008 Share Posted May 26, 2008 I cannot see why it does not know pplace. Could you suggest how i could overcome this? Global scope is the magic word. Link to comment
I_R_Venom Posted May 26, 2008 Author Share Posted May 26, 2008 And Global Scope is? haha Link to comment
50p Posted May 26, 2008 Share Posted May 26, 2008 It doesn't seem to be problem with pplace because marker get created and the marker gets assigned to pplace variable (which is global since it was prefixed with local). Try to output some text in onMarkerHitHandler function, not in if statements but before them and see if that function was called at all. Also, do you get any warnings/errors? (/debugscript 3) Link to comment
I_R_Venom Posted May 26, 2008 Author Share Posted May 26, 2008 I've done that. The Marker now works, i can proceeed to the second Marker. But am now having issues with that which i am about to look at. Link to comment
I_R_Venom Posted May 26, 2008 Author Share Posted May 26, 2008 Useing the debugger, No Errors are picked up upon entering the 2nd Marker. Nothing happense. Not a single thing. Another thing is that it's posting the blips for all players. Here is the New code: function sendMessageOnPizzaStart ( player, seat, jacked) if ( getVehicleID ( source ) == 448 ) then outputChatBox ( "Press F2 to Begin Pizza Delivery" , player) bindKey ( player, "F2", "down", pizzaDeliveryHandler) end end function pizzaDeliveryHandler ( source, key, keystate ) pbplace = createBlip (-1807.4569,944.3589,24.8906, 29,2,255,0,0,255,0, source ) pplace = createMarker ( -1807.4569,944.3589,24.8906, "cylinder", 3,240,0,0,200, source ) outputChatBox ( "Pickup the Pizza from the Pizza Blip on the Radar" , source ) end function onMarkerHitHandler ( player, matchingDimension ) outputChatBox( "onMarkerHitHandler", player ) if source == pplace then outputChatBox( "onMarkerHitHandler - pplace", player ) destroyElement ( pbplace ) destroyElement ( pplace ) pbcustomer = createBlip ( -2710.8235,969.6843,54.4609, 29,2,255,0,0,255,0,player ) pcustomer = createMarker ( -2710.8235,969.6843,54.4609, "cylinder", 3,240,0,0,200,player ) outputChatBox ( "You have the Pizza, Now proceed to the customer", player ) -- send it to player only elseif source == pcustomer then outputChatBox( "onMarkerHitHandler - pcustomer", player ) destroyElement ( pbcustomer ) destroyElement ( pcustomer ) outputChatBox ( "You have successfully delivered the Pizza, Here is your Money", player ) -- send it to that player only givePlayerMoney ( player, 25 ) end end -- Event Handlers addEventHandler ( "onVehicleEnter", getRootElement(), sendMessageOnPizzaStart ) addEventHandler ( "onMarkerHit", getRootElement (), onMarkerHitHandler ) Link to comment
50p Posted May 27, 2008 Share Posted May 27, 2008 But does onMarkerHitHandler gets called when you enter the 2nd marker? Do you see the message: "onMarkerHitHandler"? Link to comment
I_R_Venom Posted May 27, 2008 Author Share Posted May 27, 2008 No, Nothing is displayed. That's what's confusing me Link to comment
Ace_Gambit Posted May 27, 2008 Share Posted May 27, 2008 (edited) This confuses even me. When you create the customer marker in let's say onPlayerJoin call back everything goes fine. Even if you define the customer marker globally it doesn't work even though the marker is created successfully. Maybe this is a bug because I've tried all possibilities that should have worked but didn't. Also when you want to make a blip explicitly visible to one or a group of players you must hide it for the entire root first. This is DP2 related as well. Edited May 27, 2008 by Guest Link to comment
I_R_Venom Posted May 27, 2008 Author Share Posted May 27, 2008 Thanks, Maybe it is a bug then. I'll have to take a look around. Thanks for everyones help. Link to comment
I_R_Venom Posted May 27, 2008 Author Share Posted May 27, 2008 New Error Time Me and the other Scripter decided to revert to using Client Side. Now it's just completely messed up. function sendMessageOnPizzaStart ( theVehicle, seat) if source == getLocalPlayer() then --if ( getVehicleID ( theVehicle ) == 448 ) then outputChatBox ( "Press F2 to Begin Pizza Delivery") bindKey ("F2", "down", pizzaDeliveryHandler) --end else outputChatBox ( "TISNT WORKINGGGG" ) end end function pizzaDeliveryHandler ( source, key, keystate ) pbplace = createBlip (-1807.4569,944.3589,24.8906, 29) pplace = createColSphere ( -1807.4569,944.3589,24.8906, 5.0 ) outputChatBox ( "Pickup the Pizza from the Pizza Blip on the Radar") bindKey ("F3", "down", pizzaPickupHandler) end function pizzaPickupHandler ( source, key, keystate ) if isElementWithinColShape ( getLocalPlayer(), pplace ) then destroyElement ( pplace ) pcustomercreateColSphere ( -2710.8235,969.6843,54.4609, 5.0 ) setElementPosition ( pbplace, -2710.8235,969.6843,54.4609 ) outputChatBox ( "You have the Pizza, Now proceed to the customer") else outputChatBox ( "You are not at the Pizza Blip") end end function onMarkerHitHandler ( player, matchingDimension ) if source == pcustomer then destroyElement ( pbplace ) destroyElement ( pcustomer ) outputChatBox ( "You have successfully delivered the Pizza, Here is your Money") triggerServerEvent ( "givemoney", getRootElement(), player, 25 ) end end function onClientColShapeHitHandler( theElement, matchingDimension ) if ( theElement == getLocalPlayer() ) then if source == pplace then outputChatBox( "Press F3 to pickup the pizza") elseif source == pcustomer then destroyElement ( pbplace ) destroyElement ( pcustomer ) outputChatBox ( "You have successfully delivered the Pizza, Here is your Money") triggerServerEvent ( "givemoney", getRootElement(), player, 25 ) end end end -- Event Handlers addEventHandler ( "onClientVehicleEnter", getRootElement(), sendMessageOnPizzaStart ) addEventHandler ( "onClientColShapeHit", getRootElement (), onClientColShapeHitHandler ) Any Help is Appreciated. Link to comment
50p Posted May 27, 2008 Share Posted May 27, 2008 source of onClientVehicleEnter is the vehicle player entered, 1st param is the player that entered the vehicle. You also missed '=' sign between pcustomer and createColShape. 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