Sign in to follow this  
ميدوح

Marker in team show Gui

Recommended Posts

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

كيفكم؟

الكود الاولاني تبع شراء تمام

 

Spoiler

 


--- سيرفر ---
--Marker
Marker1 = createMarker (-721.40552, 951.16364, 12.13281, "cylinder", 1.5, 255, 255, 0, 170 )
addEventHandler( "onMarkerHit", Marker1,
function ( hitElement)
 if getElementType ( hitElement ) == "player" then
    triggerClientEvent(hitElement,"marker1",hitElement)
end
end)

--Team
addEventHandler("onResourceStart", resourceRoot,function()
AdminTeam = createTeam ( "Team[1]", 0, 255, 0 )
end)

--set buy team
addEvent ("setTeam", true)
addEventHandler ("setTeam", getRootElement(),function()
 if ( getPlayerMoney(source) >= 500) then
    takePlayerMoney(source,500)
    setPlayerTeam(source, AdminTeam)
    outputChatBox ( "^_^ Team")
end
end)

--- كلنت ---
wind1 = guiCreateWindow(164, 407, 400, 150, "team", false)
		guiSetVisible(wind1,false)
label2 = guiCreateLabel(10, 25, 159, 124, "buy team $500", false, wind1)
button1 = guiCreateButton(270, 110, 72, 33, "ok", false, wind1)
addEventHandler("onClientGUIClick",button1,function()
	triggerServerEvent("setTeam",localPlayer)
end)

----  Marker buy team
addEvent( "marker1", true )
addEventHandler ( "marker1", getRootElement(),function ()
guiSetVisible(wind1,true)
showCursor(true)
end)

 

الكود الثاني : ليش ماتظهر اللوحة؟

--- server ---
Marker2 = createMarker (-720.82202, 963.37451, 12.13281, "cylinder", 1.5, 255, 255, 0, 170 )
addEventHandler( "onMarkerHit",Marker2
function ( hitElement)
    local playerTeam = getPlayerTeam ( source ) 
	local theTeam = getTeamFromName ( playerTeam )
	if ( theTeam ) then
		local players = getPlayersInTeam ( theTeam )
 if getElementType ( hitElement ) == players then
triggerClientEvent(hitElement,"marker2",hitElement)
end
end
end )

--- كلنت ---
wind2 = guiCreateWindow(164, 407, 400, 150, "gui", false)
		guiSetVisible(wind2,false)
--  gui team
addEvent( "marker2", true )
addEventHandler ( "marker2", getRootElement(),function ()
guiSetVisible(wind2,true)
showCursor(true)
end)		

 

Share this post


Link to post

بما ان الكود الاول شغال مافيه مشاكل ماله داعي تحطه 

ع العموم كودك جهة السيرفر يكون بهذا الشكل

addEventHandler( "onMarkerHit",Marker2
function ( hitElement)
	if ( getElementType(hitElement) == 'player' and getPlayerTeam ( hitElement ) ) then
		if getPlayerTeam ( hitElement ) == getTeamFromName('SWAT') then
			triggerClientEvent(hitElement,"marker2",hitElement)
		end
	end
end )

 

شوف سطر 4 غير كلمة سوات الي اسم التيم الي تبيه

Edited by NssoR
  • Like 1

Share this post


Link to post
21 minutes ago, NssoR said:

بما ان الكود الاول شغال مافيه مشاكل ماله داعي تحطه 

ع العموم كودك جهة السيرفر يكون بهذا الشكل


addEventHandler( "onMarkerHit",Marker2
function ( hitElement)
	if ( getElementType(hitElement) == 'player' and getPlayerTeam ( hitElement ) ) then
		if getPlayerTeam ( hitElement ) == getTeamFromName('SWAT') then
			triggerClientEvent(hitElement,"marker2",hitElement)
		end
	end
end )

 

شوف سطر 4 غير كلمة سوات الي اسم التيم الي تبيه

شكرا على ردك السريع .بس عندي سؤال كيف يكون الخروج من الفريق ؟

Share this post


Link to post

اذا كنت تقصد  انك تبي تطرد لاعب من اي تيم هو فيه

تسوي زي كذا

setPlayerTeam(source,nil)

وطبعا كلمة سورس تكون ع حسب الحدث مو بكل الحالات تحطها سورس

  • Like 2

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.