Jump to content

Comandos


JesusAliso

Recommended Posts

  • Replies 72
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

me explican lo del "triggerClientEvent"

FranN, Se creo el marker "cuando entro al marker se cursor funciona pero la Window no aparece" Por que es esto? o hay que agregarle el triggerClientEvent

Usa:

triggerServerEvent 

en el client-side, porque no puedes juntar funciones client-side y server-side.

Link to comment
       cylinder= createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) 
function GUI(hitPlayer) 
    triggerClientEvent(hitPlayer,"showGUI",getRootElement(),hitPlayer) 
end 
addEventHandler("onMarkerHit",cylinder,GUI) 

Link to comment

Bueno, me confundí por que no sabia donde poner el guisetVisible ya que esta creada en la funcion mira.

Server

local Marker = createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) 
  
  
function GUI(hitPlayer) 
    triggerClientEvent(hitPlayer,"showGUI",getRootElement(),hitPlayer) 
end 
addEventHandler("onMarkerHit",cylinder,GUI) 
  
function showGUI (thePlayer) 
if (source == Marker) then 
triggerClientEvent (thePlayer,"showGUI",getRootElement(),thePlayer) 
end 
end 
addEventHandler ("onMarkerHit",getRootElement(),showGUI) 
  
function arm11 (thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 120000 then 
    takePlayerMoney ( thePlayer, 120000 ) 
    giveWeapon ( source, 31, 2880 ) 
end 
end 
addEvent( "arm1", true ) 
addEventHandler( "arm1", getRootElement(), arm11 ) 
  
  
  
function arm22 (thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 155000 then 
    takePlayerMoney ( thePlayer, 155000 ) 
    giveWeapon ( source, 34, 100 ) 
end 
end 
addEvent( "arm2", true ) 
addEventHandler( "arm2", getRootElement(), arm22 ) 
  
function arm33 (thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 20000 then 
    takePlayerMoney ( thePlayer, 20000 ) 
    giveWeapon ( source, 16, 1 ) 
end 
end 
addEvent( "arm3", true ) 
addEventHandler( "arm3", getRootElement(), arm33 ) 
  
function arm44 (thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 25000 then 
    takePlayerMoney ( thePlayer, 25000 ) 
    giveWeapon ( source, 29, 99 ) 
end 
end 
addEvent( "arm4", true ) 
addEventHandler( "arm4", getRootElement(), arm44 ) 

Client

cylinder = createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 )  
  
 function tienda() 
   Window = guiCreateWindow(243,181,555,488,"Tienda de Armas/Weapon Shop",false) 
   imagen4 = guiCreateStaticImage(0.0595,0.0902,0.2414,0.2172,"images/SNIPER.png",true,Window) 
   imagen3 = guiCreateStaticImage(0.618,0.1004,0.2577,0.207,"images/M4.png",true,Window) 
   imagen2 = guiCreateStaticImage(0.6505,0.5861,0.2306,0.2582,"images/MP5.png",true,Window) 
   imagen1 = guiCreateStaticImage(0.0865,0.5922,0.2126,0.2275,"images/GRENADE.png",true,Window) 
   Sniper = guiCreateButton(0.0631,0.3217,0.2324,0.1352,"Sniper/Costo:155000$",true,Window) 
   M4 = guiCreateButton(0.6144,0.3217,0.2523,0.127,"M4/Costo:120000$",true,Window) 
   Grenade = guiCreateButton(0.0649,0.8525,0.2559,0.1291,"Grenade/Costo:20000$x1",true,Window) 
   MP5 = guiCreateButton(0.6432,0.8504,0.2685,0.1311,"MP5/Costo:25000$",true,Window) 
   Cerrar = guiCreateButton(0.355,0.5082,0.2162,0.168,"Cerrar/Close",true,Window) 
    
   showCursor ( true ) 
  
   addEventHandler ( "onClientGUIClick", Cerrar, Salir, false ) 
   addEventHandler ( "onClientGUIClick", M4, arma1, false ) 
   addEventHandler ( "onClientGUIClick", Sniper, arma2, false ) 
   addEventHandler ( "onClientGUIClick", Grenade, arma3, false ) 
   addEventHandler ( "onClientGUIClick", MP5, arma4, false ) 
end 
  
  
function Salir() 
  
guiSetVisible (Window, not guiGetVisible ( Window ) ) 
showCursor ( false ) 
end 
  
function arma1() 
    triggerServerEvent ( "arm1", getLocalPlayer() ) 
end 
  
function arma2() 
    triggerServerEvent ( "arm2", getLocalPlayer() ) 
end 
  
function arma3() 
    triggerServerEvent ( "arm3", getLocalPlayer() ) 
end 
  
function arma4() 
    triggerServerEvent ( "arm4", getLocalPlayer() ) 
end 
  
function marker() 
    triggerServerEvent ( "mark", getLocalPlayer() ) 
end 
  
 function showGUI () 
 guiSetVisible (Window,true) 
 showCursor (true) 
end 
addEvent ("showGUI",true) 
addEventHandler ("showGUI",getRootElement(),showGUI) 

Bueno, hay me tira error en el server-side "Linea:7: donde esta el addEventHandler ("onMarkerHit"

Link to comment

Prueba así.

Server Side:

local Marker = createMarker ( 1294.6767578125, -1337.5, 17.860641479492, "cylinder", 1.5, 255, 0, 0, 255 ) 
  
  
function GUI(hitPlayer) 
    triggerClientEvent(hitPlayer,"showGUI",getRootElement(),hitPlayer) 
end 
addEventHandler("onMarkerHit",Marker,GUI) 
  
function arm11 (thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 120000 then 
    takePlayerMoney ( thePlayer, 120000 ) 
    giveWeapon ( source, 31, 2880 ) 
end 
end 
addEvent( "arm1", true ) 
addEventHandler( "arm1", getRootElement(), arm11 ) 
  
  
  
function arm22 (thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 155000 then 
    takePlayerMoney ( thePlayer, 155000 ) 
    giveWeapon ( source, 34, 100 ) 
end 
end 
addEvent( "arm2", true ) 
addEventHandler( "arm2", getRootElement(), arm22 ) 
  
function arm33 (thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 20000 then 
    takePlayerMoney ( thePlayer, 20000 ) 
    giveWeapon ( source, 16, 1 ) 
end 
end 
addEvent( "arm3", true ) 
addEventHandler( "arm3", getRootElement(), arm33 ) 
  
function arm44 (thePlayer) 
    local money = getPlayerMoney ( thePlayer ) 
    if money >= 25000 then 
    takePlayerMoney ( thePlayer, 25000 ) 
    giveWeapon ( source, 29, 99 ) 
end 
end 
addEvent( "arm4", true ) 
addEventHandler( "arm4", getRootElement(), arm44 ) 

Client Side:

  
 function tienda() 
   Window = guiCreateWindow(243,181,555,488,"Tienda de Armas/Weapon Shop",false) 
   imagen4 = guiCreateStaticImage(0.0595,0.0902,0.2414,0.2172,"images/SNIPER.png",true,Window) 
   imagen3 = guiCreateStaticImage(0.618,0.1004,0.2577,0.207,"images/M4.png",true,Window) 
   imagen2 = guiCreateStaticImage(0.6505,0.5861,0.2306,0.2582,"images/MP5.png",true,Window) 
   imagen1 = guiCreateStaticImage(0.0865,0.5922,0.2126,0.2275,"images/GRENADE.png",true,Window) 
   Sniper = guiCreateButton(0.0631,0.3217,0.2324,0.1352,"Sniper/Costo:155000$",true,Window) 
   M4 = guiCreateButton(0.6144,0.3217,0.2523,0.127,"M4/Costo:120000$",true,Window) 
   Grenade = guiCreateButton(0.0649,0.8525,0.2559,0.1291,"Grenade/Costo:20000$x1",true,Window) 
   MP5 = guiCreateButton(0.6432,0.8504,0.2685,0.1311,"MP5/Costo:25000$",true,Window) 
   Cerrar = guiCreateButton(0.355,0.5082,0.2162,0.168,"Cerrar/Close",true,Window) 
    
   showCursor ( true ) 
   addEventHandler ( "onClientGUIClick", Cerrar, Salir, false ) 
   addEventHandler ( "onClientGUIClick", M4, arma1, false ) 
   addEventHandler ( "onClientGUIClick", Sniper, arma2, false ) 
   addEventHandler ( "onClientGUIClick", Grenade, arma3, false ) 
   addEventHandler ( "onClientGUIClick", MP5, arma4, false ) 
end 
  
  
function Salir() 
  
guiSetVisible (Window, not guiGetVisible ( Window ) ) 
showCursor ( false ) 
end 
  
function arma1() 
    triggerServerEvent ( "arm1", getLocalPlayer() ) 
end 
  
function arma2() 
    triggerServerEvent ( "arm2", getLocalPlayer() ) 
end 
  
function arma3() 
    triggerServerEvent ( "arm3", getLocalPlayer() ) 
end 
  
function arma4() 
    triggerServerEvent ( "arm4", getLocalPlayer() ) 
end 
  
function marker() 
    triggerServerEvent ( "mark", getLocalPlayer() ) 
end 
  
 function showGUI () 
 guiSetVisible (Window,true) 
 showCursor (true) 
end 
addEvent ("showGUI",true) 
addEventHandler ("showGUI",getRootElement(),showGUI) 

Link to comment

Prueba así ahora, ya que no lo estoy probando, si no que lo hago a la rápida.

Client

function tienda() 
   Window = guiCreateWindow(243,181,555,488,"Tienda de Armas/Weapon Shop",false) 
   imagen4 = guiCreateStaticImage(0.0595,0.0902,0.2414,0.2172,"images/SNIPER.png",true,Window) 
   imagen3 = guiCreateStaticImage(0.618,0.1004,0.2577,0.207,"images/M4.png",true,Window) 
   imagen2 = guiCreateStaticImage(0.6505,0.5861,0.2306,0.2582,"images/MP5.png",true,Window) 
   imagen1 = guiCreateStaticImage(0.0865,0.5922,0.2126,0.2275,"images/GRENADE.png",true,Window) 
   Sniper = guiCreateButton(0.0631,0.3217,0.2324,0.1352,"Sniper/Costo:155000$",true,Window) 
   M4 = guiCreateButton(0.6144,0.3217,0.2523,0.127,"M4/Costo:120000$",true,Window) 
   Grenade = guiCreateButton(0.0649,0.8525,0.2559,0.1291,"Grenade/Costo:20000$x1",true,Window) 
   MP5 = guiCreateButton(0.6432,0.8504,0.2685,0.1311,"MP5/Costo:25000$",true,Window) 
   Cerrar = guiCreateButton(0.355,0.5082,0.2162,0.168,"Cerrar/Close",true,Window) 
    
   addEventHandler ( "onClientGUIClick", Cerrar, Salir, false ) 
   addEventHandler ( "onClientGUIClick", M4, arma1, false ) 
   addEventHandler ( "onClientGUIClick", Sniper, arma2, false ) 
   addEventHandler ( "onClientGUIClick", Grenade, arma3, false ) 
   addEventHandler ( "onClientGUIClick", MP5, arma4, false ) 
    
   guiSetVisible (Window,false) 
end 
  
  
  
function arma1() 
    triggerServerEvent ( "arm1", getLocalPlayer() ) 
end 
  
function arma2() 
    triggerServerEvent ( "arm2", getLocalPlayer() ) 
end 
  
function arma3() 
    triggerServerEvent ( "arm3", getLocalPlayer() ) 
end 
  
function arma4() 
    triggerServerEvent ( "arm4", getLocalPlayer() ) 
end 
  
function marker() 
    triggerServerEvent ( "mark", getLocalPlayer() ) 
end 
  
 function showGUI () 
 guiSetVisible (Window,true) 
 showCursor (true) 
end 
addEvent ("showGUI",true) 
addEventHandler ("showGUI",getRootElement(),showGUI) 

Edited by Guest
Link to comment

Si no te anda el Trigger, cambialo por este

function MarkerHit( hitElement, matchingDimension )  
    local elementType = getElementType( hitElement )  
    triggerClientEvent(elementType,"showGUI",getRootElement(),elementType) 
end 
addEventHandler( "onMarkerHit", Marker, MarkerHit ) 
Link to comment

fijate si remplasas este code de la ventana

el code de sasuke para que mi sirve e.e

  
   Window = guiCreateWindow(243,181,555,488,"Tienda de Armas/Weapon Shop",false) 
   imagen4 = guiCreateStaticImage(0.0595,0.0902,0.2414,0.2172,"images/SNIPER.png",true,Window) 
   imagen3 = guiCreateStaticImage(0.618,0.1004,0.2577,0.207,"images/M4.png",true,Window) 
   imagen2 = guiCreateStaticImage(0.6505,0.5861,0.2306,0.2582,"images/MP5.png",true,Window) 
   imagen1 = guiCreateStaticImage(0.0865,0.5922,0.2126,0.2275,"images/GRENADE.png",true,Window) 
   Sniper = guiCreateButton(0.0631,0.3217,0.2324,0.1352,"Sniper/Costo:155000$",true,Window) 
   M4 = guiCreateButton(0.6144,0.3217,0.2523,0.127,"M4/Costo:120000$",true,Window) 
   Grenade = guiCreateButton(0.0649,0.8525,0.2559,0.1291,"Grenade/Costo:20000$x1",true,Window) 
   MP5 = guiCreateButton(0.6432,0.8504,0.2685,0.1311,"MP5/Costo:25000$",true,Window) 
   Cerrar = guiCreateButton(0.355,0.5082,0.2162,0.168,"Cerrar/Close",true,Window) 
    
   addEventHandler ( "onClientGUIClick", Cerrar, Salir, false ) 
   addEventHandler ( "onClientGUIClick", M4, arma1, false ) 
   addEventHandler ( "onClientGUIClick", Sniper, arma2, false ) 
   addEventHandler ( "onClientGUIClick", Grenade, arma3, false ) 
   addEventHandler ( "onClientGUIClick", MP5, arma4, false ) 
    
   guiSetVisible (Window,false) 

Edited by Guest
Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...