Jump to content

Que no funciona ?


Arsilex

Recommended Posts

        Gui = {} 
        Repair = {} 
         
        Gui = guiCreateWindow(842,237,474,438,"GUI de mecanico",false) 
        Repair = guiCreateButton(11,30,121,30,"Reparar",false,Gui) 
        Paint = guiCreateButton(158,31,117,28,"Paintjob1",false,Gui) 
  
  
function changeVisibility() 
    if guiGetVisible( Gui ) == true then 
        guiSetVisible( Gui, false ) 
        showCursor( false ) 
    else 
        guiSetVisible( Gui, true ) 
        showCursor( true ) 
    end 
end 
  
  
function Paintjob1 () 
    setVehiclePaintjob ( vehicle ) 
    paintjob = getVehiclePaintjob ( vehicle ) 
    if ( paintjob == 2 ) then 
        outputChatBox ( "the paintjob was successfully set" ) 
    end 
end 
addEventHandler( "onClientGUIClick", Paintjob1, Paint, false) 
  
function repairVehicle() 
    local vehicle = getPedOccupiedVehicle(g_Me) 
    if vehicle then 
        server.fixVehicle(vehicle) 
    end 
end 
addEventHandler( "onClientGUIClick", repairVehicle, Repair, false) 
addCommandHandler ( "guimecanico", changeVisibility ) 
  
  
  

Link to comment

pekio haz una funcion en client-side con evento onClientGUIClick, entonces agregas eventos y funciones en server-side en donde se obtendra el vehiculo del jugador y lo reparas

por ejemplo

cl-side

addEventHandler("onClientGUIClick", root, function() 
if source == TUBOTON then 
triggerServerEvent("TUEVENTO", getLocalPlayer()) 
end 
end 
) 

sv-side

addEvent("TUEVENTO",true) 
addEventHandler("TUEVENTO", root,  
function() 
---Tus funciones--- 
end 
) 

puse --Tus funciones--- devido a que no se como obtener el auto del player

Link to comment

Mira Mota ize esto antes de que me dijeras pero no me funciona aun asi

Client-Side

        Gui = guiCreateWindow(842,237,474,438,"GUI de mecanico",false) 
        Repair = guiCreateButton(11,30,121,30,"Reparar",false,Gui) 
        Paintjob1 = guiCreateButton(158,31,117,28,"Paintjob1",false,Gui) 
  
  
function changeVisibility() 
    if guiGetVisible( Gui ) == true then 
        guiSetVisible( Gui, false ) 
        showCursor( false ) 
    else 
        guiSetVisible( Gui, true ) 
        showCursor( true ) 
    end 
end 
  
  
function Paintjob1 () 
    setVehiclePaintjob ( theVehicle, 2 ) 
    paintjob = getVehiclePaintjob ( theVehicle ) 
    if ( paintjob == 2 ) then 
        outputChatBox ( "the paintjob was successfully set" ) 
    end 
end 
addEventHandler( "onClientGUIClick", Paintjob1, Paintjob1, true) 
  
function repairVehicle() 
    triggerServerEvent ( "Fix", getLocalPlayer())  
end 
addEventHandler( "onClientGUIClick", repairVehicle, Repair, true) 
addCommandHandler ( "guimecanico", changeVisibility ) 

Server-Side

function Fix ( Repair ) 
fixVehicle ( vehicleValue ) 
end 
addEvent( "onFix", true ) 
addEventHandler( "onFix", getRootElement(), Fix ) 

Link to comment

Esta todo en orden

Server-Side

function Reparar ( Repair ) 
    fixVehicle ( vehicle ) 
end 
addEvent( "onFix", true ) 
addEventHandler( "onFix", getRootElement(), Reparar ) 

Client-side

       Gui = guiCreateWindow(842,237,474,438,"GUI de mecanico",false) 
        Repair = guiCreateButton(11,30,121,30,"Reparar",false,Gui) 
        Paintjob1 = guiCreateButton(158,31,117,28,"Paintjob1",false,Gui) 
  
  
function changeVisibility() 
    if guiGetVisible( Gui ) == true then 
        guiSetVisible( Gui, false ) 
        showCursor( false ) 
    else 
        guiSetVisible( Gui, true ) 
        showCursor( true ) 
    end 
end 
  
  
function repairVehicle() 
     triggerServerEvent("onFix", getLocalPlayer()) 
end 
addEventHandler ( "onClientGUIClick", Repair, repairVehicle, false ) 
  
function Paintjob () 
    setVehiclePaintjob ( theVehicle, 2 ) 
    paintjob = getVehiclePaintjob ( theVehicle ) 
    if ( paintjob == 2 ) then 
        outputChatBox ( "the paintjob was successfully set" ) 
    end 
end 
addEventHandler ( "onClientGUIClick", Paintjob1, Paintjob, false ) 
addCommandHandler ( "guimecanico", changeVisibility ) 

Link to comment

Mire probe hacerlo asi pero no entiendo por que no va :S

function Reparar ( Repair ) 
                local vehicle = getPedOccupiedVehicle( player ) 
                if vehicle then 
                fixVehicle( vehicle ) 
end 
end 
addEvent( "onFix", true ) 
addEventHandler( "onFix", getRootElement(), Reparar ) 

Link to comment
  • Recently Browsing   0 members

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