Jump to content

Que no funciona ?


Arsilex

Recommended Posts

Posted
        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 ) 
  
  
  

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

1: Quita:

Gui = {} 
Repair = {} 

2: Que es esto?

server.fixVehicle(vehicle) 

Eso parece ser del Freeroam.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

si lo es xD

quero que cuando le de al boton se arregle el coche es para mi GUI de mecanico de un RP xD

Entonces uso fixvehicle nada mas o me dijeron también que es bueno setElementHealth

Cual es mejor y mas simple?

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Pero el Freeroam tiene un sistema que puedas ejecutar funciones server side en el client side, para usar fixVehicle tenes que hacerlo server side, osea triggerServerEvent.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Si reparas el vehiculo client side, solo vos lo vas a poder ver que yo sepa.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted

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 ) 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

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 ) 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

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 ) 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
  • Recently Browsing   0 members

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