C0DE Posted December 26, 2018 Posted December 26, 2018 Bom eu estava fazendo um script de entregador de pizza so que ele deu este erro SCRIPT ERROR: [managers]\Entregado-de-pizza\server.lua:45: unexpected symbol near ']' ERROR: Loading script failed: [managers]\Entregado-de-pizza\server.lua:45: unexpected symbol near ']' Tentei de tudo mais não consegui e resolvi pedir ajuda aqui Script : Inicio = createMarker (2097.1354980469, -1799.8197021484, 13.3828125 -1, "cylinder", 2, 255, 0, 0, 255) Final = createMarker (2803.4304199219, -1177.8922119141, 25.520080566406 -1, "cylinder", 2, 255, 0, 0, 255) Final = createBlipAttachedTo ( Final, 19 ) setElementVisibleTo ( Final, root, false ) veh = {} function inici (source) if isElementWithinMarker(source, Inicio) then if veh[source] and isElement( veh[source] ) then destroyElement ( veh[source] ) veh[source] = nil end x,y,z = getElementPosition(source) Trabalho = true veh[source] = createVehicle(448,2113.3620605469, -1782.1077880859, 13.388433456421) setElementVisibleTo ( Final, source, true ) warpPedIntoVehicle ( source, veh[source] ) outputChatBox ("#0000FF==============================================================================",source,0,0,0,true ) outputChatBox ("#FFD700[#FFFF00Info#FFD700]#FFFF00Entregue as pizzas ate a bandeira vermelha",source,0,0,0,true ) outputChatBox ("#FFD700[#FFFF00Tutorial#FFD700]#FFFF00Para saber onde fica essa bandeira vermelha aperte F11 ",source,0,0,0,true ) outputChatBox ("#0000FF==============================================================================",source,0,0,0,true ) end end addEventHandler( "onMarkerHit", Inicio, inici ) function fim (source) if veh[source] and isElement(veh[source]) then destroyElement (veh[source]) givePlayerMoney(source,2000) setElementVisibleTo ( Final, source, false ) outputChatBox("#FFFF00[#FFD700Info#FFFF00]#FFD700Você concluiu sua entrega e recebeu 2000 reais",source,0,0,0,true) else end end addEventHandler("onMarkerHit",Final ,fim) function sair (source) if (veh[source]) and isElement(veh[source]) then setElementVisibleTo ( Final, source, false ) destroyElement (veh[source]) outputChatBox("#FFD700[#FFFF00Info#FFD700]#FF0000Você saiu do veiculo e perdeu o emprego",source ,0,0,0,true ) else end end addEventHandler( "onVehicleExit", getRootElement[], sair )
+[T]rakin Posted December 26, 2018 Posted December 26, 2018 Linha 45. seria assim addEventHandler("onVehicleExit", getRootElement(), sair) 1
Jonas^ Posted December 26, 2018 Posted December 26, 2018 (edited) Mantenha seu código identado pra você poder entender melhor, adicionei alguns comentarios no código leia: local Inicio = createMarker (2097.1354980469, -1799.8197021484, 13.3828125 -1, "cylinder", 2, 255, 0, 0, 255) local Final = createMarker (2803.4304199219, -1177.8922119141, 25.520080566406 -1, "cylinder", 2, 255, 0, 0, 255) local veh = {} Final = createBlipAttachedTo ( Final, 19 ) setElementVisibleTo ( Final, root, false ) function inici (source) if isElementWithinMarker(source, Inicio) then if veh[source] and isElement( veh[source] ) then destroyElement ( veh[source] ) veh[source] = nil end Trabalho = true -- Isso não tem útilidade alguma. local x, y, z = getElementPosition (source) -- Essa variavel deve ser local. veh[source] = createVehicle(448, 2113.3620605469, -1782.1077880859, 13.388433456421) -- Deixe um espaço entre x, y, z para ficar mais organizado. setElementVisibleTo (Final, source, true) warpPedIntoVehicle (source, veh[source]) outputChatBox ("==============================================================================", source, 0, 0, 255, true) -- Aqui você pode usar um código rgb pra alterar a cor da mensagem. outputChatBox ("[#FFFF00Info#FFD700]#FFFF00Entregue as pizzas ate a bandeira vermelha", source, 255, 215, 0, true) outputChatBox ("[#FFFF00Tutorial#FFD700]#FFFF00Para saber onde fica essa bandeira vermelha aperte F11 ", source, 255, 215, 0, true) outputChatBox ("==============================================================================", source, 0, 0, 255, true) end end addEventHandler( "onMarkerHit", Inicio, inici) function fim (source) if veh[source] and isElement(veh[source]) then destroyElement (veh[source]) givePlayerMoney (source, 2000) setElementVisibleTo (Final, source, false) outputChatBox("[#FFD700Info#FFFF00]#FFD700Você concluiu sua entrega e recebeu 2000 reais", source, 100, 100, 0, true) else -- Esse else não faz sentido estar aqui, por tanto pode remove-lo end end addEventHandler("onMarkerHit",Final ,fim) function sair (source) if (veh[source]) and isElement(veh[source]) then setElementVisibleTo (Final, source, false) destroyElement (veh[source]) outputChatBox("[#FFFF00Info#FFD700]#FF0000Você saiu do veiculo e perdeu o emprego", source, 255, 215, 0, true) else -- Esse else não faz sentido estar aqui, por tanto pode remove-lo end end addEventHandler( "onVehicleExit", getRootElement(), sair) Edited December 26, 2018 by OverKILL
Other Languages Moderators Lord Henry Posted December 27, 2018 Other Languages Moderators Posted December 27, 2018 E evite de colocar source como parâmetro de função, pois fazendo isso você perde o source original dela.
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