Jump to content

مساعدة في كود


Recommended Posts

السلام عليكم ورحمة الله وبركاته

انا صممت لوحة 

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

كلينت 

GUIEditor = {
    button = {},
    window = {},
    label = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(200, 200, 200, 200, "Zombie professional", false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 1.00)
        guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFECFB49")
	guiSetVisible( GUIEditor.window[1], false )
        GUIEditor.button[1] = guiCreateButton(25, 25, 138, 45, "Take vehicle", false, GUIEditor.window[1])
        GUIEditor.button[2] = guiCreateButton(25, 90, 138, 59, "Destroy vehicle", false, GUIEditor.window[1])
		 GUIEditor.label[1] = guiCreateLabel(40, 160, 147, 16, "By #Aln3mani", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.label[1], "clear-normal")
        guiLabelSetColor(GUIEditor.label[1], 239, 0, 0)

    end
)

function Open ()
	triggerServerEvent( "Open:Window",localPlayer)
end
bindKey( "F9","down",Open )


addEvent( "Open2",true )
addEventHandler( "Open2",root,
	function ( )
		if not guiGetVisible ( GUIEditor.window[1] ) then
			guiSetVisible( GUIEditor.window[1], true )
			showCursor( true ) 
		else
			guiSetVisible( GUIEditor.window[1], false )
            		guiSetInputEnabled ( false )
			showCursor( false )			
		end	
	end
)

addEventHandler ( "onClientGUIClick", root,
	function ( )
		if source == GUIEditor.button[1] then
                	triggerServerEvent ( "Take:Vehicle", localPlayer )
                elseif source == GUIEditor.button[2] then
                        triggerServerEvent ( "Destroy", localPlayer )
               
                end
      end
)

سيرفر 

addEvent( "Open:Window",true )
addEventHandler( "Open:Window",root,
	function ( )
		if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)),aclGetGroup("Zombie-professional-1")) then
			triggerClientEvent( source,"Open2",source )
		end
	end
)

addEvent ( "Take:Vehicle", true)
addEventHandler( "Take:Vehicle",root,
	function ( )
		if Vehicle and isElement ( Vehicle ) then return 
                outputChatBox ("* لأ يمكنك تنزيل مركبة أخري في وجود مركبة اولأ", source,255,0,0,true ) end
		x,y,z  = getElementPosition ( source )
		Vehicle = createVehicle ( 500,  x,  y,  z  )
		warpPedIntoVehicle ( source, Vehicle )
			outputChatBox( "* Done you give Car.",source,0,255,0,true)
           end
)
   

addEvent ( "Destroy", true )
addEventHandler ( "Destroy", root,
	function ( )
		if ( isElement( Vehicle ) ) then 
		destroyElement( Vehicle )
			outputChatBox( "* Done Destroy Car",source,0,255,0,true)
		else
			outputChatBox ("* ليس لديك مركبة", source,255,0,0,true )
		end
	end
)

 

ارجو تصحيح الكود لاني م عرفت له حل 

 

وشكرا

Link to comment

سؤال خارج الموضوع شوي : انت من اليمن .؟
== 

تصحيح الكود :
 

addEvent( "Open:Window",true )
addEventHandler( "Open:Window",root,
	function ( )
		if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)),aclGetGroup("Zombie-professional-1")) then
			triggerClientEvent( source,"Open2",source )
		end
	end
)
Vehicle = { }
addEvent ( "Take:Vehicle", true)
addEventHandler( "Take:Vehicle",root,
	function ( )
		if Vehicle[source] and isElement ( Vehicle[source] ) then return 
                outputChatBox ("* لأ يمكنك تنزيل مركبة أخري في وجود مركبة اولأ", source,255,0,0,true ) end
		x,y,z  = getElementPosition ( source )
		Vehicle[source] = createVehicle ( 500,  x,  y,  z  )
		warpPedIntoVehicle ( source, Vehicle[source] )
			outputChatBox( "* Done you give Car.",source,0,255,0,true)
           end
)
   

addEvent ( "Destroy", true )
addEventHandler ( "Destroy", root,
	function ( )
		if ( isElement( Vehicle[source] ) ) then 
		destroyElement( Vehicle[source] )
			outputChatBox( "* Done Destroy Car",source,0,255,0,true)
		else
			outputChatBox ("* ليس لديك مركبة", source,255,0,0,true )
		end
	end
)

 

Edited by iMr.WiFi..!
Link to comment

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