iFoReX Posted April 8, 2012 Posted April 8, 2012 buee como dice ai quiero aser que el jugador cuando apriete el buton "ir a Ls" se teletransporte a una posicion espesifica pero no se que elemento poner me ayudarian ? GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(0.3875,0.2833,0.2175,0.5034,"Sistema de Guia de viajes",true) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(15,50,131,40,"Ir a Ls",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(14,111,131,40,"Ir a Sf",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(15,172,131,40,"Ir a la Isla",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(9,224,156,23,"-------------------------",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Button[4] = guiCreateButton(17,246,126,41,"Cancelar",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) local marker = createMarker(1056.43030, -2728.39600, 7, "cylinder", 1.7, 255, 255, 255, 150) function markerHit (hitPlayer) if ( hitPlayer == localPlayer ) then guiSetVisible (GUIEditor_Window[1], true) showCursor (true) end end addEventHandler ("onClientMarkerHit", marker, markerHit) addEventHandler("onClientGUIClick", root, function (thePlayer) if (source == GUIEditor_Button[1]) then setElementPosition(thePlayer, 1742.98804, -1949.79041, 14.11719) elseif (source == GUIEditor_Button[4]) then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end )
Castillo Posted April 8, 2012 Posted April 8, 2012 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(0.3875,0.2833,0.2175,0.5034,"Sistema de Guia de viajes",true) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(15,50,131,40,"Ir a Ls",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(14,111,131,40,"Ir a Sf",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(15,172,131,40,"Ir a la Isla",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(9,224,156,23,"-------------------------",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Button[4] = guiCreateButton(17,246,126,41,"Cancelar",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) local marker = createMarker(1056.43030, -2728.39600, 7, "cylinder", 1.7, 255, 255, 255, 150) function markerHit (hitPlayer) if ( hitPlayer == localPlayer ) then guiSetVisible (GUIEditor_Window[1], true) showCursor (true) end end addEventHandler ("onClientMarkerHit", marker, markerHit) addEventHandler("onClientGUIClick", root, function ( ) if ( source == GUIEditor_Button[1] ) then setElementPosition( localPlayer, 1742.98804, -1949.79041, 14.11719 ) elseif ( source == GUIEditor_Button[4] ) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) end end )
iFoReX Posted April 8, 2012 Author Posted April 8, 2012 mmm man y esto ? no se podria asi ? ... addEventHandler("onClientGUIClick", root, function ( ) if ( source == GUIEditor_Button[1] ) then setElementPosition( localPlayer, 1742.98804, -1949.79041, 14.11719 ) local money = getPlayerMoney(thePlayer) if (money > 10000) then takePlayerMoney ( 10000) ) elseif ( source == GUIEditor_Button[2] ) then setElementPosition( localPlayer, 1742.98804, -1949.79041, 14.11719 ) elseif ( source == GUIEditor_Button[4] ) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) end end )
Castillo Posted April 8, 2012 Posted April 8, 2012 Primero: Otra vez pusiste "thePlayer" que no esta definido en ninguna parte. Segundo: Pusiste un parentesis extra en takePlayerMoney. Tercero: Si le quitas el dinero client side no se va a sincronizar con el servidor, osea no se la va a quitar.
iFoReX Posted April 8, 2012 Author Posted April 8, 2012 nose si servira man sigo confundiendome con los triggers D: guia.lua GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(0.3875,0.2833,0.2175,0.5034,"Sistema de Guia de viajes",true) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(15,50,131,40,"Ir a Ls",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(14,111,131,40,"Ir a Sf",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(15,172,131,40,"Ir a la Isla",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(9,224,156,23,"-------------------------",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Button[4] = guiCreateButton(17,246,126,41,"Cancelar",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) local marker = createMarker(1056.43030, -2728.39600, 7, "cylinder", 1.7, 255, 255, 255, 150) local marker2 = createMarker(1743.13477, -1944.71582, 13.56561, "cylinder", 1.5, 255,255,255,150) function markerHit (hitPlayer) if ( hitPlayer == localPlayer ) then guiSetVisible (GUIEditor_Window[1], true) guiSetEnabled(GUIEditor_Button[3],false) showCursor (true) end end addEventHandler ("onClientMarkerHit", marker, markerHit) function markerHitLs (hitPlayer) if ( hitPlayer == localPlayer ) then guiSetVisible (GUIEditor_Window[1], true) guiSetEnabled(GUIEditor_Button[1],false) showCursor (true) end end addEventHandler ("onClientMarkerHit", marker2, markerHitLs) addEventHandler("onClientGUIClick", root, function ( ) if ( source == GUIEditor_Button[1] ) then setElementPosition( localPlayer, 1742.98804, -1949.79041, 14.11719 ) triggerServerEvent ( "qd", getLocalPlayer() ) elseif ( source == GUIEditor_Button[2] ) then setElementPosition( localPlayer, 1742.98804, -1949.79041, 14.11719 ) elseif ( source == GUIEditor_Button[4] ) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) end end ) guia_sv.lua function qm() local money = getPlayerMoney(thePlayer) if (money > 10000) then takePlayerMoney ( 10000) end addEvent( "qd", true ) addEventHandler( "qd", getRootElement(), qm ) lo probare
Edikosh998 Posted April 8, 2012 Posted April 8, 2012 (edited) function qm() local money = getPlayerMoney(source) if (money > 10000) then takePlayerMoney (source, 10000) end end addEvent( "qd", true ) addEventHandler( "qd", getRootElement(), qm ) Los eventos tiene un SOURCE. El source lo definis en el segundo argumento del triggerServerEvent (ahi pusistes localPlayer,por lo tanto el source = player) Si me falto un end, es que al revisarlo por aca no es como el Notepad++ Edited April 8, 2012 by Guest
Castillo Posted April 8, 2012 Posted April 8, 2012 function qm ( ) local money = getPlayerMoney ( source ) if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) end end addEvent( "qd", true ) addEventHandler( "qd", getRootElement(), qm ) Te falto un "end".
iFoReX Posted April 8, 2012 Author Posted April 8, 2012 ?? function qm() local money = getPlayerMoney(source) if (money > 10000) and if (takePlayerMoney (source, 10000)) then setElementPosition( localPlayer, 1742.98804, -1949.79041, 14.11719 ) else OutputChatBox("No Tienes Suficiente Dinero") end end addEvent( "qd", true ) addEventHandler( "qd", getRootElement(), qm ) nose si funcione mejor asi pero me aparece que tengo un if malo
Castillo Posted April 8, 2012 Posted April 8, 2012 function qm ( ) local money = getPlayerMoney ( source ) if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) setElementPosition( source, 1742.98804, -1949.79041, 14.11719 ) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end addEvent( "qd", true ) addEventHandler( "qd", getRootElement(), qm )
iFoReX Posted April 8, 2012 Author Posted April 8, 2012 solid y como podria aserle para viajar gratis solo teniendo mi nombre ?
Edikosh998 Posted April 8, 2012 Posted April 8, 2012 function qm ( ) local money = getPlayerMoney ( source ) local name = getPlayerName ( source ) if name == "ElMota" then setElementPosition( source, 1742.98804, -1949.79041, 14.11719 ) else if ( money >= 10000 ) then takePlayerMoney ( source, 10000 ) setElementPosition( source, 1742.98804, -1949.79041, 14.11719 ) else outputChatBox ( "No Tienes Suficiente Dinero", source ) end end end addEvent( "qd", true ) addEventHandler( "qd", getRootElement(), qm )
Soren Posted April 8, 2012 Posted April 8, 2012 solo una cosa ElMota, no es por ser agresivo pero lo hare agresivo. Carajo deja de usar thePlayer como definido! usa localPlayer o source
iFoReX Posted April 8, 2012 Author Posted April 8, 2012 Soren uso eso porq todavia no entiendo eso de thePlayer, LocalPlayer y source D:
Alexs Posted April 8, 2012 Posted April 8, 2012 Soren uso eso porq todavia no entiendo eso de thePlayer, LocalPlayer y source D: es quien gatilla la funcion, pero debes definirlo
iFoReX Posted April 8, 2012 Author Posted April 8, 2012 si se lo de que gatilla la funcion, lo q no se es como definirlo y en que parte
Edikosh998 Posted April 8, 2012 Posted April 8, 2012 Mira, para que te acuerdes thePlayer = lo usas mas que todo en un comando de lado server localPlayer = SIEMPRE Y CUANDO queres definir al jugador en client side source = el source puede ser tanto un jugador como un auto, entre otro elementos...Pero si vos haces tu evento y en el trigger ponen ("onEvent",getLocalPlayer()), no dudes que source = player. Ojala te sirva
Recommended Posts