Jump to content

[help] again


K4stic

Recommended Posts

no errors just wonna charge but how don't know so:

Then i charge the localplayer from line 10 to player or thePlayer it stop be attached i have make lot tryis i wonna charge the localplayer because i wonna to see that object all no only local Player

function use ( ) 
    local row, col = guiGridListGetSelectedItem ( list ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local model = tonumber ( guiGridListGetItemData ( list, row, 1 ) ) 
        local x, y, z = getElementPosition ( localPlayer ) 
            if ( isElement ( object ) ) then 
    destroyElement ( object ) 
end 
    object = createObject ( model, x, y, z + 1, 0, 0, 0 ) 
    attachElements(object, localPlayer, 0.025, -0.01, 0.815, 0, 0, 180) 
    end 
end 
addEventHandler ( "onClientGUIClick", _use, use, false ) 

Sorry for my Bad english

Link to comment

i make it client side because don't know how make it in server side so help me more

more code

    local aObjects = 
    { 
        { "Hat 1", 2052 }, 
        { "Hat 2", 2053 }, 
        { "Hat 3", 2054 }, 
        { "Grass Hat", 861 }, 
        { "Grass Hat 2", 862 }, 
        { "Flag hat", 2993 }, 
        { "Pizza Box hat", 2814 }, 
        { "Roulete hat", 1895 }, 
        { "Ventilator hat", 1661 }, 
        { "Model car hat", 2485 }, 
    }; 
  
list = guiCreateGridList( 0.1, 0.1, 0.8, 0.60, true, window ); 
guiGridListAddColumn( list, "VIP Hats", 0.85 ); 
  
for _,obj in ipairs( aObjects ) do 
    hRow = guiGridListAddRow( list ); 
    -- 
    guiGridListSetItemText ( list, hRow, 1, tostring( obj [ 1 ] ), false, false ); 
    guiGridListSetItemData ( list, hRow, 1, tostring( obj [ 2 ] ) ); 
end 
  
function use ( ) 
    local row, col = guiGridListGetSelectedItem ( list ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local model = tonumber ( guiGridListGetItemData ( list, row, 1 ) ) 
        local x, y, z = getElementPosition ( localPlayer ) 
            if ( isElement ( object ) ) then 
    destroyElement ( object ) 
end 
    object = createObject ( model, x, y, z + 1, 0, 0, 0 ) 
    attachElements(object, localPlayer, 0.025, -0.01, 0.815, 0, 0, 180) 
    end 
end 
addEventHandler ( "onClientGUIClick", _use, use, false ) 

Link to comment

-- Client Side --

function use() 
    local row, col = guiGridListGetSelectedItem(list) 
    if (row and col and row ~= -1 and col ~= -1) then 
        local model = tonumber(guiGridListGetItemData(list, row, 1)) 
        triggerServerEvent("xxx", localPlayer, model) 
    end 
end 
addEventHandler("onClientGUIClick", _use, use, false) 

-- Server Side --

object = {} 
  
addEvent("xxx", true) 
addEventHandler("xxx", root, 
function(model) 
    if isElement(object[source]) then 
        destroyElement(object[source]) 
    end 
    local x, y, z = getElementPosition(source) 
    object[source] = createObject(model, x, y, z + 1, 0, 0, 0) 
    attachElements(object[source], source, 0.025, -0.01, 0.815, 0, 0, 180) 
end) 
  
addEventHandler("onPlayerQuit", root, 
function() 
    if isElement(object[source]) then 
        destroyElement(object[source]) 
    end 
end) 

Link to comment
Debugscript says Client have trigger "xxx" to server side but not awaible

sorry bad english :/

What does awaible mean? :mrgreen:

It's working with me, i don't understand why it doesn't with you.

Try change the event name from xxx to anything else.

If still not work, then post your server side and client side and meta.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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