Jump to content

Porq no se obtiene la posicion del jugador ?


iFoReX

Recommended Posts

solid ya lo abia cambiado antes de ese debugging :

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.3535,0.2417,0.5498,0.605,"GUI Editor De Casas",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Label[1] = guiCreateLabel(18,47,169,18,"Coordinadas donde se entrara",false,GUIEditor_Window[1]) 
GUIEditor_Edit[1] = guiCreateEdit(17,68,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[1],true) 
GUIEditor_Edit[2] = guiCreateEdit(17,94,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[2],true) 
GUIEditor_Edit[3] = guiCreateEdit(17,120,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[3],true) 
GUIEditor_Label[2] = guiCreateLabel(18,179,228,18,"Coordinadas donde se teletrans. a la casa",false,GUIEditor_Window[1]) 
GUIEditor_Edit[4] = guiCreateEdit(17,196,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[4],true) 
GUIEditor_Edit[5] = guiCreateEdit(17,222,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[5],true) 
GUIEditor_Edit[6] = guiCreateEdit(17,248,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[6],true) 
GUIEditor_Label[3] = guiCreateLabel(349,47,169,18,"Coordinadas donde se saldra",false,GUIEditor_Window[1]) 
GUIEditor_Edit[7] = guiCreateEdit(347,68,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[7],true) 
GUIEditor_Edit[8] = guiCreateEdit(348,94,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[8],true) 
GUIEditor_Edit[9] = guiCreateEdit(349,120,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[9],true) 
GUIEditor_Label[4] = guiCreateLabel(308,179,216,19,"Coordinadas donde se saldra al exterior",false,GUIEditor_Window[1]) 
GUIEditor_Edit[10] = guiCreateEdit(347,197,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[10],true) 
GUIEditor_Edit[11] = guiCreateEdit(348,223,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[11],true) 
GUIEditor_Edit[12] = guiCreateEdit(349,248,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[12],true) 
GUIEditor_Label[5] = guiCreateLabel(203,35,125,16,"GUI Creada By ElMota",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[5],255,255,0) 
guiSetFont(GUIEditor_Label[5],"default-bold-small") 
GUIEditor_Button[1] = guiCreateButton(18,148,163,27,"Obtener Posicion",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(351,148,163,27,"Obtener Posicion",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(17,274,163,27,"Obtener Posicion",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(351,274,163,27,"Obtener Posicion",false,GUIEditor_Window[1]) 
GUIEditor_Button[5] = guiCreateButton(207,324,110,30,"Crear Casa",false,GUIEditor_Window[1]) 
  
GUIEditor_Window[2] = guiCreateWindow(0.1523,0.245,0.2021,0.3283,"GUI Extras",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
GUIEditor_Label[6] = guiCreateLabel(9,41,71,20,"Dimension",false,GUIEditor_Window[2]) 
GUIEditor_Edit[13] = guiCreateEdit(77,38,119,25,"",false,GUIEditor_Window[2]) 
GUIEditor_Label[7] = guiCreateLabel(9,76,71,20,"World",false,GUIEditor_Window[2]) 
GUIEditor_Edit[14] = guiCreateEdit(77,73,119,25,"",false,GUIEditor_Window[2]) 
GUIEditor_Label[8] = guiCreateLabel(9,112,71,20,"Costo",false,GUIEditor_Window[2]) 
GUIEditor_Edit[15] = guiCreateEdit(77,106,119,25,"",false,GUIEditor_Window[2]) 
guiSetVisible(GUIEditor_Window[1], false) 
guiSetVisible(GUIEditor_Window[2], false) 
showCursor(false) 
  
local me = getLocalPlayer(); 
  
 addEventHandler( 'onClientGUIClick', root, function( btn ) 
    if btn ~= 'left' then return false; end; 
    if source == GUIEditor_Button[1] then 
      local x, y, z = getElementPosition( me ); 
      guiSetText( GUIEditor_Edit[1], x ); 
      guiSetText( GUIEditor_Edit[2], y ); 
      guiSetText( GUIEditor_Edit[3], z );    
    elseif source == GUIEditor_Button[3] then 
      local x, y, z = getElementPosition( me ); 
      guiSetText( GUIEditor_Edit[4], x ); 
      guiSetText( GUIEditor_Edit[5], y ); 
      guiSetText( GUIEditor_Edit[6], z ); 
    elseif source == GUIEditor_Button[2] then 
      local x, y, z = getElementPosition( me ); 
      guiSetText( GUIEditor_Edit[7], x ); 
      guiSetText( GUIEditor_Edit[8], y ); 
      guiSetText( GUIEditor_Edit[9], z ); 
    elseif source == GUIEditor_Button[4] then 
      local x, y, z = getElementPosition( me ); 
      guiSetText( GUIEditor_Edit[10], x ); 
      guiSetText( GUIEditor_Edit[11], y ); 
      guiSetText( GUIEditor_Edit[12], z ); 
 elseif source == GUIEditor_Button[5] then 
      marker = createMarker( tonumber(guiGetText( GUIEditor_Edit[1] )),tonumber(guiGetText( GUIEditor_Edit[2] )),tonumber(guiGetText( GUIEditor_Edit[3]  ) - 1 ) , "cylinder", 1.7, 0, 170, 0, 90 )          -----Como vez aqui ta el "marker" 
      marker2 = createMarker( tonumber(guiGetText( GUIEditor_Edit[7] )),tonumber(guiGetText( GUIEditor_Edit[8] )),tonumber(guiGetText( GUIEditor_Edit[9]  ) - 1 ) , "cylinder", 1.7, 255, 255, 255, 60 ) 
      guiGetText( GUIEditor_Edit[11] ); 
      guiGetText( GUIEditor_Edit[12] );   
      end; 
  end ); 
  
function ver ( ) 
    guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
    showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) 
    guiSetVisible ( GUIEditor_Window[2], not guiGetVisible ( GUIEditor_Window[2] ) ) 
    showCursor ( guiGetVisible ( GUIEditor_Window[2] ) ) 
end 
bindKey ( "n","down", ver ) 
  
function markerHit ( hitPlayer ) 
    if ( hitPlayer == localPlayer ) then 
        GUIEditor_Window[1] = guiCreateWindow(0.6006,0.4867,0.1992,0.45,"GUI Casas",true) 
        GUIEditor_Label[1] = guiCreateLabel(25,36,262,20,"Dueño de la casa : \"\"",false,GUIEditor_Window[1]) 
        GUIEditor_Label[2] = guiCreateLabel(25,58,231,19,"Precio : \"\"",false,GUIEditor_Window[1]) 
        GUIEditor_Button[1] = guiCreateButton(9,107,179,30,"Comprar Casa",false,GUIEditor_Window[1]) 
        GUIEditor_Button[2] = guiCreateButton(9,107,179,30,"Comprar Casa",false,GUIEditor_Window[1]) 
        GUIEditor_Button[3] = guiCreateButton(9,141,179,30,"Vender Casa",false,GUIEditor_Window[1]) 
        GUIEditor_Button[4] = guiCreateButton(9,175,179,30,"Bloquear Casa",false,GUIEditor_Window[1]) 
        GUIEditor_Button[5] = guiCreateButton(10,208,179,32,"Entrar a la Casa",false,GUIEditor_Window[1]) 
    end 
end 
addEventHandler ( "onClientMarkerHit", marker, markerHit ) 

Link to comment

Ah, ahora que veo todo tu script me doy cuenta de que estas agregando el evento antes de crear el marker.

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.3535,0.2417,0.5498,0.605,"GUI Editor De Casas",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Label[1] = guiCreateLabel(18,47,169,18,"Coordinadas donde se entrara",false,GUIEditor_Window[1]) 
GUIEditor_Edit[1] = guiCreateEdit(17,68,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[1],true) 
GUIEditor_Edit[2] = guiCreateEdit(17,94,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[2],true) 
GUIEditor_Edit[3] = guiCreateEdit(17,120,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[3],true) 
GUIEditor_Label[2] = guiCreateLabel(18,179,228,18,"Coordinadas donde se teletrans. a la casa",false,GUIEditor_Window[1]) 
GUIEditor_Edit[4] = guiCreateEdit(17,196,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[4],true) 
GUIEditor_Edit[5] = guiCreateEdit(17,222,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[5],true) 
GUIEditor_Edit[6] = guiCreateEdit(17,248,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[6],true) 
GUIEditor_Label[3] = guiCreateLabel(349,47,169,18,"Coordinadas donde se saldra",false,GUIEditor_Window[1]) 
GUIEditor_Edit[7] = guiCreateEdit(347,68,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[7],true) 
GUIEditor_Edit[8] = guiCreateEdit(348,94,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[8],true) 
GUIEditor_Edit[9] = guiCreateEdit(349,120,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[9],true) 
GUIEditor_Label[4] = guiCreateLabel(308,179,216,19,"Coordinadas donde se saldra al exterior",false,GUIEditor_Window[1]) 
GUIEditor_Edit[10] = guiCreateEdit(347,197,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[10],true) 
GUIEditor_Edit[11] = guiCreateEdit(348,223,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[11],true) 
GUIEditor_Edit[12] = guiCreateEdit(349,248,166,26,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[12],true) 
GUIEditor_Label[5] = guiCreateLabel(203,35,125,16,"GUI Creada By ElMota",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[5],255,255,0) 
guiSetFont(GUIEditor_Label[5],"default-bold-small") 
GUIEditor_Button[1] = guiCreateButton(18,148,163,27,"Obtener Posicion",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(351,148,163,27,"Obtener Posicion",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(17,274,163,27,"Obtener Posicion",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(351,274,163,27,"Obtener Posicion",false,GUIEditor_Window[1]) 
GUIEditor_Button[5] = guiCreateButton(207,324,110,30,"Crear Casa",false,GUIEditor_Window[1]) 
  
GUIEditor_Window[2] = guiCreateWindow(0.1523,0.245,0.2021,0.3283,"GUI Extras",true) 
guiWindowSetMovable(GUIEditor_Window[2],false) 
guiWindowSetSizable(GUIEditor_Window[2],false) 
GUIEditor_Label[6] = guiCreateLabel(9,41,71,20,"Dimension",false,GUIEditor_Window[2]) 
GUIEditor_Edit[13] = guiCreateEdit(77,38,119,25,"",false,GUIEditor_Window[2]) 
GUIEditor_Label[7] = guiCreateLabel(9,76,71,20,"World",false,GUIEditor_Window[2]) 
GUIEditor_Edit[14] = guiCreateEdit(77,73,119,25,"",false,GUIEditor_Window[2]) 
GUIEditor_Label[8] = guiCreateLabel(9,112,71,20,"Costo",false,GUIEditor_Window[2]) 
GUIEditor_Edit[15] = guiCreateEdit(77,106,119,25,"",false,GUIEditor_Window[2]) 
guiSetVisible(GUIEditor_Window[1], false) 
guiSetVisible(GUIEditor_Window[2], false) 
showCursor(false) 
  
local me = getLocalPlayer(); 
  
 addEventHandler( 'onClientGUIClick', root, function( btn ) 
    if btn ~= 'left' then return false; end; 
    if source == GUIEditor_Button[1] then 
      local x, y, z = getElementPosition( me ); 
      guiSetText( GUIEditor_Edit[1], x ); 
      guiSetText( GUIEditor_Edit[2], y ); 
      guiSetText( GUIEditor_Edit[3], z );   
    elseif source == GUIEditor_Button[3] then 
      local x, y, z = getElementPosition( me ); 
      guiSetText( GUIEditor_Edit[4], x ); 
      guiSetText( GUIEditor_Edit[5], y ); 
      guiSetText( GUIEditor_Edit[6], z ); 
    elseif source == GUIEditor_Button[2] then 
      local x, y, z = getElementPosition( me ); 
      guiSetText( GUIEditor_Edit[7], x ); 
      guiSetText( GUIEditor_Edit[8], y ); 
      guiSetText( GUIEditor_Edit[9], z ); 
    elseif source == GUIEditor_Button[4] then 
      local x, y, z = getElementPosition( me ); 
      guiSetText( GUIEditor_Edit[10], x ); 
      guiSetText( GUIEditor_Edit[11], y ); 
      guiSetText( GUIEditor_Edit[12], z ); 
 elseif source == GUIEditor_Button[5] then 
      marker = createMarker( tonumber(guiGetText( GUIEditor_Edit[1] )),tonumber(guiGetText( GUIEditor_Edit[2] )),tonumber(guiGetText( GUIEditor_Edit[3]  ) - 1 ) , "cylinder", 1.7, 0, 170, 0, 90 )          -----Como vez aqui ta el "marker" 
      marker2 = createMarker( tonumber(guiGetText( GUIEditor_Edit[7] )),tonumber(guiGetText( GUIEditor_Edit[8] )),tonumber(guiGetText( GUIEditor_Edit[9]  ) - 1 ) , "cylinder", 1.7, 255, 255, 255, 60 ) 
      guiGetText( GUIEditor_Edit[11] ); 
      guiGetText( GUIEditor_Edit[12] );   
      end; 
  end ); 
  
function ver ( ) 
    guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
    showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) 
    guiSetVisible ( GUIEditor_Window[2], not guiGetVisible ( GUIEditor_Window[2] ) ) 
    showCursor ( guiGetVisible ( GUIEditor_Window[2] ) ) 
end 
bindKey ( "n","down", ver ) 
  
function markerHit ( hitPlayer ) 
    if ( hitPlayer == localPlayer and source == marker ) then 
        GUIEditor_Window[1] = guiCreateWindow(0.6006,0.4867,0.1992,0.45,"GUI Casas",true) 
        GUIEditor_Label[1] = guiCreateLabel(25,36,262,20,"Dueño de la casa : \"\"",false,GUIEditor_Window[1]) 
        GUIEditor_Label[2] = guiCreateLabel(25,58,231,19,"Precio : \"\"",false,GUIEditor_Window[1]) 
        GUIEditor_Button[1] = guiCreateButton(9,107,179,30,"Comprar Casa",false,GUIEditor_Window[1]) 
        GUIEditor_Button[2] = guiCreateButton(9,107,179,30,"Comprar Casa",false,GUIEditor_Window[1]) 
        GUIEditor_Button[3] = guiCreateButton(9,141,179,30,"Vender Casa",false,GUIEditor_Window[1]) 
        GUIEditor_Button[4] = guiCreateButton(9,175,179,30,"Bloquear Casa",false,GUIEditor_Window[1]) 
        GUIEditor_Button[5] = guiCreateButton(10,208,179,32,"Entrar a la Casa",false,GUIEditor_Window[1]) 
    end 
end 
addEventHandler ( "onClientMarkerHit", root, markerHit ) 

Link to comment

mmm... nose si esto sirva

function onPlayerQuit ( ) 
if source == GUIEditor_Button[6] then 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
            setAccountData (  ) -- No se como aserle aqui man, que debo guardar D: 
      end 
end 
  
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) 
  

Link to comment
mmm... nose si esto sirva
function onPlayerQuit ( ) 
if source == GUIEditor_Button[6] then 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
            setAccountData (  ) -- No se como aserle aqui man, que debo guardar D: 
      end 
end 
  
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) 
  

Creo que debes crear la variable de la casa y guardarla en una "key" llamada "casa" o algo asi,

luego usas un if, para ver si la key posee la variable y atribuir los permisos.

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...