SkiZo Posted June 22, 2018 Share Posted June 22, 2018 Hello, .. 1 year from last post ! whatever.. i'm trying to make players see the car before buying it but i don't find the solution to create this Fonction.. i mean when player slecet a car from the list .. it's shown with rotation or something then .. Client.lua Help / مساعده carshopWindow = guiCreateWindow(500,200,290,440,"==[ Car Shop ]==",false) guiSetVisible (carshopWindow, false) guiSetAlpha(carshopWindow,1) guiWindowSetSizable(carshopWindow,false) selectLabel = guiCreateLabel(0.0423,0.1009,0.8889,0.078,"~Select your car~",true,carshopWindow) guiSetAlpha(selectLabel,1) guiLabelSetColor(selectLabel,255,255,255) guiLabelSetVerticalAlign(selectLabel,"top") guiLabelSetHorizontalAlign(selectLabel,"left",false) guiSetFont(selectLabel,"default-bold-small") carGridList = guiCreateGridList(0.0476,0.1789,0.9048,0.6789,true,carshopWindow) guiGridListSetSelectionMode(carGridList,0) carColumn = guiGridListAddColumn(carGridList,"Car",0.5) costColumn = guiGridListAddColumn(carGridList,"$",0.3) local cars = {{461,30000},{468,30000},{534,40000},{535,40000},{576,40000},{579,50000},{489,50000},{495,50000},{518,60000},{527,60000},{589,60000},{419,60000},{517,60000},{410,60000},{436,60000},{406,400000},{451,400000},{541,600000},{494,600000},{411,600000}} for i,v in ipairs (cars) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (carGridList) guiGridListSetItemText (carGridList, row, 1, carName, false, true) guiGridListSetItemText (carGridList, row, 2, tostring(v[2]), false, true) end guiSetAlpha(carGridList,1) buyButton = guiCreateButton(0.0476,0.8624,0.7778,0.0963,"==[ Buy it ]==",true,carshopWindow) guiSetAlpha(buyButton,1) guiSetProperty(buyButton, "NormalTextColour", "FF00FF00") closeButton = guiCreateButton(0.8571,0.8624,0.0899,0.1009,"X",true,carshopWindow) guiSetProperty(closeButton, "NormalTextColour", "FFFF0000") Link to comment
Dimos7 Posted June 22, 2018 Share Posted June 22, 2018 (edited) you need setTimer createVehicle guiGridListGetSelectedItem Edited June 22, 2018 by Dimos7 Link to comment
SkiZo Posted June 22, 2018 Author Share Posted June 22, 2018 5 hours ago, Dimos7 said: you need setTimer createVehicle guiGridListGetSelectedItem I Know that but i did not find the right fonction to create it .. it's like set camera and many things like that ! ... Help :c Link to comment
Dimos7 Posted June 22, 2018 Share Posted June 22, 2018 (edited) It no hard make a function runing with those function makeVehicles() modelID = guiGridListGetItemText(carGridList, guiGridListGetSelectedItem(carGridList), 1) local x, y, z = getElementPosition(localPlayer) veh = createVehicle(modelID, x, y+5,z) local vx, vy, vz = getElementPosition(veh) setCameraMatrix(vx, vy+10, vz+5) setTimer(function() destroyElement(veh) setCameraTarget(localPlayer) end, 10000, 1) end Edited June 22, 2018 by Dimos7 Link to comment
SkiZo Posted June 24, 2018 Author Share Posted June 24, 2018 On 6/22/2018 at 23:01, Dimos7 said: It no hard make a function runing with those function makeVehicles() modelID = guiGridListGetItemText(carGridList, guiGridListGetSelectedItem(carGridList), 1) local x, y, z = getElementPosition(localPlayer) veh = createVehicle(modelID, x, y+5,z) local vx, vy, vz = getElementPosition(veh) setCameraMatrix(vx, vy+10, vz+5) setTimer(function() destroyElement(veh) setCameraTarget(localPlayer) end, 10000, 1) end Thanks This make it easier a lot.. Bug in setCameraMatrix.. 'vy' got nil ... Link to comment
Dimos7 Posted June 24, 2018 Share Posted June 24, 2018 function makeVehicles() local modelID = guiGridListGetItemText(carGridList, guiGridListGetSelectedItem(carGridList), 1) local x, y, z = getElementPosition(localPlayer) local veh = createVehicle(modelID, x, y+5,z) local vx, vy, vz = getElementPosition(veh) setCameraMatrix(vx, vy, vz, vx, vy+10, vz+5) setTimer(function() destroyElement(veh) setCameraTarget(localPlayer) end, 10000, 1) end try this Link to comment
SkiZo Posted June 24, 2018 Author Share Posted June 24, 2018 5 hours ago, Dimos7 said: function makeVehicles() local modelID = guiGridListGetItemText(carGridList, guiGridListGetSelectedItem(carGridList), 1) local x, y, z = getElementPosition(localPlayer) local veh = createVehicle(modelID, x, y+5,z) local vx, vy, vz = getElementPosition(veh) setCameraMatrix(vx, vy, vz, vx, vy+10, vz+5) setTimer(function() destroyElement(veh) setCameraTarget(localPlayer) end, 10000, 1) end try this Thank you for helping ... but still same ERROR :c Link to comment
SkiZo Posted June 24, 2018 Author Share Posted June 24, 2018 1 minute ago, Dimos7 said: hmm what exacly it says? http://prntscr.com/jyrcsg Link to comment
SkiZo Posted June 24, 2018 Author Share Posted June 24, 2018 3 minutes ago, Dimos7 said: it not make sence i have question ... maybe change something.. i don't know what's the deffirence between local vx,vy,vz = ... and vx ,yy ,vz = ... Link to comment
Dimos7 Posted June 24, 2018 Share Posted June 24, 2018 local is for that function only you can't use it outside without it you it global varibal Link to comment
SkiZo Posted June 24, 2018 Author Share Posted June 24, 2018 8 minutes ago, Dimos7 said: local is for that function only you can't use it outside without it you it global varibal thank you.. the problem still i can't make shower car in the panel ... Link to comment
Addlibs Posted June 24, 2018 Share Posted June 24, 2018 (edited) The issue is you're trying to create a vehicle using it's name rather than model ID. Either try: function makeVehicles() local modelName = guiGridListGetItemData(carGridList, guiGridListGetSelectedItem(carGridList), 1) local modelID = getVehicleModelFromName(modelName) --try to get the model ID from the model name local x, y, z = getElementPosition(localPlayer) local veh = createVehicle(modelID, x, y+5,z) local vx, vy, vz = getElementPosition(veh) setCameraMatrix(vx, vy, vz, vx, vy+10, vz+5) setTimer( function() destroyElement(veh) setCameraTarget(localPlayer) end, 10000, 1) end Or store the model ID as grid-list item data: -- lines 16 to 21 for i,v in ipairs (cars) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (carGridList) guiGridListSetItemText (carGridList, row, 1, carName, false, true) --display the model name guiGridListSetItemData (carGridList, row, 1, v[1], false, true) --store the model ID guiGridListSetItemText (carGridList, row, 2, tostring(v[2]), false, true) end -- then function makeVehicles() local modelID = guiGridListGetItemData(carGridList, guiGridListGetSelectedItem(carGridList), 1) --get the item data which is ID, not the name local x, y, z = getElementPosition(localPlayer) local veh = createVehicle(modelID, x, y+5,z) local vx, vy, vz = getElementPosition(veh) setCameraMatrix(vx, vy, vz, vx, vy+10, vz+5) setTimer( function() destroyElement(veh) setCameraTarget(localPlayer) end, 10000, 1) end Edited June 24, 2018 by MrTasty Link to comment
SkiZo Posted June 25, 2018 Author Share Posted June 25, 2018 23 hours ago, MrTasty said: The issue is you're trying to create a vehicle using it's name rather than model ID. Either try: function makeVehicles() local modelName = guiGridListGetItemData(carGridList, guiGridListGetSelectedItem(carGridList), 1) local modelID = getVehicleModelFromName(modelName) --try to get the model ID from the model name local x, y, z = getElementPosition(localPlayer) local veh = createVehicle(modelID, x, y+5,z) local vx, vy, vz = getElementPosition(veh) setCameraMatrix(vx, vy, vz, vx, vy+10, vz+5) setTimer( function() destroyElement(veh) setCameraTarget(localPlayer) end, 10000, 1) end Or store the model ID as grid-list item data: -- lines 16 to 21 for i,v in ipairs (cars) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (carGridList) guiGridListSetItemText (carGridList, row, 1, carName, false, true) --display the model name guiGridListSetItemData (carGridList, row, 1, v[1], false, true) --store the model ID guiGridListSetItemText (carGridList, row, 2, tostring(v[2]), false, true) end -- then function makeVehicles() local modelID = guiGridListGetItemData(carGridList, guiGridListGetSelectedItem(carGridList), 1) --get the item data which is ID, not the name local x, y, z = getElementPosition(localPlayer) local veh = createVehicle(modelID, x, y+5,z) local vx, vy, vz = getElementPosition(veh) setCameraMatrix(vx, vy, vz, vx, vy+10, vz+5) setTimer( function() destroyElement(veh) setCameraTarget(localPlayer) end, 10000, 1) end Thank You i already fix it <3. your idea looks amazing Thank you 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