Jump to content

طلب كود# x2


Recommended Posts

Posted

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

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

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

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

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 )

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

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

 

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
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
15 minutes ago, #BrosS said:

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

aValue يلا سوي 

اهئ

:santa:

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

المتغير افضل

Posted

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

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

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

 

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