depato123 Posted May 31, 2013 Share Posted May 31, 2013 Hola, quería saber como se puede hacer esto: 1º: un marker que se cree cuando un usuario entre a un determinado vehículo, ej: 574 2º: un marker que se cree al pasar por otro marker 3º: un marker que te de dinero al pasar por el Eso solo, si me pueden ayudar gracias edit* PD: en client Link to comment
Alexs Posted May 31, 2013 Share Posted May 31, 2013 onClientVehicleEnter: Para cuando entras a un vehículo. getElementModel: Para saber el modelo de ese vehículo. givePlayerMoney: Para dar dinero (recomendado usar solo en server side). onClientMarkerHit: Para cuando el cliente toca un marcador. triggerServerEvent: Para dar dinero server side con un evento client side. Link to comment
depato123 Posted May 31, 2013 Author Share Posted May 31, 2013 onClientVehicleEnter: Para cuando entras a un vehículo.getElementModel: Para saber el modelo de ese vehículo. givePlayerMoney: Para dar dinero (recomendado usar solo en server side). onClientMarkerHit: Para cuando el cliente toca un marcador. triggerServerEvent: Para dar dinero server side con un evento client side. Gracias, intente hacer esto pero no me funciono. perdón, es que no soy muy buen scripter addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then createMarker ( -2350.89, 2469.5, 5 [, string "checkpoint", 2.5, 255, 255, 0, 255 ] ) end end ) Link to comment
Castillo Posted May 31, 2013 Share Posted May 31, 2013 createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) Link to comment
depato123 Posted May 31, 2013 Author Share Posted May 31, 2013 Gracias, ¿hay alguna manera de elejir el auto que tiene que ser?, por ejemplo yo quiero que el unico auto al que le aparezcan los markers sea el 574 Link to comment
Castillo Posted May 31, 2013 Share Posted May 31, 2013 if ( getElementModel ( source ) == 574 ) then Link to comment
depato123 Posted May 31, 2013 Author Share Posted May 31, 2013 if ( getElementModel ( source ) == 574 ) then ¿eso donde iría? addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) end end ) Link to comment
Castillo Posted May 31, 2013 Share Posted May 31, 2013 Antes de createMarker pero despues del 'if'. Link to comment
depato123 Posted May 31, 2013 Author Share Posted May 31, 2013 Antes de createMarker pero despues del 'if'. addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then if ( getElementModel ( source ) == 574 ) then createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) end end ) ahora no me crea el marker Link to comment
Renkon Posted May 31, 2013 Share Posted May 31, 2013 lee el debugscript 3 y vas a encontrar el motivo del error. Es muy simple, agregaste un if. ¿Que te falta ahora? Link to comment
depato123 Posted May 31, 2013 Author Share Posted May 31, 2013 lee el debugscript 3 y vas a encontrar el motivo del error. Es muy simple, agregaste un if. ¿Que te falta ahora? addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then if ( getElementModel ( source ) == 574 ) then createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) end end ) ¿así esta bien? Link to comment
Castillo Posted May 31, 2013 Share Posted May 31, 2013 No, te falta un 'end' para cerrar el otro 'if'. Link to comment
depato123 Posted May 31, 2013 Author Share Posted May 31, 2013 No, te falta un 'end' para cerrar el otro 'if'. addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() end end if ( getElementModel ( source ) == 574 ) then createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) end end ) sigue sin crear el marker Link to comment
NodZen Posted May 31, 2013 Share Posted May 31, 2013 Pruevalo así addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then if ( getElementModel ( source ) == 574 ) then createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) end end end ) Link to comment
depato123 Posted May 31, 2013 Author Share Posted May 31, 2013 Pruevalo así addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then if ( getElementModel ( source ) == 574 ) then createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) end end end ) gracias ¿hay alguna manera de eliminar un marker osea un destroyelement o algo así? Link to comment
NodZen Posted May 31, 2013 Share Posted May 31, 2013 Probá ponerle al marker como variable, y despues lo destruyes con destroyElement. Link to comment
depato123 Posted June 1, 2013 Author Share Posted June 1, 2013 Probá ponerle al marker como variable, y despues lo destruyes con destroyElement. Intente hacer esto, pero tengo un problema. addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then if ( getElementModel ( source ) == 574 ) then Marker1 = createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) end end end ) function Marker1 ( hitPlayer, matchingDimension ) Marker2 = createMarker ( -2281.30, 2403.80, 4.9, "checkpoint", 2.5, 0, 255, 0, 255 ) destroyElement ( Marker1 ) end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker1 ) function Marker2 ( hitPlayer, matchingDimension ) Marker3 = createMarker ( -2281.30, 2403.80, 4.9, "checkpoint", 2.5, 0, 255, 255, 255 ) givePlayerMoney ( thePlayer, 50 ) destroyElement ( Marker2 ) end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker2 ) Al pasar por el marker 2 se traba todo el gta sa y debo cerrarlo con el administrador de tareas, a un amigo también le paso lo mismo al pasar por el marker2 Link to comment
NodZen Posted June 1, 2013 Share Posted June 1, 2013 El problema es que llamas a tu funcion igual que a tu Marker y despues la destruyes... Cambiale de nombre. Link to comment
depato123 Posted June 1, 2013 Author Share Posted June 1, 2013 El problema es que llamas a tu funcion igual que a tu Marker y después la destruyes... Cambiale de nombre. osea ¿que?, ¿que tengo que cambiar? Link to comment
FraN-724 Posted June 1, 2013 Share Posted June 1, 2013 A lo que se refiere Nod es que agas esto addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then if ( getElementModel ( source ) == 574 ) then Marker1 = createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) end end end ) function Marker20 ( hitPlayer, matchingDimension ) Marker2 = createMarker ( -2281.30, 2403.80, 4.9, "checkpoint", 2.5, 0, 255, 0, 255 ) destroyElement ( Marker1 ) end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker20 ) function Marker50 ( hitPlayer, matchingDimension ) Marker3 = createMarker ( -2281.30, 2403.80, 4.9, "checkpoint", 2.5, 0, 255, 255, 255 ) givePlayerMoney ( thePlayer, 50 ) destroyElement ( Marker2 ) end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker50 ) Link to comment
depato123 Posted June 1, 2013 Author Share Posted June 1, 2013 A lo que se refiere Nod es que agas esto... Se me sigue trabando el juego cuando paso por el marker 2 Link to comment
Sensacion Posted June 1, 2013 Share Posted June 1, 2013 Usando tu código: addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then if ( getElementModel ( source ) == 574 ) then Marker1 = createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) end end end ) function Marker20 ( hitPlayer, matchingDimension ) if source == Marker1 then Marker2 = createMarker ( -2281.30, 2403.80, 4.9, "checkpoint", 2.5, 0, 255, 0, 255 ) destroyElement ( Marker1 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker20 ) function Marker50 ( hitPlayer, matchingDimension ) if source == Marker2 then Marker3 = createMarker ( -2281.30, 2403.80, 4.9, "checkpoint", 2.5, 0, 255, 255, 255 ) givePlayerMoney ( thePlayer, 50 ) destroyElement ( Marker2 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker50 ) pero si sigues así el código será más grande, mejor usa tablas para las posiciones x,y,z de los marker. Link to comment
depato123 Posted June 1, 2013 Author Share Posted June 1, 2013 Usando tu código:... Gracias, ahora tengo otro problema. Cuando el user pasa por el marker no le da los 50$ que están indicados en el script function Marker50 ( hitPlayer, matchingDimension ) if source == Marker2 then Marker3 = createMarker ( -2263.2, 2339.8, 4.8, "checkpoint", 2.5, 0, 255, 0, 255 ) givePlayerMoney ( thePlayer, 50 ) destroyElement ( Marker2 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker50 ) Link to comment
Sensacion Posted June 1, 2013 Share Posted June 1, 2013 es que es clientside y solo usa 1 argumento, cambialo a esto: givePlayerMoney ( 50 ) Link to comment
depato123 Posted June 1, 2013 Author Share Posted June 1, 2013 es que es clientside y solo usa 1 argumento, cambialo a esto:givePlayerMoney ( 50 ) Gracias amigo, casi lo termino. Solo tengo un par de errores más: addEventHandler("onClientVehicleEnter", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then if ( getElementModel ( source ) == 574 ) then Marker1 = createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) Blip1 = createBlip ( -2350.89 , 2469.5 , 5 , 0 ) end end end ) function Marker20 ( hitPlayer, matchingDimension ) if source == Marker1 then Marker2 = createMarker ( -2281.30, 2403.80, 4.9, "checkpoint", 2.5, 0, 255, 0, 255 ) Blip2 = createBlip ( -2281.30 , 2403.80 , 4.9 , 0 ) destroyElement ( Marker1 ) destroyElement ( Blip1 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker20 ) function Marker50 ( hitPlayer, matchingDimension ) if source == Marker2 then Marker3 = createMarker ( -2263.2, 2339.8, 4.8, "checkpoint", 2.5, 0, 255, 0, 255 ) Blip3 = createBlip ( -2263.2 , 2339.8 , 4.8 , 0 ) givePlayerMoney ( 50 ) destroyElement ( Marker2 ) destroyElement ( Blip2 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker50 ) function Marker80 ( hitPlayer, matchingDimension ) if source == Marker3 then Marker4 = createMarker ( -2327.39, 2390.3, 5.8, "checkpoint", 2.5, 0, 255, 0, 255 ) Blip4 = createBlip ( -2327.39 , 2390.3 , 5.8 , 0 ) givePlayerMoney ( 50 ) destroyElement ( Marker3 ) destroyElement ( Blip3 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker80 ) function Marker110 ( hitPlayer, matchingDimension ) if source == Marker4 then Marker5 = createMarker ( -2451.8, 2334.30, 4.8, "checkpoint", 2.5, 0, 255, 0, 255 ) Blip5 = createBlip ( -2451.8 , 2334.30 , 4.8 , 0 ) givePlayerMoney ( 50 ) destroyElement ( Marker4 ) destroyElement ( Blip4 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker110 ) function Marker140 ( hitPlayer, matchingDimension ) if source == Marker5 then Marker6 = createMarker ( -2470.7, 2263.2, 4.8, "checkpoint", 2.5, 0, 255, 0, 255 ) Blip6 = createBlip ( -2470.7 , 2263.2 , 4.8 , 0 ) givePlayerMoney ( 50 ) destroyElement ( Marker5 ) destroyElement ( Blip5 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker140 ) function Marker170 ( hitPlayer, matchingDimension ) if source == Marker6 then Marker7 = createMarker ( -2539.80, 2283, 4.8, "checkpoint", 2.5, 0, 255, 0, 255 ) Blip7 = createBlip ( -2539.80 , 2283 , 4.8 , 0 ) givePlayerMoney ( 50 ) destroyElement ( Marker6 ) destroyElement ( Blip6 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker170 ) function Marker200 ( hitPlayer, matchingDimension ) if source == Marker7 then Marker8 = createMarker ( -2557.5, 2370.3, 10.8, "checkpoint", 2.5, 0, 255, 0, 255 ) Blip8 = createBlip ( -2557.5 , 2370.3 , 10.8 , 0 ) givePlayerMoney ( 50 ) destroyElement ( Marker7 ) destroyElement ( Blip7 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker200 ) function Marker230 ( hitPlayer, matchingDimension ) if source == Marker8 then Marker9 = createMarker ( -2438, 2431.8, 13.6, "checkpoint", 2.5, 0, 255, 0, 255 ) Blip9 = createBlip ( -2438 , 2431.8 , 13.6 , 0 ) givePlayerMoney ( 50 ) destroyElement ( Marker8 ) destroyElement ( Blip8 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker230 ) function Marker270 ( hitPlayer, matchingDimension ) if source == Marker9 then Marker10 = createMarker ( -2436.5, 2476, 13.8, "checkpoint", 2.5, 0, 255, 0, 255 ) Blip10 = createBlip ( -2436.5 , 2476 , 13.8 , 0 ) givePlayerMoney ( 50 ) destroyElement ( Marker9 ) destroyElement ( Blip9 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker270 ) function Marker300 ( hitPlayer, matchingDimension ) if source == Marker10 then Marker11 = createMarker ( -2350.89, 2469.5, 5, "checkpoint", 2.5, 255, 255, 0, 255 ) Blip11 = createBlip ( -2350.89 , 2469.5 , 5 , 0 ) givePlayerMoney ( 50 ) destroyElement ( Marker10 ) destroyElement ( Blip10 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker300 ) function Marker330 ( hitPlayer, matchingDimension ) if source == Marker11 then destroyElement ( Marker11 ) destroyElement ( Blip11 ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), Marker330 ) addEventHandler("OnClientVehicleExit", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then destroyElement ( Marker1 ) destroyElement ( Marker2 ) destroyElement ( Marker3 ) destroyElement ( Marker4 ) destroyElement ( Marker5 ) destroyElement ( Marker6 ) destroyElement ( Marker7 ) destroyElement ( Marker8 ) destroyElement ( Marker9 ) destroyElement ( Marker10 ) destroyElement ( Marker11 ) end end ) addEventHandler("OnClientVehicleExit", getRootElement(), function(thePlayer, seat) if thePlayer == getLocalPlayer() then destroyElement ( Blip1 ) destroyElement ( Blip2 ) destroyElement ( Blip3 ) destroyElement ( Blip4 ) destroyElement ( Blip5 ) destroyElement ( Blip6 ) destroyElement ( Blip7 ) destroyElement ( Blip8 ) destroyElement ( Blip9 ) destroyElement ( Blip10 ) destroyElement ( Blip11 ) end end ) 1º: Si mi amigo tiene el el mismo auto puede ver mi marker y usarlo y viceversa ¿Como puedo hacer para que cada usuario vea su propio marker? 2º: intente hacer que si alguien sale del auto los blips y los markers se borren pero no me funciono ¿Hay alguna manera de hacerlo? Link to comment
Recommended Posts