w7sH Posted May 8, 2017 Share Posted May 8, 2017 السلام عليكم .. أبي كود اذا اللاعب ضغط على شيك بوكس يحمي شخصيته من كل شي طلقات الرصاص القتل واللخ.. Link to comment
Ahmed Ly Posted May 8, 2017 Share Posted May 8, 2017 setElementData getElementData "onClientPlayerDamage" cancelEvent "onClientGUIClick" guiCheckBoxSetSelected guiCheckBoxGetSelected Link to comment
#Soking Posted May 8, 2017 Share Posted May 8, 2017 30 minutes ago, w7sH said: ممكن مثال؟ تبي جاهز يعني Link to comment
w7sH Posted May 8, 2017 Author Share Posted May 8, 2017 لا أبي تفصيل .. كأن الواحد يطركم أعوذ بالله .. المقصد من أبي مثال يعني أطرح لي كيف تسوي عدم التأثير على الشخصية على أقدر أحطها ع اكثر من مود ## Link to comment
iMr.WiFi..! Posted May 9, 2017 Share Posted May 9, 2017 addEventHandler ( 'onClientGUIClick', mycheck, ..... ( ) if guiCheckBoxGetSelected ( mycheck) == true .... triggerServerEvent ( 'Ex', localPlayer,true ) elseif guiCheckBoxGetSelected ( mycheck) == false .... triggerServerEvent ( 'Ex', localPlayer,false ) end end ) --- Server addEvent ( 'Ex', true ) addEventHandler ( 'Ex', root, function ( bool ) if getElementData ( source, "root" ) == bool .... setElementData(source,"root",not bool) end setElementData(source,"root",true) end ) addEventHandler ( 'onPlayerDamage',.......,...... ( ) if getElementData ( source,'root' ) == .... then cancelEvent ( ) end end ) ^ في فراغات في المثال انت كملهم وخلاص تسوي المود Link to comment
#STZ Posted May 9, 2017 Share Posted May 9, 2017 (edited) addEventHandler ( 'onClientGUIClick', mycheck,root ( ) if guiCheckBoxGetSelected ( mycheck) == true then triggerServerEvent ( 'Ex', localPlayer,true ) elseif guiCheckBoxGetSelected ( mycheck) == false then triggerServerEvent ( 'Ex', localPlayer,false ) end end ) --- Server addEvent ( 'Ex', true ) addEventHandler ( 'Ex', root, function () if getElementData ( source, "root" ) == NoDmg setElementData(source,"root",NoDmg) end setElementData(source,"root",true) end ) addEventHandler ( 'onPlayerDamage',root ( ) if getElementData ( source,'root' ) == NoDmg then cancelEvent ( ) end end ) Edited May 9, 2017 by MR.NaiF-MTA Link to comment
' A F . Posted May 9, 2017 Share Posted May 9, 2017 onPlayerDamage ماتقدر تسوي له cancelEvent 'onClientPlayerDamage' Link to comment
#DRAGON!FIRE Posted May 9, 2017 Share Posted May 9, 2017 كل الاكواد اللي فوق غلط ! addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == checkbox ) then local checkBox_state = guiCheckBoxGetSelected ( source ) setElementData ( source, "damgeState", checkBox_state ) end end ) addEventHandler ( "onClientPlayerDamage", localPlayer, function ( ) if ( getElementData ( localPlayer, "damgeState" ) ) then cancelEvent ( ) end end ) Link to comment
' A F . Posted May 9, 2017 Share Posted May 9, 2017 (edited) سطر 4 انت حاط الداتا على الزر موب على اللاعب .. شكلك مسوية مستعجل @#ZA7F //= Edited May 9, 2017 by Default 1 Link to comment
#DRAGON!FIRE Posted May 9, 2017 Share Posted May 9, 2017 @Default ايوهـ يعطيك العافية ع التنبيه التعديل : addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == checkbox ) then local checkBox_state = guiCheckBoxGetSelected ( source ) setElementData ( localPlayer, "damgeState", checkBox_state ) end end ) addEventHandler ( "onClientPlayerDamage", localPlayer, function ( ) if ( getElementData ( localPlayer, "damgeState" ) ) then cancelEvent ( ) end end ) 1 Link to comment
#Soking Posted May 9, 2017 Share Posted May 9, 2017 5 hours ago, #ZA7F //= said: @Default ايوهـ يعطيك العافية ع التنبيه التعديل : addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == checkbox ) then local checkBox_state = guiCheckBoxGetSelected ( source ) setElementData ( localPlayer, "damgeState", checkBox_state ) end end ) addEventHandler ( "onClientPlayerDamage", localPlayer, function ( ) if ( getElementData ( localPlayer, "damgeState" ) ) then cancelEvent ( ) end end ) ممكن تسوى متغير و خلاص ض Link to comment
#BrosS Posted May 9, 2017 Share Posted May 9, 2017 56 minutes ago, #Soking said: ممكن تسوى متغير و خلاص ض داتا أحسن Link to comment
#Soking Posted May 10, 2017 Share Posted May 10, 2017 12 hours ago, #BrosS said: داتا أحسن ليه Link to comment
#BrosS Posted May 10, 2017 Share Posted May 10, 2017 1 hour ago, #Soking said: ليه ماعليك يا عشاق المتغيرات aValue يلا سوي اهئ Link to comment
#Soking Posted May 10, 2017 Share Posted May 10, 2017 15 minutes ago, #BrosS said: ماعليك يا عشاق المتغيرات aValue يلا سوي اهئ يا حبي اأداتا تستهلك المتغير افضل Link to comment
#DRAGON!FIRE Posted May 10, 2017 Share Posted May 10, 2017 اذا استخدمتها بكثرهـ راح تستهلك بكثرهـ او اذا استخدمتها بطريقة خطأ !!! واذا ع المتغير اتوقع يقدر يسويها بنفسه مو صعبة .. ما يحتاج تكبرو الموضوع وهو بسيط 1 Link to comment
#Soking Posted May 10, 2017 Share Posted May 10, 2017 22 minutes ago, #ZA7F //= said: اذا استخدمتها بكثرهـ راح تستهلك بكثرهـ او اذا استخدمتها بطريقة خطأ !!! واذا ع المتغير اتوقع يقدر يسويها بنفسه مو صعبة .. ما يحتاج تكبرو الموضوع وهو بسيط لا انا احاول اخلى الاجابه تدقيقه و أقل استهلاك عموما حياك الله ض 1 Link to comment
w7sH Posted May 14, 2017 Author Share Posted May 14, 2017 On ٩/٥/٢٠١٧ at 18:35, #ZA7F //= said: @Default ايوهـ يعطيك العافية ع التنبيه التعديل : addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == checkbox ) then local checkBox_state = guiCheckBoxGetSelected ( source ) setElementData ( localPlayer, "damgeState", checkBox_state ) end end ) addEventHandler ( "onClientPlayerDamage", localPlayer, function ( ) if ( getElementData ( localPlayer, "damgeState" ) ) then cancelEvent ( ) end end ) يعطيك الف عافية, لكن أقدر احلي اللاعب اذا ضغط على الشيك بوكس وطلع ودخل يكون على نفس حالة مضغوط Link to comment
Master_MTA Posted May 15, 2017 Share Posted May 15, 2017 7 hours ago, w7sH said: يعطيك الف عافية, لكن أقدر احلي اللاعب اذا ضغط على الشيك بوكس وطلع ودخل يكون على نفس حالة مضغوط accountdata or sql Link to comment
#DRAGON!FIRE Posted May 15, 2017 Share Posted May 15, 2017 (edited) Client : addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == checkbox ) then local checkBox_state = guiCheckBoxGetSelected ( source ) setElementData ( localPlayer, "damgeState", checkBox_state ) triggerServerEvent ( "saveNewState", localPlayer, checkBox_state ) end end ) addEventHandler ( "onClientPlayerDamage", localPlayer, function ( ) if ( getElementData ( localPlayer, "damgeState" ) ) then cancelEvent ( ) end end ) addEvent ( "setCheckBox", true ) addEventHandler ( "setCheckBox", root, function ( nState ) stateToValue = nState == "on" and true or false guiCheckBoxSetSelected ( YourCheckBox, stateToValue ) end ) Server : addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS statusSQL ( serial, state )" ) for k,v in ipairs ( getElementsByType "player" ) do stRow = executeSQLQuery ( "SELECT * FROM statusSQL WHERE serial=?", getPlayerSerial ( v ) ) if stRow and #stRow > 0 then stToValue = stRow[1].state == "on" and true or false setElementData ( v, "damgeState", stToValue ) triggerClientEvent ( v, "setCheckBox", v, stRow[1].state ) end end end ) addEventHandler ( "onPlayerJoin", root, function ( ) local sRow = executeSQLQuery ( "SELECT * FROM statusSQL WHERE serial=?", getPlayerSerial ( source ) ) if sRow and #sRow > 0 then stateToValue = sRow[1].state == "on" and true or false setElementData ( source, "damgeState", stateToValue ) triggerClientEvent ( source, "setCheckBox", source, sRow[1].state ) end end ) addEvent ( "saveNewState", true ) addEventHandler ( "saveNewState", root, function ( nState ) local stateString = nState == true and "on" or "off" local sRow = executeSQLQuery ( "SELECT * FROM statusSQL WHERE serial=?", getPlayerSerial ( source ) ) if sRow and #sRow > 0 then executeSQLQuery ( "UPDATE statusSQL SET state=? WHERE serial=?", stateString, getPlayerSerial ( source ) ) else executeSQLQuery ( "INSERT INTO statusSQL ( serial, state ) VALUES ( ?,? )", getPlayerSerial ( source ), stateString ) end end ) Edited May 15, 2017 by #ZA7F //= 1 Link to comment
#BrosS Posted May 15, 2017 Share Posted May 15, 2017 @#ZA7F //= يا محب أفعال الخير ض 1 Link to comment
w7sH Posted May 15, 2017 Author Share Posted May 15, 2017 6 hours ago, #ZA7F //= said: Client : addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == checkbox ) then local checkBox_state = guiCheckBoxGetSelected ( source ) setElementData ( localPlayer, "damgeState", checkBox_state ) triggerServerEvent ( "saveNewState", localPlayer, checkBox_state ) end end ) addEventHandler ( "onClientPlayerDamage", localPlayer, function ( ) if ( getElementData ( localPlayer, "damgeState" ) ) then cancelEvent ( ) end end ) addEvent ( "setCheckBox", true ) addEventHandler ( "setCheckBox", root, function ( nState ) stateToValue = nState == "on" and true or false guiCheckBoxSetSelected ( YourCheckBox, stateToValue ) end ) Server : addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS statusSQL ( serial, state )" ) for k,v in ipairs ( getElementsByType "player" ) do stRow = executeSQLQuery ( "SELECT * FROM statusSQL WHERE serial=?", getPlayerSerial ( v ) ) if stRow and #stRow > 0 then stToValue = stRow[1].state == "on" and true or false setElementData ( v, "damgeState", stToValue ) triggerClientEvent ( v, "setCheckBox", v, stRow[1].state ) end end end ) addEventHandler ( "onPlayerJoin", root, function ( ) local sRow = executeSQLQuery ( "SELECT * FROM statusSQL WHERE serial=?", getPlayerSerial ( source ) ) if sRow and #sRow > 0 then stateToValue = sRow[1].state == "on" and true or false setElementData ( source, "damgeState", stateToValue ) triggerClientEvent ( source, "setCheckBox", source, sRow[1].state ) end end ) addEvent ( "saveNewState", true ) addEventHandler ( "saveNewState", root, function ( nState ) local stateString = nState == true and "on" or "off" local sRow = executeSQLQuery ( "SELECT * FROM statusSQL WHERE serial=?", getPlayerSerial ( source ) ) if sRow and #sRow > 0 then executeSQLQuery ( "UPDATE statusSQL SET state=? WHERE serial=?", stateString, getPlayerSerial ( source ) ) else executeSQLQuery ( "INSERT INTO statusSQL ( serial, state ) VALUES ( ?,? )", getPlayerSerial ( source ), stateString ) end end ) يعطيك العافية على مساعدتك لكن الكود ما اشتغل معي Link to comment
#DRAGON!FIRE Posted May 15, 2017 Share Posted May 15, 2017 100% جربته وشغال استبدلت اسماء الشيك بوكس ؟ .. شوف الديبوق 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