Jump to content

Error pero no entiendo por que :S


Arsilex

Recommended Posts

Client

function Pegati1 () 
  
        Pegas = guiCreateWindow(830,270,224,287,"Pegatinas",false) 
        Pega = guiCreateGridList(10,23,205,218,false,Pegas) 
        guiGridListSetSelectionMode(Pega,2) 
        guiGridListAddColumn(Pega,"Pegatinas",0.2) 
        for i = 1, 4 do 
            guiGridListAddRow(Pega) 
        end 
        Pega0 = guiGridListSetItemText(Pega,0,1,"0") 
        Pega1 = guiGridListSetItemText(Pega,1,1,"1") 
        guiGridListSetItemColor(Pega,1,1,0,0,255,182) 
        Pega2 = guiGridListSetItemText(Pega,2,1,"2") 
        guiGridListSetItemColor(Pega,2,1,0,255,0,182) 
        Pega3 = guiGridListSetItemText(Pega,3,1,"3") 
        guiGridListSetItemColor(Pega,3,1,255,0,0,182) 
        Cierro = guiCreateButton(77,251,66,27,"X",false,Pegas) 
         
         
        addEventHandler ( "onClientGUIClick", Pega0, Pegatin0, false ) 
        addEventHandler ( "onClientGUIClick", Pega1, Pegatin1, false ) 
        addEventHandler ( "onClientGUIClick", Pega2, Pegatin2, false ) 
        addEventHandler ( "onClientGUIClick", Pega3, Pegatin3, false ) 
        addEventHandler ( "onClientGUIClick", Cierro, Close2, false ) 
end 
  
  
function Close2 () 
        guiSetVisible (Pegas, not guiGetVisible ( Pegas ) ) 
end 
  
function Pegatin0() 
    triggerServerEvent("onPegatinas", getLocalPlayer()) 
end 
  
function Pegatin1() 
    triggerServerEvent("onPegatinas1", getLocalPlayer()) 
end 
  
function Pegatin2() 
    triggerServerEvent("onPegatinas2", getLocalPlayer()) 
end 
  
function Pegatin3() 
    triggerServerEvent("onPegatinas3", getLocalPlayer()) 
end 

Server

function pEGAS ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 0 ) 
    end 
end 
addEvent( "onPegatinas", true ) 
addEventHandler( "onPegatinas", getRootElement(), pEGAS) 
  
function pEGAS1 ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 3 ) 
    end 
end 
addEvent( "onPegatinas", true ) 
addEventHandler( "onPegatinas", getRootElement(), pEGAS1) 
  
function pEGAS2 ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 2 ) 
    end 
end 
addEvent( "onPegatinas", true ) 
addEventHandler( "onPegatinas", getRootElement(), pEGAS2) 
  
function pEGAS3 ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 1 ) 
    end 
end 
addEvent( "onPegatinas", true ) 
addEventHandler( "onPegatinas", getRootElement(), pEGAS3) 

Por que no me funciona :S y otra cosa hay alguna manera mas facil de hacer eso ?

Link to comment

Trigges onPegatinas1 2 y 3, pero tus eventos no tienen numeros.

function pEGAS ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 0 ) 
    end 
end 
addEvent( "onPegatinas", true ) 
addEventHandler( "onPegatinas", getRootElement(), pEGAS) 
  
function pEGAS1 ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 3 ) 
    end 
end 
addEvent( "onPegatinas1", true ) 
addEventHandler( "onPegatinas1", getRootElement(), pEGAS1) 
  
function pEGAS2 ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 2 ) 
    end 
end 
addEvent( "onPegatinas2", true ) 
addEventHandler( "onPegatinas2", getRootElement(), pEGAS2) 
  
function pEGAS3 ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 1 ) 
    end 
end 
addEvent( "onPegatina3s", true ) 
addEventHandler( "onPegatinas3", getRootElement(), pEGAS3) 

Link to comment

como que no?

addEvent( "onPegatinas2", true ) 
addEventHandler( "onPegatinas2", getRootElement(), pEGAS2) 
  
