Jump to content

طلب كود# x2


Recommended Posts

Posted

السلام عليكم .. 

أبي كود اذا اللاعب ضغط على شيك بوكس

يحمي شخصيته من كل شي 

طلقات الرصاص القتل واللخ..

Posted
setElementData
getElementData
"onClientPlayerDamage"
cancelEvent
"onClientGUIClick"
guiCheckBoxSetSelected
guiCheckBoxGetSelected

 

76561198264399996.png

 

 

 

 

Posted

لا أبي تفصيل .. كأن الواحد يطركم أعوذ بالله 
.. المقصد من أبي مثال يعني أطرح لي كيف تسوي عدم التأثير على الشخصية على أقدر أحطها ع اكثر من مود ##

Posted
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 )

^ في فراغات في المثال انت كملهم وخلاص تسوي المود

Experienced MTA developer for 4 years. | MTA خبرة 4 سنين في برمجة

ليس عليك اسعاد الجميع ,
ولكن عليك بإن لا تؤذي أحداً 

=========
You do not have to make everyone happy,
But you should not hurt anyone

 

Want to contact with me?

 

Discord: JustCarry#2616 (Always there)
Skype: Live:JustCarry10 (Not always)

Posted (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 by MR.NaiF-MTA

p_5141g3501.png

 

Posted

كل الاكواد اللي فوق غلط !

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 )

 

To Contact Me at Skype : [email protected]

Posted

@Default ايوهـ يعطيك العافية ع التنبيه

التعديل :

  1. 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 )
  • Like 1

To Contact Me at Skype : [email protected]

Posted
5 hours ago, #ZA7F //= said:

@Default ايوهـ يعطيك العافية ع التنبيه

التعديل :

  1. 
    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 )
    

ممكن تسوى متغير و خلاص ض

Posted
56 minutes ago, #Soking said:

ممكن تسوى متغير و خلاص ض

داتا أحسن

:albino:

من أراد الفشل عليه بالنجاح

Posted
1 hour ago, #Soking said:

ليه

ماعليك يا عشاق المتغيرات

aValue يلا سوي 

اهئ

:santa:

من أراد الفشل عليه بالنجاح

Posted
15 minutes ago, #BrosS said:

ماعليك يا عشاق المتغيرات

aValue يلا سوي 

اهئ

:santa:

 يا حبي اأداتا تستهلك

المتغير افضل

Posted

اذا استخدمتها بكثرهـ راح تستهلك بكثرهـ او اذا استخدمتها بطريقة خطأ

!!! واذا ع المتغير اتوقع يقدر يسويها بنفسه مو صعبة .. ما يحتاج تكبرو الموضوع وهو بسيط 

  • Like 1

To Contact Me at Skype : [email protected]

Posted
22 minutes ago, #ZA7F //= said:

اذا استخدمتها بكثرهـ راح تستهلك بكثرهـ او اذا استخدمتها بطريقة خطأ

!!! واذا ع المتغير اتوقع يقدر يسويها بنفسه مو صعبة .. ما يحتاج تكبرو الموضوع وهو بسيط 

لا انا احاول اخلى الاجابه تدقيقه و أقل استهلاك

عموما حياك الله ض

  • Like 1
Posted
On ٩‏/٥‏/٢٠١٧ at 18:35, #ZA7F //= said:

@Default ايوهـ يعطيك العافية ع التنبيه

التعديل :

  1. 
    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 )
    

يعطيك الف عافية, لكن أقدر احلي اللاعب اذا ضغط على الشيك بوكس وطلع ودخل يكون على نفس حالة مضغوط

Posted
7 hours ago, w7sH said:

يعطيك الف عافية, لكن أقدر احلي اللاعب اذا ضغط على الشيك بوكس وطلع ودخل يكون على نفس حالة مضغوط

accountdata

or 

sql

 

Skype 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted (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 by #ZA7F //=
  • Like 1

To Contact Me at Skype : [email protected]

Posted
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 )

 

يعطيك العافية على مساعدتك لكن الكود ما اشتغل معي

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...