1337.Ibrahim Posted July 11, 2017 Share Posted July 11, 2017 (edited) --client addEventHandler("onClientGUIClick", root, function () if source == create then local Text = guiGetText(editwarp) local x,y,z = getElementPosition(localPlayer) if Text == "" or Text == " " then return end table.insert ( tele, { Text, x, y, z } ) triggerServerEvent ( 'event2' , localPlayer , Text ) loob () end end) addEventHandler("onClientResourceStart",resourceRoot,function () triggerServerEvent('event1',localPlayer) end) addEvent('events' , true ) addEventHandler('events' , getRootElement ( ), function ( Value ) for Value1 , Value2 in ipairs ( Value ) do guiGridListSetItemText ( GridList , guiGridListAddRow ( GridList ) , 1 , Value2.aRows , false , false ) end end ) --server executeSQLQuery ( ' CREATE TABLE IF NOT EXISTS aTalis ( aRows ) ' ) addEvent('event1',true) addEventHandler('event1',getRootElement(), function (aText) executeSQLQuery ( ' INSERT INTO aTalis VALUES ( ? )' , aText ) end) addEvent('event2',true) addEventHandler('event2',getRootElement(), function () Value = executeSQLQuery ('SELECT * FROM aTalis') if ( #Value ~= 0 ) then triggerClientEvent ( source , 'events', source , Value ) end end) السلام عليكم , سويت مود الانتقال عشان اتعلم السكل المهم واجهتني مشكلة اني اذا سويت مكان جديد وذا طلعت ودخلت ماينحفظ وش المشكلة @#BrosS @Abdul KariM @Master_MTA @iMr.WiFi..! @iMr.Omar Edited July 11, 2017 by Talis Link to comment
iMr.Omar Posted July 11, 2017 Share Posted July 11, 2017 --- Client Side addEventHandler ( "onClientGUIClick" , resourceRoot , function ( ) if ( source == create ) then local aName = guiGetText ( editwarp ) ; if ( aName ~= "" or aName ~= " " ) then triggerServerEvent ( "addNewPlace" , localPlayer , aName ) ; end end end ); addEventHandler("onClientResourceStart",resourceRoot,function() setTimer ( function ( ) triggerServerEvent ( "getPlaces" , localPlayer ); end,1500,1) end); addEvent ( "setPlaces" , true ) addEventHandler ( "setPlaces" , root , function ( Table ) guiGridListClear ( GridList ); for index,values in ipairs ( Table ) do local row = guiGridListAddRow ( GridList ) ; guiGridListSetItemText ( GridList , row , 1 , values [ 'name' ] , false , false ) guiGridListSetItemData ( GridList , row , 1 , values['position'] ); end end ) ; --- Server Side executeSQLQuery ( "CREATE TABLE IF NOT EXISTS aTails_Places ( name , position )" ); addEvent ( "addNewPlace" , true ) addEventHandler ( "addNewPlace" , root , function ( aName ) local aResult = executeSQLQuery ( "SELECT * FROM aTails_Places" ) if ( aResult and type ( aResult ) == "table" and #aResult ~= 0 ) then for i,v in ipairs ( aResult ) do if ( v [ "name" ] == aName ) then return end end end local x , y , z = getElementPosition ( source ) ; executeSQLQuery ( "INSERT INTO aTails_Places ( name , position ) VALUES ( ? , ? )" , aName , tostring(x)..","..tostring(y)..","..tostring(z) ); outputChatBox("تم إضافة المكان",source,255,255,0,true) end ) ; addEvent ( "getPlaces" , true ) addEventHandler ( "getPlaces" , root , function ( ) local aResult = executeSQLQuery ( "SELECT * FROM aTails_Places" ) if ( aResult and type ( aResult ) == "table" and #aResult ~= 0 ) then triggerClientEvent ( source , "setPlaces" , source , aResult ) ; end end ); لو تبي تخليه لو ظغط زر وينتقل للامكان إستخدم guiGridListGetItemData split setElementPosition 1 Link to comment
1337.Ibrahim Posted July 11, 2017 Author Share Posted July 11, 2017 (edited) @iMr.Omar http://imgur.com/a/1NszL ما يضيف شي في الرو Edited July 11, 2017 by Talis Link to comment
1337.Ibrahim Posted July 11, 2017 Author Share Posted July 11, 2017 1 minute ago, iMr.Omar said: سوي ريستارت للمود . الله يعطيك الف عافية , الحين ابي اضيفهم في التيبل كيف http://imgur.com/a/GJ8ny Link to comment
iMr.Omar Posted July 11, 2017 Share Posted July 11, 2017 كيف يعني تبي تضيفهم بالتيبل ؟ 1 Link to comment
Adham Posted July 11, 2017 Share Posted July 11, 2017 (edited) حط فيه ايفنت addNewPlace triggerEvent ( "getPlaces", root ) Edited July 11, 2017 by Deativated 1 Link to comment
1337.Ibrahim Posted July 11, 2017 Author Share Posted July 11, 2017 2 minutes ago, iMr.Omar said: كيف يعني تبي تضيفهم بالتيبل ؟ انا مسوي تيبل وحاط فيه الإحداثيات والأماكن الحين فيه مشكلة اذا ضفت مكان يسوي كولمن ثاني ويحط المكان فيه شف http://imgur.com/a/1NszL http://imgur.com/a/GJ8ny Link to comment
Abdul KariM Posted July 11, 2017 Share Posted July 11, 2017 @iMr.Omar ماينفع تخزن الاحداثيات في التيبل وانت مسوي كولمنين فقط راح يخزن الاسم واحداثي اكس @Talis انت تبيه فقط لك تضيف اماكن والزوار يشوفها ولا اي زائر يضيف اماكن ؟ 2 Link to comment
1337.Ibrahim Posted July 11, 2017 Author Share Posted July 11, 2017 1 minute ago, Abdul KariM said: @iMr.Omar ماينفع تخزن الاحداثيات في التيبل وانت مسوي كولمنين فقط راح يخزن الاسم واحداثي اكس @Talis انت تبيه فقط لك تضيف اماكن والزوار يشوفها ولا اي زائر يضيف اماكن ؟ يب ابي اذا ضفت اماكن يشوفونها الزوار Link to comment
Abdul KariM Posted July 11, 2017 Share Posted July 11, 2017 كلينت addEvent ( "setPlaces" , true ) addEventHandler ( "setPlaces" , root , function ( Table ) guiGridListClear ( GridList ); for index,values in ipairs ( Table ) do local row = guiGridListAddRow ( GridList ) ; guiGridListSetItemText ( GridList , row , 1 , values [ 'name' ] , false , false ) guiGridListSetItemData ( GridList , row , 1 , fromJSON ( values [ 'position' ] ) ) end end ) سيرفر executeSQLQuery ( "CREATE TABLE IF NOT EXISTS aTails_Places ( name , position )" ); addEvent ( "addNewPlace" , true ) addEventHandler ( "addNewPlace" , root , function ( aName ) local aResult = executeSQLQuery ( "SELECT * FROM aTails_Places WHERE name=?" , aName ) if ( aResult and #aResult == 0 ) then local aPos = { getElementPosition ( source ) } ; executeSQLQuery ( "INSERT INTO aTails_Places ( name , position ) VALUES ( ? , ? )" , aName , toJSON ( aPos ) ); outputChatBox("تم إضافة المكان",source,255,255,0,true) else outputChatBox ( "هذا المكان موجود سابقا" , source ) end end ) ; addEvent ( "getPlaces" , true ) addEventHandler ( "getPlaces" , root , function ( ) local aResult = executeSQLQuery ( "SELECT * FROM aTails_Places" ) if ( aResult and type ( aResult ) == "table" and #aResult ~= 0 ) then triggerClientEvent ( source , "setPlaces" , source , aResult ) ; end end ); 2 Link to comment
1337.Ibrahim Posted July 11, 2017 Author Share Posted July 11, 2017 @Abdul KariM الله يسعدك ويعطيك العافية , بس نفس المشكلة اللي قبل يسوي كولمن ثاني ويضيف المكان فيه Link to comment
Rockyz Posted July 11, 2017 Share Posted July 11, 2017 37 minutes ago, Talis said: @Abdul KariM الله يسعدك ويعطيك العافية , بس نفس المشكلة اللي قبل يسوي كولمن ثاني ويضيف المكان فيه مافهمت المشكلة بالضبط وش مشكلتك ؟ Link to comment
1337.Ibrahim Posted July 11, 2017 Author Share Posted July 11, 2017 6 minutes ago, #,+( _xiRoc[K]; > said: مافهمت المشكلة بالضبط وش مشكلتك ؟ شف الصور اللي فوق Link to comment
Abdul KariM Posted July 11, 2017 Share Posted July 11, 2017 اطرح التيبل الي حاط فيه الاحداثيات Link to comment
1337.Ibrahim Posted July 11, 2017 Author Share Posted July 11, 2017 tele = { {"=[ القفزه الخونفشاريه ]=",1541.0673828125, -1357.576171875, 329.46615600586}, {"=[ مقر الجيش ]=",146.66674804688, 1720, 17.640625}, {"=[ موقف الباصات ]=",1790.2674560547,-1912.0159912109 , 13.396838188171}, {"=[ الفنادق ]=",-1739.0821533203, 940.56231689453, 24.7421875}, {"=[ الشارع الطويل ]=",-3072.5554199219,-3000.345703125,5}, {"=[ بيت سي جي ]=",2491.12109375, -1667.4482421875, 13.34375} } function loob ( ) guiGridListClear ( GridList ) for i,mk in ipairs(tele) do local row = guiGridListAddRow(GridList) guiGridListSetItemText(GridList,row,1,mk[1],false,false) guiGridListSetItemData(GridList,row,1,{mk[2],mk[3],mk[4]}) guiGridListSetItemColor(GridList,row,1,0,255,0) end end Link to comment
Master_MTA Posted July 12, 2017 Share Posted July 12, 2017 (edited) 2 hours ago, Talis said: tele = { {"=[ القفزه الخونفشاريه ]=",1541.0673828125, -1357.576171875, 329.46615600586}, {"=[ مقر الجيش ]=",146.66674804688, 1720, 17.640625}, {"=[ موقف الباصات ]=",1790.2674560547,-1912.0159912109 , 13.396838188171}, {"=[ الفنادق ]=",-1739.0821533203, 940.56231689453, 24.7421875}, {"=[ الشارع الطويل ]=",-3072.5554199219,-3000.345703125,5}, {"=[ بيت سي جي ]=",2491.12109375, -1667.4482421875, 13.34375} } function loob ( ) guiGridListClear ( GridList ) for i,mk in ipairs(tele) do local row = guiGridListAddRow(GridList) guiGridListSetItemText(GridList,row,1,mk[1],false,false) guiGridListSetItemData(GridList,row,1,{mk[2],mk[3],mk[4]}) guiGridListSetItemColor(GridList,row,1,0,255,0) end end ليه حاطه بتيبل ليه ما تخزنه بالسيرفر سايد بالداتا بيز؟ يعني كمثال سيرفر سايد طبعا executeSQLQuery ( "CREATE TABLE IF NOT EXISTS aTails_Places ( name , position )" ); tele = { {"=[ القفزه الخونفشاريه ]=",1541.0673828125, -1357.576171875, 329.46615600586}, {"=[ مقر الجيش ]=",146.66674804688, 1720, 17.640625}, {"=[ موقف الباصات ]=",1790.2674560547,-1912.0159912109 , 13.396838188171}, {"=[ الفنادق ]=",-1739.0821533203, 940.56231689453, 24.7421875}, {"=[ الشارع الطويل ]=",-3072.5554199219,-3000.345703125,5}, {"=[ بيت سي جي ]=",2491.12109375, -1667.4482421875, 13.34375} } addEventHandler('onResourceStart',root,function() local aResult = executeSQLQuery ( "SELECT * FROM aTails_Places" ) if ( aResult and #aResult == 0 ) then for k,v in ipairs(tele)do local xyz=v[2]..','..v[3]..','..v[4] executeSQLQuery ( "INSERT INTO aTails_Places ( name , position ) VALUES ( ? , ? )" , v[1] , xyz ); end end end) addEvent ( "addNewPlace" , true ) addEventHandler ( "addNewPlace" , root , function ( aName ) local aResult = executeSQLQuery ( "SELECT * FROM aTails_Places WHERE name=?" , aName ) if ( aResult and #aResult == 0 ) then local x,y,z = getElementPosition ( source ) local aPos=x..','..y..','..z executeSQLQuery ( "INSERT INTO aTails_Places ( name , position ) VALUES ( ? , ? )" , aName , aPos ); outputChatBox("تم إضافة المكان",source,255,255,0,true) else outputChatBox ( "هذا المكان موجود سابقا" , source ) end end ) ; addEvent ( "getPlaces" , true ) addEventHandler ( "getPlaces" , root , function ( ) local aResult = executeSQLQuery ( "SELECT * FROM aTails_Places" ) if ( aResult and type ( aResult ) == "table" and #aResult ~= 0 ) then triggerClientEvent ( source , "setPlaces" , source , aResult ) ; end end ); client side triggerServerEvent('getPlaces',localPlayer) function loob (table ) guiGridListClear ( GridList ) for index,value in ipairs(table) do local row = guiGridListAddRow(GridList) local allpos=split(value.position,',') guiGridListSetItemText(GridList,row,1,value.name,false,false) guiGridListSetItemData(GridList,row,1,{allpos[1],allpos[2],allpos[3]}) guiGridListSetItemColor(GridList,row,1,0,255,0) end end addEventHandler('setPlaces',root,loob) addEvent('setPlaces',true) جرب اي خدمه طبعا لو بتسوي كودي في نفس السيرفر لا تنسى تسوي دروب للتيبل الاول عشان يزبط Edited July 12, 2017 by Master_MTA 1 Link to comment
1337.Ibrahim Posted July 12, 2017 Author Share Posted July 12, 2017 (edited) @Master_MTA يب سويت , فيه مشكلة ماتجي الأماكن Edited July 12, 2017 by Talis Link to comment
Master_MTA Posted July 12, 2017 Share Posted July 12, 2017 15 minutes ago, Talis said: @Master_MTA يب سويت , فيه مشكلة ماتجي الأماكن لبدي بق Link to comment
1337.Ibrahim Posted July 12, 2017 Author Share Posted July 12, 2017 1 minute ago, Master_MTA said: لبدي بق nothing Link to comment
Master_MTA Posted July 12, 2017 Share Posted July 12, 2017 Just now, Talis said: nothing سويت دروب للتيبل؟ Link to comment
1337.Ibrahim Posted July 12, 2017 Author Share Posted July 12, 2017 Just now, Master_MTA said: سويت دروب للتيبل؟ يب كود الاخ عبدالكريم شغال لاكن المشكلة انه يسوي كولمن ثاني انا ابيه بنفس الكولمن Link to comment
Master_MTA Posted July 12, 2017 Share Posted July 12, 2017 1 minute ago, Talis said: يب كود الاخ عبدالكريم شغال لاكن المشكلة انه يسوي كولمن ثاني انا ابيه بنفس الكولمن ما فهمت ؟ 1 Link to comment
Abdul KariM Posted July 12, 2017 Share Posted July 12, 2017 @Master_MTA كودك ماينفع زي كود عمر مايصير تحط الاحداثيات كلها وعندك كولمنين فقط جرب هذا مع كودي بس بدل الكلينت addEvent ( "setPlaces" , true ) addEventHandler ( "setPlaces" , root , function ( Table ) loob ( ) for index,values in ipairs ( Table ) do local row = guiGridListAddRow ( GridList ) ; guiGridListSetItemText ( GridList , row , 1 , values [ 'name' ] , false , false ) guiGridListSetItemData ( GridList , row , 1 , fromJSON ( values [ 'position' ] ) ) end end ) 2 Link to comment
1337.Ibrahim Posted July 12, 2017 Author Share Posted July 12, 2017 (edited) @Abdul KariM اشكرك جزيل الشكر , الله يسعدك :]] ي شيخ @Master_MTA اشكرك على المساعدة :] Edited July 12, 2017 by Talis 1 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