addEvent( "onPegatinas1", true ) 
addEventHandler( "onPegatinas1", getRootElement(), pEGAS1) 

el error que tengo es que no me crea los

        Pega2 = guiGridListSetItemText(Pega,2,1,"2") 

Link to comment

Tus eventos:

function Pegatin0() 
    triggerServerEvent("onPegatinas", getLocalPlayer()) 
end 
  
function Pegatin1() 
    triggerServerEvent("onPegatinas1", getLocalPlayer()) 
end 
  
function Pegatin2() 
    triggerServerEvent("onPegatinas2", getLocalPlayer()) 
end 
  
function Pegatin3() 
    triggerServerEvent("onPegatinas3", getLocalPlayer()) 
end 

Tus Triggers:

function pEGAS ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 0 ) 
    end 
end 
addEvent( "onPegatinas", true ) 
addEventHandler( "onPegatinas", getRootElement(), pEGAS) 
  
function pEGAS1 ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 3 ) 
    end 
end 
addEvent( "onPegatinas", true ) 
addEventHandler( "onPegatinas", getRootElement(), pEGAS1) 
  
function pEGAS2 ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 2 ) 
    end 
end 
addEvent( "onPegatinas", true ) 
addEventHandler( "onPegatinas", getRootElement(), pEGAS2) 
  
function pEGAS3 ( ) 
    local vehicle = getPedOccupiedVehicle( source ) 
    if vehicle then 
        setVehiclePaintjob ( vehicle, 1 ) 
    end 
end 
addEvent( "onPegatinas", true ) 
addEventHandler( "onPegatinas", getRootElement(), pEGAS3) 

o Al revez, bueno, compara y veras que estaban mal.

Tu error actual: Pones Texto a Item's inexistentes, el Item para guiGridListSetItemText es un Row, tu usas un Grid.

Link to comment
function Pegati1 () 
  
        Pegas = guiCreateWindow(830,270,224,287,"Pegatinas",false) 
        Pega = guiCreateGridList(10,23,205,218,false,Pegas) 
        guiGridListSetSelectionMode(Pega,2) 
        rowa = guiGridListAddColumn(Pega,"Pegatinas",0.2) 
        item1 = guiGridListAddRow(Pega) 
        item2 = guiGridListAddRow(Pega) 
        item3 = guiGridListAddRow(Pega) 
        item4 = guiGridListAddRow(Pega) 
        Pega0 = guiGridListSetItemText(Pega,item1, rowa, "0", false, false) 
        Pega1 = guiGridListSetItemText(Pega,item2, rowa, "1", false, false) 
        guiGridListSetItemColor(Pega,1,1,0,0,255,182) 
        Pega2 = guiGridListSetItemText(Pega,item3, rowa, "2", false, false) 
        guiGridListSetItemColor(Pega,2,1,0,255,0,182) 
        Pega3 = guiGridListSetItemText(Pega,item4, rowa, "3", false, false) 
        guiGridListSetItemColor(Pega,3,1,255,0,0,182) 
        Cierro = guiCreateButton(77,251,66,27,"X",false,Pegas) 

Link to comment
 funcion pegatin_choose() 
    choosedtext = guiGridListGetItemText ( Pega, guiGridListGetSelectedItem ( Pega ), 1 ) 
     if ( choosedtext == "0") then 
      Pegatin0() 
     elseif ( choosedtext == "1") then 
      Pegatin1() 
     elseif ( choosedtext == "2") then 
      Pegatin2() 
     elseif ( choosedtext == "3") then 
      Pegatin3() 
       end 
   end 
  addEventHandler ( "onClientGUIClick", Pega, pegatin_choose, false ) 

No estoy seguro, intentalo.

Link to comment

Si lo deje asi

