Hero192 Posted July 15, 2015 Share Posted July 15, 2015 Hello everybody im doing a simple shop i want the PEDs be in Two places LV / LS but i failed in attacking the PEDs table to client side Here's the part of my code: Client side: addEventHandler ( 'onClientClick', root, function ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if ( clickedElement ) and ( getElementType ( clickedElement ) == 'ped' ) then if ( clickedElement == peds[shop] ) then if ( guiGetVisible ( window ) == false ) then guiSetVisible ( window,true ) end end end end ) --Server side: local pedPos = { {1304.8, 1254.75, 10.82}; {1844.0552978516, -2640.2033691406, 13}; } local skins = {287} local peds = {} addEventHandler("onResourceStart",resourceRoot, function () for i,v in pairs(pedPos) do local shop = #peds + 1 peds[shop] = createPed(skins[math.random(#skins)],v[1],v[2],v[3]) if peds[shop] then setElementData(peds[shop],"shop",true) setElementFrozen(peds[shop],true) if v[4] then setPedRotation(peds[shop],v[4]) end end end end) Link to comment
GTX Posted July 15, 2015 Share Posted July 15, 2015 Client: local pedPos = { {1304.8, 1254.75, 10.82}; {1844.0552978516, -2640.2033691406, 13}; } local skins = {287} local peds = {} addEventHandler("onClientResourceStart", resourceRoot, function() for i=1, #pedPos do peds[i] = createPed(skins[math.random(1, #skins)], pedPos[i][1], pedPos[i][2], pedPos[i][3]) if peds[i] then setElementData(peds[i], "shop", true) setElementFrozen(peds[i], true) if pedPos[i][4] then setPedRotation(peds[i], pedPos[i][4]) end end end end ) addEventHandler ( 'onClientClick', root, function ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if ( clickedElement ) and ( getElementType ( clickedElement ) == 'ped' ) then for i=1, #peds do if ( clickedElement == peds[i] ) then if ( guiGetVisible ( window ) == false ) then guiSetVisible ( window,true ) end end end end end ) Link to comment
Hero192 Posted July 15, 2015 Author Share Posted July 15, 2015 Thanks for help ,can you explain to me why you did ? Link to comment
Hero192 Posted July 15, 2015 Author Share Posted July 15, 2015 EDIT: and how can i do Table for Blips blip = createBlip( 1303.72, 1502.84, 10.82,23,2,0, 170, 15, 255) blipLS = createBlip(1304.8, 1254.75, 10.82, 23,2, 0, 170, 15, 255) setBlipVisibleDistance (blipLS,500) setBlipVisibleDistance (blip,500) Link to comment
GTX Posted July 15, 2015 Share Posted July 15, 2015 local blipPos = { {1303.72, 1502.84, 10.82}, {1304.8, 1254.75, 10.82} } local blips = {} for i=1, #blipPos do blips[i] = createBlip(blipPos[i][1], blipPos[i][2], blipPos[i][3], 23, 2, 0, 170, 15, 255) setBlipVisibleDistance(blips[i], 500) end Link to comment
Hero192 Posted July 15, 2015 Author Share Posted July 15, 2015 Thanks you ,and i got your point via pm,sorry Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now