max-mohammed Posted January 26, 2014 Share Posted January 26, 2014 شباب انا مسوي معرض بس ابي لما تجي النافضة يكون اسم السيارة في القريد ليست اسم اختياري مو اسم السيارة الاصلي هم كودين 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 function onClientGUIClick (button, state, absoluteX, absoluteYe) if (source == buyButton) then guiSetVisible (carshopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (carGridList)) then local carName = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 1) local carID = getVehicleModelFromName (carName) local carCost = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 2) triggerServerEvent ("carShopCarBuy", getLocalPlayer(), carID, carCost, carName) end end Link to comment
max-mohammed Posted January 26, 2014 Author Share Posted January 26, 2014 +ابي الكاميرا يتغير مكانها Link to comment
max-mohammed Posted January 28, 2014 Author Share Posted January 28, 2014 نفسي افهم ليش محد يرد وش فيكم ماتردون؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟ Link to comment
فاّرس Posted January 28, 2014 Share Posted January 28, 2014 يعني تبي يكون بالجريد ليست اسماء سيارات من عندك , واذا اختار سياره يعطيه هي؟ Link to comment
max-mohammed Posted January 28, 2014 Author Share Posted January 28, 2014 شباب الكود الاول حليت مشكلته بس الثاني بحط الكودين:كاملين function onClientGUIClick (button, state, absoluteX, absoluteYe) if (source == buyButton) then guiSetVisible (carshopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (carGridList)) then local carName = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 1) local carID = getVehicleModelFromName (carName) local carCost = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 2) triggerServerEvent ("carShopCarBuy", getLocalPlayer(), carID, carCost, carName) end elseif (source == closeButton) then guiSetVisible (carshopWindow, false) showCursor (false) end end 2-- local cars = {{411,"gallardo",1900000}} for i,v in ipairs (cars) do local row = guiGridListAddRow (carGridList) guiGridListSetItemText (carGridList, row, 1, tostring(v[2]), false, true) guiGridListSetItemText (carGridList, row, 2, tostring(v[3]), false, true) end كيف اخلي الكود الاول يطلع ايدي السيارة من الجدول ان شاء الله رد Link to comment
max-mohammed Posted January 28, 2014 Author Share Posted January 28, 2014 يب يا ذا بيست Link to comment
فاّرس Posted January 28, 2014 Share Posted January 28, 2014 سوي جدول مع اي دي السياره, Vehicles = { {'Ford',435}, -- {carName,ID} } واستخدم اللوب عشان تضيف الكلام, for k,v in ipairs(Vehicles) do local row = guiGridListAddRow(carGridList) guiGridListSetItemText(carGridList,row,1,v[1],false,false) guiGridListSetItemData(carGridList,row,1,v[2]) end وتسوي حدث اذا ضغط الزر , addEventHandler('onClientGUIClick',buyButton,function() if guiGridListGetSelectedItem(carGridList) ~= -1 then local car = guiGridListGetItemData ( carGridList,guiGridListGetSelectedItem ( carGridList ), 1) triggerServerEvent('CreateCarForPlayer',localPlayer,car) end end,false) وكمل السيرفر Link to comment
Tete omar Posted January 28, 2014 Share Posted January 28, 2014 مو لازم تجيب الايدي يمديك تحط الايدي بدون الاسم, والاسم بدون الايدي :وفي الحالتين يمديك تستخدم getVehicleNameFromID getVehicleIDFromName Link to comment
فاّرس Posted January 28, 2014 Share Posted January 28, 2014 ...هو ما يبي يحط اسم السياره الاصليه , يبي يحط اسماء من عنده مثلا كامري Link to comment
max-mohammed Posted January 29, 2014 Author Share Posted January 29, 2014 جاري التجربة!! Link to comment
max-mohammed Posted January 29, 2014 Author Share Posted January 29, 2014 والله مانفع كودك جربت بس مانفع function onClientGUIClick (button, state, absoluteX, absoluteYe) if (source == buyButton) then guiSetVisible (carshopWindow, false) showCursor (false) if (guiGridListGetSelectedItem (carGridList)) then local car = guiGridListGetItemData ( carGridList,guiGridListGetSelectedItem ( carGridList ), 1) local carCost = guiGridListGetItemText (carGridList, guiGridListGetSelectedItem (carGridList), 2) triggerServerEvent("carShopCarBuy",getLocalPlayer(),car,carCost) end elseif (source == closeButton) then guiSetVisible (carshopWindow, false) showCursor (false) end end addEventHandler ("onClientGUIClick", getRootElement(), onClientGUIClick) 2 for i,v in ipairs (cars) do local row = guiGridListAddRow (carGridList) guiGridListSetItemText (carGridList, row, 1, tostring(v[1]), false, true) guiGridListSetItemText (carGridList, row, 2, tostring(v[3]), false, true) guiGridListSetItemData(carGridList,row,1,v[2]) end Link to comment
فاّرس Posted January 29, 2014 Share Posted January 29, 2014 جرب, -- Client Side # local Vehicles = { {'Ford',10000,602}, -- {carName,money,ID} } for k,v in ipairs(Vehicles) do local row = guiGridListAddRow(carGridList) guiGridListSetItemText(carGridList,row,1,v[1],false,false) guiGridListSetItemText(carGridList,row,2,v[2],false,false) guiGridListSetItemData(carGridList,row,2,v[2]) guiGridListSetItemData(carGridList,row,1,v[3]) end addEventHandler('onClientGUIClick',root,function() if source == buyButton then if guiGridListGetSelectedItem(carGridList) ~= -1 then local car = guiGridListGetItemData ( carGridList,guiGridListGetSelectedItem ( carGridList ), 1) local money = guiGridListGetItemData ( carGridList,guiGridListGetSelectedItem ( carGridList ), 2) triggerServerEvent('CreateCarForPlayer',localPlayer,car,money) elseif source == closeButton then guiSetVisible (carshopWindow, false) showCursor (false) end end end) -- Server Side # local vehicle = {} addEvent('CreateCarForPlayer',true) addEventHandler('CreateCarForPlayer',root,function(model,money) if getPlayerMoney(source) >= tonumber(money) then if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end local x,y,z = getElementPosition(source) vehicle[source] = createVehicle(tonumber(model),x,y,z) warpPedIntoVehicle(source,vehicle[source]) takePlayerMoney(source,tonumber(money)) end end ) addEventHandler('onPlayerQuit',root,function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end end ) Link to comment
max-mohammed Posted January 29, 2014 Author Share Posted January 29, 2014 (edited) شباب خلاص تم حل المشكلة وشكرا يا ذابيست على كود guiGridListSetItemData edit: جرب, -- Client Side # local Vehicles = { {'Ford',10000,602}, -- {carName,money,ID} } for k,v in ipairs(Vehicles) do local row = guiGridListAddRow(carGridList) guiGridListSetItemText(carGridList,row,1,v[1],false,false) guiGridListSetItemText(carGridList,row,2,v[2],false,false) guiGridListSetItemData(carGridList,row,2,v[2]) guiGridListSetItemData(carGridList,row,1,v[3]) end addEventHandler('onClientGUIClick',root,function() if source == buyButton then if guiGridListGetSelectedItem(carGridList) ~= -1 then local car = guiGridListGetItemData ( carGridList,guiGridListGetSelectedItem ( carGridList ), 1) local money = guiGridListGetItemData ( carGridList,guiGridListGetSelectedItem ( carGridList ), 2) triggerServerEvent('CreateCarForPlayer',localPlayer,car,money) elseif source == closeButton then guiSetVisible (carshopWindow, false) showCursor (false) end end end) -- Server Side # local vehicle = {} addEvent('CreateCarForPlayer',true) addEventHandler('CreateCarForPlayer',root,function(model,money) if getPlayerMoney(source) >= tonumber(money) then if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end local x,y,z = getElementPosition(source) vehicle[source] = createVehicle(tonumber(model),x,y,z) warpPedIntoVehicle(source,vehicle[source]) takePlayerMoney(source,tonumber(money)) end end ) addEventHandler('onPlayerQuit',root,function() if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end end ) معد صرت احتاجه بس مشككككككككوور edit #2: بس ممكن لما اختار Row يسوي createVehicle يعني لو حددت على اي سيارة تظهر قدامي ولو غيرت Row تختفي السابقة وتجي المحددة وكود تغيير مكان الكاميرا edit #3: وين رحتو Edited January 29, 2014 by Guest Link to comment
فاّرس Posted January 29, 2014 Share Posted January 29, 2014 onClientGUIClick -- GridList addEventHandler guiGridListGetItemText guiGridListGetSelectedItem triggerServerEvent addEvent addEventHandler table isElement destroyElement createVehicle Link to comment
max-mohammed Posted January 29, 2014 Author Share Posted January 29, 2014 onClientGUIClick -- GridList addEventHandler guiGridListGetItemText guiGridListGetSelectedItem triggerServerEvent addEvent addEventHandler table isElement destroyElement createVehicle الترايقر مولازم بس ممكان مثال على الكود او تسويه ممكن؟؟ Link to comment
فاّرس Posted January 29, 2014 Share Posted January 29, 2014 على كيفك مو لازم تريقر ؟ Note: Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only. -- Client Side # addEventHandler('onClientGUIClick',carGridList,function() if guiGridListGetSelectedItem ( source ) ~= -1 then local car = guiGridListGetItemData( source ,guiGridListGetSelectedItem ( source ), 1) triggerServerEvent('_createVehicle',localPlayer,car) end end,false ) طبعا لازم تسوي داتا للرو , شوف كودي فوق وسوي مثله, وكمل السيرفر سوي جدول وتحققات ,, برضو شوف كودي الي فوق Link to comment
Tete omar Posted January 29, 2014 Share Posted January 29, 2014 max-mohammed EDIT لا تخرب المنتدى بوضع مشاركات مزدوجة, إذا تبي تعدل شي عندك زر Link to comment
max-mohammed Posted February 2, 2014 Author Share Posted February 2, 2014 (edited) على كيفك مو لازم تريقر ؟Note: Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only. -- Client Side # addEventHandler('onClientGUIClick',carGridList,function() if guiGridListGetSelectedItem ( source ) ~= -1 then local car = guiGridListGetItemData( source ,guiGridListGetSelectedItem ( source ), 1) triggerServerEvent('_createVehicle',localPlayer,car) end end,false ) طبعا لازم تسوي داتا للرو , شوف كودي فوق وسوي مثله, وكمل السيرفر سوي جدول وتحققات ,, برضو شوف كودي الي فوق طيب ممكن كودسيرفر لاني معرف التحققات والخ...... ممكن كود تغيير مكان الكاميرا plz Edited!!! Edited February 4, 2014 by Guest Link to comment
max-mohammed Posted February 4, 2014 Author Share Posted February 4, 2014 الرد شباب +شوفو آخر تعديل edit: شباب انا سويت الكود بس فيه مشكلة كلنت addEventHandler('onClientGUIClick',root,function() if source == buyButton then if guiGridListGetSelectedItem(carGridList) then local Name = guiGridListGetItemText ( carGridList,guiGridListGetSelectedItem ( carGridList ), 1) local id = guiGridListGetItemData ( carGridList,guiGridListGetSelectedItem ( carGridList ), 1) local Cost = guiGridListGetItemText ( carGridList,guiGridListGetSelectedItem ( carGridList ), 2) triggerServerEvent("carShopCarBuy",localPlayer,Name,id,Cost) end elseif source == carGridList then if guiGridListGetSelectedItem(carGridList) then local car = guiGridListGetItemData ( carGridList,guiGridListGetSelectedItem ( carGridList ), 1) triggerServerEvent("CreateV",localPlayer,car) end elseif source == closeButton then local eg = getLocalPlayer() setCameraTarget(eg) guiSetVisible (carshopWindow, false) showCursor (false) end end) سيرفر addEvent ("CreateV", true) function ss (car) cr = createVehicle ( car, 549.94281005859, -1265.0211181641, 17.2421875 ) if isElement(cr) then destroyElement(cr) createVehicle ( car, 549.94281005859, -1265.0211181641, 17.2421875 ) end end addEventHandler ("CreateV", getRootElement(), ss) Link to comment
فاّرس Posted February 6, 2014 Share Posted February 6, 2014 -- Server Side # local car = {} addEvent ('CreateV', true) addEventHandler ('CreateV',function (cCar) if isElement(car[source]) then destroyElement(car[source]) car[source] = nil end car[source] = createVehicle( tonumber(cCar), 549.94281005859, -1265.0211181641, 17.2421875 ) end ) Link to comment
max-mohammed Posted February 6, 2014 Author Share Posted February 6, 2014 (edited) كودك ماشتغل ليش؟؟؟؟ لما اجي اضغط واحدد ماتجي السيارة تأكد من الكود edit: المشكلة حليتها بس في كود اضفته لما يلمس الماركر لازم يكون لاعب+ لازم يكون عنده داتا معيين اوك الكود: addEvent ("viewGUI", true) function markerHit (hitPlayer, matchingDimension) if (getAccountData(hitPlayer,"pent") == "yes") then if getElementType (hitPlayer) == "player" then if (source == carShopMarker) or (source == carShopMarker2) or (source == carShopMarker3) or (source == carShopMarker4) or (source == carShopMarker5) then triggerClientEvent ("viewGUI", hitPlayer) setCameraMatrix ( hitPlayer, 548.46484375, -1267.1435546875, 26.682792663574, 496.4482421875,-1342.6044921875,-13.315231323242, 0, 0) setElementDimension(hitPlayer,755) end end else outputChatBox ("ليس لديك ؟؟؟", hitPlayer, 255, 0, 0, false) end end addEventHandler ("onMarkerHit", getRootElement(), markerHit) edit #2: شباب احد يرد وربي طفشت Edited February 8, 2014 by Guest Link to comment
فاّرس Posted February 8, 2014 Share Posted February 8, 2014 حاول تفهمنا وش تبي تسوي بالضبط من الآخر؟ ترا اكوادك معفوسه , الواحد يشوفها تنسد نفسه معد يبي يرد ,, حاول ترتب اكوادك وقولنا وش تبي ,؟ Link to comment
max-mohammed Posted February 9, 2014 Author Share Posted February 9, 2014 اناابي لما المس الماركر لازم يكون عندي داتا معيين واذا مو عندي الداتا مقدر افتح الماركر فهمت Data"ro5sa" type"yes" Link to comment
فاّرس Posted February 9, 2014 Share Posted February 9, 2014 طيب اطرح الكود حق الداتا؟ 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