function Pegati1 () 
  
        Pegas = guiCreateWindow(830,270,224,287,"Pegatinas",false) 
        Pega = guiCreateGridList(10,23,205,218,false,Pegas) 
        guiGridListSetSelectionMode(Pega,2) 
        rowa = guiGridListAddColumn(Pega,"Pegatinas",0.2) 
        item1 = guiGridListAddRow(Pega) 
        item2 = guiGridListAddRow(Pega) 
        item3 = guiGridListAddRow(Pega) 
        item4 = guiGridListAddRow(Pega) 
        Pega0 = guiGridListSetItemText(Pega,item1, rowa, "0", false, false) 
        Pega1 = guiGridListSetItemText(Pega,item2, rowa, "1", false, false) 
        guiGridListSetItemColor(Pega,1,1,0,0,255,182) 
        Pega2 = guiGridListSetItemText(Pega,item3, rowa, "2", false, false) 
        guiGridListSetItemColor(Pega,2,1,0,255,0,182) 
        Pega3 = guiGridListSetItemText(Pega,item4, rowa, "3", false, false) 
        guiGridListSetItemColor(Pega,3,1,255,0,0,182) 
        Cierro = guiCreateButton(77,251,66,27,"X",false,Pegas) 
         
        function pegatin_choose() 
        choosedtext = guiGridListGetItemText ( Pega, guiGridListGetSelectedItem ( Pega ), 1 ) 
            if ( choosedtext == "0") then 
                Pegatin0() 
            elseif ( choosedtext == "1") then 
                Pegatin1() 
            elseif ( choosedtext == "2") then 
                Pegatin2() 
            elseif ( choosedtext == "3") then 
                Pegatin3() 
            end 
        end 
        addEventHandler ( "onClientGUIClick", Pega, pegatin_choose, false ) 
        addEventHandler ( "onClientGUIClick", Cierro, Close2, false ) 
end 

Link to comment

Intenta asi:

        Pegas = guiCreateWindow(830,270,224,287,"Pegatinas",false) 
        Pega = guiCreateGridList(10,23,205,218,false,Pegas) 
        guiGridListSetSelectionMode(Pega,2) 
        rowa = guiGridListAddColumn(Pega,"Pegatinas",0.2) 
        item1 = guiGridListAddRow(Pega) 
        item2 = guiGridListAddRow(Pega) 
        item3 = guiGridListAddRow(Pega) 
        item4 = guiGridListAddRow(Pega) 
        Pega0 = guiGridListSetItemText(Pega,item1, rowa, "0", false, false) 
        Pega1 = guiGridListSetItemText(Pega,item2, rowa, "1", false, false) 
        guiGridListSetItemColor(Pega,1,1,0,0,255,182) 
        Pega2 = guiGridListSetItemText(Pega,item3, rowa, "2", false, false) 
        guiGridListSetItemColor(Pega,2,1,0,255,0,182) 
        Pega3 = guiGridListSetItemText(Pega,item4, rowa, "3", false, false) 
        guiGridListSetItemColor(Pega,3,1,255,0,0,182) 
        Cierro = guiCreateButton(77,251,66,27,"X",false,Pegas) 
         
        function pegatin_choose() 
        choosedtext = guiGridListGetItemText ( Pega, guiGridListGetSelectedItem ( Pega ), 1 ) 
            if ( choosedtext == "0") then 
                Pegatin0() 
            elseif ( choosedtext == "1") then 
                Pegatin1() 
            elseif ( choosedtext == "2") then 
                Pegatin2() 
            elseif ( choosedtext == "3") then 
                Pegatin3() 
            end 
        end 
        addEventHandler ( "onClientGUIClick", Pega, pegatin_choose, false ) 
  
function cierrof () 
guiSetVisible( Pegas, false) 
end 
addEventHandler ( "onClientGUIClick", Cierro, cierrof, false ) 
  
function Pegatin0() 
    triggerServerEvent("onPegatinas", getLocalPlayer()) 
end 
  
function Pegatin1() 
    triggerServerEvent("onPegatinas1", getLocalPlayer()) 
end 
  
function Pegatin2() 
    triggerServerEvent("onPegatinas2", getLocalPlayer()) 
end 
  
function Pegatin3() 
    triggerServerEvent("onPegatinas3", getLocalPlayer()) 
end 

Link to comment
  • Recently Browsing   0 members

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