Jump to content

مشكلة تسجيل


Recommended Posts

السلام عليككم صصباحح الخخير @@@@@

 

debugscript 3 معي لوحة تسجيل بس في اخطاء  في

 

1135 - 1315 - 418 - 419 في الاسطر

تقدروأ تصلحوهـأ

 



-------------------------=============LoginPlanel===============---------------------------
PathImage  = {}

_guiCreateStaticImage = guiCreateStaticImage
function guiCreateStaticImage( X, Y, W, D, URl , R, P )
	Image = _guiCreateStaticImage(X, Y, W, D, "images/"..URl..".png", R, P)
	PathImage[Image] = URl
	return Image
end


addEventHandler("onClientResourceStart", resourceRoot,
function()
	local screenW, screenH = guiGetScreenSize()
	staticimage = {} label = {} edit = {}
	MainLabel = guiCreateLabel((screenW - 399) / 2, (screenH - 248) / 2, 399, 248, "", false )
	WarningLabel = guiCreateLabel(5, 50, 399, 28, "", false, MainLabel)
	guiSetFont(WarningLabel, "default-bold-small")  
	guiLabelSetColor(WarningLabel, 255, 0, 0)
		
	-- Login Window
	LoginLabel = guiCreateLabel(0, 0, 399, 248, "", false, MainLabel)
	staticimage[1] = _guiCreateStaticImage(0, 0, 399, 54, "images/login_window.png", false, LoginLabel)
	staticimage[2] = guiCreateStaticImage(259, 85, 140, 54, "login", false, LoginLabel)
	staticimage[3] = guiCreateStaticImage(259, 140, 140, 54, "register", false, LoginLabel)
	staticimage[4] = guiCreateStaticImage(259, 195, 140, 54, "recovery", false, LoginLabel)
	edit[1] = guiCreateEdit(111, 101, 148, 25, "", false, LoginLabel)
	edit[2] = guiCreateEdit(111, 149, 148, 25, "", false, LoginLabel)
	checkbox = guiCreateCheckBox(111, 179, 78, 15, "(Keep Saved!)", false, false, LoginLabel)
	guiSetFont(checkbox, "default-small")
	label[1] = guiCreateLabel(51, 106, 64, 18, "Username: ", false, LoginLabel)
	label[2] = guiCreateLabel(51, 156, 64, 18, "Password: ", false, LoginLabel)
	label[3] = guiCreateLabel(49, 195, 210, 15, "You are Registered as:", false, LoginLabel)
	label[4] = guiCreateLabel(49, 215, 210, 15, "Forget Your Passowrd? Click Here --->", false, LoginLabel)
	guiLabelSetColor(label[3], 0, 255, 255)
	guiLabelSetColor(label[4], 0, 255, 0)
	
	-- Register Window
	RegisterLabel = guiCreateLabel(0, 0, 399, 248, "", false, MainLabel)
	staticimage[5] = _guiCreateStaticImage(0, 0, 399, 54, "images/register_window.png", false, RegisterLabel)
	staticimage[6] = guiCreateStaticImage(109, 195, 140, 54, "registerT", false, RegisterLabel)
	staticimage[7] = guiCreateStaticImage(259, 195, 140, 54, "back", false, RegisterLabel)
	edit[3] = guiCreateEdit(166, 81, 148, 25, "", false, RegisterLabel)
	edit[4] = guiCreateEdit(166, 116, 148, 25, "", false, RegisterLabel)
	edit[5] = guiCreateEdit(166, 151, 148, 25, "", false, RegisterLabel)  
	label[5] = guiCreateLabel(51, 81, 64, 18, "Username: ", false, RegisterLabel)
	label[6] = guiCreateLabel(51, 119, 64, 18, "Password: ", false, RegisterLabel)
	label[7] = guiCreateLabel(51, 151, 115, 18, "Confirm Password: ", false, RegisterLabel)  
	guiSetVisible(RegisterLabel, false)
	
	-- Rcovery 1 Window
    Rcovery_1_Label = guiCreateLabel(0, 0, 399, 248, "", false, MainLabel)
	staticimage[8] = _guiCreateStaticImage(0, 0, 399, 54, "images/recoveryMine.png", false, Rcovery_1_Label)
	staticimage[9] = guiCreateStaticImage(132, 194, 140, 54, "back", false, Rcovery_1_Label)
	staticimage[10] = guiCreateStaticImage(15, 64, 370, 56, "recoverySP", false, Rcovery_1_Label) 
	guiSetVisible ( Rcovery_1_Label, false)
	
	-- Rcovery 2 Window
    Rcovery_2_Label = guiCreateLabel(0, 0, 399, 248, "", false, MainLabel)
	staticimage[12] = _guiCreateStaticImage(0, 0, 399, 54, "images/recoveryAccountData.png", false, Rcovery_2_Label)
	staticimage[13] = guiCreateStaticImage(132, 194, 140, 54, "back", false, Rcovery_2_Label)
	edit[6] = guiCreateEdit(79, 64, 109, 25, "", false, Rcovery_2_Label)
	edit[7] = guiCreateEdit(260, 64, 109, 25, "", false, Rcovery_2_Label)  
	guiEditSetReadOnly( edit[6], true )
	guiEditSetReadOnly( edit[7], true )
	label[8] = guiCreateLabel(10, 68, 69, 15, "Account(1):", false, Rcovery_2_Label)
	label[9] = guiCreateLabel(204, 68, 56, 15, "Password:", false, Rcovery_2_Label)
	guiLabelSetColor(label[8], 0, 255, 0)
	guiLabelSetColor(label[9], 0, 255, 255)
	guiSetVisible ( Rcovery_2_Label, false)
	
	setCameraMatrix(  1484.3911132813, -1674.2763671875, 77.577201843262, 1564.5532226563, -1674.4821777344, 17.794372558594  )
	fadeCamera (true)
	triggerServerEvent ( "getInformation", localPlayer)
	SOUND = playSound("images/Intro.ogg", true)
	showPlayerHudComponent( "all", false )
	showCursor( true )
	showChat( false )
	setTime( 12, 00 )
end )


addEventHandler( "onClientGUIClick", resourceRoot, 
function ( )
	if (source == staticimage[2]) then
		USERNAME = guiGetText (edit[1])
		PASSWORD = guiGetText (edit[2])
		if ( USERNAME ~= "" ) then
			if ( PASSWORD ~= "" ) then
				triggerServerEvent ("LOGIN", localPlayer, USERNAME, PASSWORD, guiCheckBoxGetSelected(checkbox) )
			else
				showWarning("Please Enter your Passowrd!", "الرجاء إدخال كلمة المرور!")
			end
		else
			showWarning("Please Enter The Username!", "الرجاء إدخال اسم المستخدم!")
		end
	elseif ( source == staticimage[6] ) then
		USERNAME = guiGetText (edit[3])
		PASSWORD = guiGetText (edit[4])
		RE_PASSWORD = guiGetText (edit[5])
		if ( USERNAME ~= "" ) then
			if ( PASSWORD ~= "" ) then
				if ( PASSWORD == RE_PASSWORD ) then
					triggerServerEvent ("REGISTER", localPlayer, USERNAME, PASSWORD, RE_PASSWORD )
				else
					showWarning("Password does not match the confirm password.", "كلمة المرور لا تطابق تاكيد كلمة المرور.")
				end
			else
				showWarning("Please Enter your Passowrd!", "الرجاء إدخال كلمة المرور!")
			end
		else
			showWarning("Please Enter The Username!", "الرجاء إدخال اسم المستخدم!")
		end
	elseif ( source == staticimage[3] ) then
		guiSetVisible ( LoginLabel, false)
		guiSetVisible ( RegisterLabel, true)
	elseif ( source == staticimage[7] ) then
		guiSetVisible ( RegisterLabel, false)
		guiSetVisible ( LoginLabel, true)
	elseif ( source == staticimage[4] ) then
		guiSetVisible ( LoginLabel, false)
		guiSetVisible ( Rcovery_1_Label, true)
	elseif ( source == staticimage[9] ) then
		guiSetVisible ( Rcovery_1_Label, false)
		guiSetVisible ( LoginLabel, true)
	elseif ( source == staticimage[10] ) then
		guiSetVisible ( Rcovery_1_Label, false)
		guiSetVisible ( Rcovery_2_Label, true)
	elseif ( source == staticimage[13] ) then
		guiSetVisible ( Rcovery_2_Label, false)
		guiSetVisible ( LoginLabel, true)
	end
end )


addEventHandler( "onClientMouseEnter", resourceRoot, 
function()
	if ( getElementType(source) == "gui-staticimage" )  then
		local Path = PathImage[source]
		if ( Path ) then
			guiStaticImageLoadImage ( source, "images/"..Path.."2.png" )
		end
	end
end )

addEventHandler( "onClientMouseLeave", resourceRoot, 
function()
	if ( getElementType(source) == "gui-staticimage" ) then
		local Path = PathImage[source]
		if ( Path ) then
			guiStaticImageLoadImage ( source, "images/"..Path..".png" )
		end
	end
end )

function showWarning( ENGLISH, ARABIC )
	if ( isTimer(Timer) ) then
		killTimer(Timer)
	end
	guiSetText(WarningLabel, ARABIC.."\n"..ENGLISH )
	Timer = setTimer(function()
		guiSetText(WarningLabel, "" )
	end, 5000, 1 )
end
addEvent("showWarning", true)
addEventHandler("showWarning",root,showWarning)

addEvent("setInformation", true)
addEventHandler("setInformation",root,
function( USERNAME, PASSWORD, SAVE )
	if ( SAVE == "TRUE" ) then
		guiSetText(edit[1],USERNAME)
		guiSetText(edit[2],PASSWORD)
		guiCheckBoxSetSelected(checkbox,true)
	end
	guiSetText(label[3],"You are Registered as: "..USERNAME)
	guiSetText(edit[6],USERNAME)
	guiSetText(edit[7],PASSWORD)
end )

addEvent("HideLoginPanel", true)
addEventHandler("HideLoginPanel",root,
function(  )
	setCameraTarget( localPlayer, localPlayer )
	showPlayerHudComponent( "all", true )
	guiSetVisible ( MainLabel, false)
	destroyElement( SOUND )
	showCursor( false )
	showChat( true )
end )




-----------------------===========================-----------------------------------

addEvent("onLoginSuccess", true)
addEventHandler("onLoginSuccess", root,
function()
	local radioURL = "http://cdn.top4top.net/d_535afed2b31.mp3"
	SelectSong = playSound(radioURL, true)
	showCursor(false)
	skinCount = 0
	sPed = createPed(105, -2819.83545, 1177.29004, 20.27344)
	local pDim = getElementDimension ( localPlayer ) 
	local pInt = getElementInterior ( localPlayer ) 
	setElementDimension ( sPed, 0 ) 
	setElementInterior ( sPed, 0 ) 
	setElementDimension ( localPlayer, 0 ) 
	setElementInterior ( localPlayer, 0 ) 
	sRight()
	bindKey("arrow_l", "down", sLeft)
	bindKey("arrow_r", "down", sRight)
	bindKey("arrow_u", "down", sUp)
	bindKey("arrow_d", "down", sDown)
	bindKey("enter", "down", EnterSpawn)
	addEventHandler("onClientPreRender", root, drawTeamName)
	addEventHandler("onClientPreRender", root, loginRender)
	removeEventHandler("onClientPreRender", root, loginPanelRender)
	setElementData(localPlayer,"NoComm",false)
end)


local skinTable = {
	-- skinID, team --

	{71 , "Police"}, {73 , "Police"}, {163, "Police"},
	{164, "Police"}, {165, "Police"}, {166, "Police"},
	{265, "Police"}, {266, "Police"}, {267, "Police"},
	{280, "Police"}, {281, "Police"}, {282, "Police"},
	{283, "Police"}, {284, "Police"}, {285, "Police"},
	{286, "Police"}, {287, "Police"}, {288, "Police"},
	{312, "Police"},

	{274, "Medic"}, {275, "Medic"}, {276, "Medic"},
	{70, "Medic"},

	{105, "Grove"}, {106, "Grove"}, {107, "Grove"},
	{269, "Grove"}, {270, "Grove"},
	{300, "Grove"}, {301, "Grove"}, {311, "Grove"},

	{114, "Aztecas"}, {115, "Aztecas"}, {116, "Aztecas"},
	{292, "Aztecas"},

	{108, "Vagos"}, {109, "Vagos"}, {110, "Vagos"},

	{102, "Ballas"}, {103, "Ballas"}, {104, "Ballas"}, {293, "Ballas"},

	{124, "Mafia"}, {125, "Mafia"}, {126, "Mafia"},
	{127, "Mafia"}, {296, "Mafia"},

	{111, "Russians"}, {112, "Russians"}, {113, "Russians"},

	{173, "Rifa"}, {174, "Rifa"}, {175, "Rifa"},
	{307, "Rifa"},

	{117, "Triads"}, {118, "Triads"}, {120, "Triads"},
	{294, "Triads"},

	{121, "Da Nang Boys"}, {122, "Da Nang Boys"}, {123, "Da Nang Boys"},

	{0, "No Team"}, {1, "No Team"}, {2, "No Team"},
	{7, "No Team"}, {14, "No Team"},
	{16, "No Team"}, {17, "No Team"},
	{18, "No Team"}, {19, "No Team"}, {20, "No Team"},
	{21, "No Team"}, {22, "No Team"}, {23, "No Team"},
	{24, "No Team"}, {25, "No Team"}, {26, "No Team"},
	{27, "No Team"}, {28, "No Team"}, {29, "No Team"},
	{30, "No Team"}, {32, "No Team"}, {33, "No Team"},
	{34, "No Team"}, {35, "No Team"}, {36, "No Team"},
	{37, "No Team"}, {43, "No Team"}, {44, "No Team"},
	{45, "No Team"}, {46, "No Team"}, {47, "No Team"},
	{48, "No Team"}, {49, "No Team"}, {50, "No Team"},
	{51, "No Team"}, {52, "No Team"}, {57, "No Team"},
	{58, "No Team"}, {59, "No Team"}, {60, "No Team"},
	{61, "No Team"}, {62, "No Team"}, {66, "No Team"},
	{68, "No Team"},
	{72, "No Team"}, {78, "No Team"}, {79, "No Team"},
	{80, "No Team"}, {81, "No Team"}, {82, "No Team"},
	{83, "No Team"}, {84, "No Team"}, {94, "No Team"},
	{95, "No Team"}, {96, "No Team"}, {97, "No Team"},
	{98, "No Team"}, {99, "No Team"},
	{101, "No Team"}, {128, "No Team"}, {132, "No Team"},
	{133, "No Team"}, {134, "No Team"}, {135, "No Team"},
	{136, "No Team"}, {142, "No Team"}, {143, "No Team"},
	{144, "No Team"}, {146, "No Team"}, {153, "No Team"},
	{154, "No Team"}, {155, "No Team"}, {156, "No Team"},
	{158, "No Team"}, {159, "No Team"}, {160, "No Team"},
	{161, "No Team"}, {162, "No Team"}, {167, "No Team"},
	{168, "No Team"}, {170, "No Team"}, {171, "No Team"},
	{176, "No Team"}, {177, "No Team"}, {179, "No Team"},
	{180, "No Team"}, {181, "No Team"}, {182, "No Team"},
	{183, "No Team"}, {184, "No Team"}, {185, "No Team"},
	{186, "No Team"}, {187, "No Team"}, {188, "No Team"},
	{189, "No Team"}, {200, "No Team"}, {202, "No Team"},
	{203, "No Team"}, {204, "No Team"}, {206, "No Team"},
	{209, "No Team"}, {210, "No Team"}, {212, "No Team"},
	{213, "No Team"}, {220, "No Team"},
	{221, "No Team"}, {222, "No Team"}, {227, "No Team"},
	{228, "No Team"}, {229, "No Team"}, {230, "No Team"},
	{231, "No Team"}, {234, "No Team"}, {235, "No Team"},
	{236, "No Team"}, {239, "No Team"}, {240, "No Team"},
	{241, "No Team"}, {242, "No Team"}, {247, "No Team"},
	{248, "No Team"}, {249, "No Team"}, {250, "No Team"},
	{252, "No Team"}, {253, "No Team"}, {254, "No Team"},
	{255, "No Team"}, {258, "No Team"}, {259, "No Team"},
	{260, "No Team"}, {261, "No Team"}, {262, "No Team"},
	{264, "No Team"}, {272, "No Team"}, {278, "No Team"},
	{279, "No Team"}, {279, "No Team"}, {290, "No Team"},
	{291, "No Team"}, {295, "No Team"}, {297, "No Team"},
	{299, "No Team"}, {302, "No Team"}, {303, "No Team"},
	{305, "No Team"}, {306, "No Team"}, {308, "No Team"},
	{309, "No Team"}, {310, "No Team"}, 
}

function adjSelectionSetting(team)
	if isTimer(sttimer) then
	killTimer ( sttimer )
	end
		setElementFrozen ( sPed, true )
	if team == "Grove" then --
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Vagos" then --
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Ballas" then --
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Mafia" then --
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Russians" then --
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Rifa" then --
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Aztecas" then --
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Medic" then
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Police" then
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "No Team" then
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Da Nang Boys" then
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	elseif team == "Triads" then
		setCameraMatrix(-2821.123046875, 1184.1121826172, 21.084520339966, -2804.1689453125, 1085.6723632813, 16.377283096313)
		setElementPosition(sPed, -2819.83545, 1177.29004, 20.27344)
		setPedRotation(sPed, 8)
		updateSetting(team)
	setPedAnimation(sPed, "GANGS", "Invite_Yes")
	sttimer = setTimer(setPedAnimation,5000,1,sPed, "DANCING", "dnce_M_d")
	end
end

--CCCZXXX = createObject (1241,math.random (1404,1497),-1328,math.random (210,255))
--setElementAlpha (CCCZXXX,0)
--moveObject (CCCZXXX,10000,math.random (1404,1497),-1328,math.random (210,255))
--setTimer(function()
--moveObject (CCCZXXX,10000,math.random (1404,1497),-1328,math.random (210,255))
--end,10000,0)

function loginRender ()
	local xxx,yyy,zzz = getElementPosition(CCCZXXX)
	setCameraMatrix(1375.17, -1221.46, 202.44, xxx,yyy,zzz)
end

far = 0
fary = 0
setFarClipDistance(800)

function loginPanelRender ()
	far = far - 0.1
	fary = fary - 0.02
	setCameraMatrix(0 - far, -1309 - fary, 250, 1536, -1309, 150)
end

function updateSetting(team)
	if team == "Medic" then
		local rand = math.random(1, 2)
		if rand == 1 then
			sX, sY, sZ, sR = 2025.96, -1422.59, 16.99, 135
		elseif rand == 2 then
			sX, sY, sZ, sR = 1179.55, -1323.64, 14.17, 271
		end
	elseif team == "Police" then
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = 1550.90, -1675.63, 15.61, 90
		elseif rand == 2 then
			sX, sY, sZ, sR = 1579.61, -1634.83, 13.56, 90
		elseif rand == 3 then
			sX, sY, sZ, sR = 1568.56, -1693.54, 5.85, 180
		elseif rand == 4 then	
			sX, sY, sZ, sR = 1543.81, -1610.84, 13.38, 270
		end
	elseif team == "No Team" then
		local rand = math.random(1, 17)
		if rand == 1 then
			sX, sY, sZ, sR = 1519.55, -1459.38, 9.5, 180
		elseif rand == 2 then
			sX, sY, sZ, sR = 1766.66, -1396.39, 15.75, 360
		elseif rand == 3 then
			sX, sY, sZ, sR = 1954.41, -1372.20, 19.64, 90.0
		elseif rand == 4 then
			sX, sY, sZ, sR = 1770.85, -1656.83, 14.42, 130
		elseif rand == 5 then
			sX, sY, sZ, sR = 1654.14, -1657.07, 22.51, 180
		elseif rand == 6 then
			sX, sY, sZ, sR = 1568.24, -1889.93, 13.55, 360
		elseif rand == 7 then
			sX, sY, sZ, sR = 1449.45, -1847.18, 13.54, 360
		elseif rand == 8 then
			sX, sY, sZ, sR = 1210.05, -1748.19, 13.59, 36
		elseif rand == 9 then
			sX, sY, sZ, sR = 1115.90, -1619.24, 20.48, 90.0
		elseif rand == 10 then
			sX, sY, sZ, sR = 1129.08, -1488.75, 22.76, 360
		elseif rand == 11 then
			sX, sY, sZ, sR = 1151.11, -1206.33, 19.20, 180
		elseif rand == 12 then
			sX, sY, sZ, sR = 1318.73, -1182.44, 23.60, 322
		elseif rand == 13 then
			sX, sY, sZ, sR = 1545.38, -1270.61, 17.40, 137
		elseif rand == 14 then
			sX, sY, sZ, sR = 1657.71, -1424.82, 13.72, 180
		elseif rand == 15 then
			sX, sY, sZ, sR = 1422.73, -1491.91, 20.42, 240
		elseif rand == 16 then
			sX, sY, sZ, sR = 1722.77, -1634.68, 20.21, 360
		elseif rand == 17 then
			sX, sY, sZ, sR = 2464.70, -1953.54, 16.81, 360
		end
	elseif team == "Grove" then
		local rand = math.random(1, 5)
		if rand == 1 then
			sX, sY, sZ, sR = 2530.45, -1667.44, 15.16, 90.0
		elseif rand == 2 then
			sX, sY, sZ, sR = 2531.70, -1692.42, 13.58, 55
		elseif rand == 3 then
			sX, sY, sZ, sR = 2454.96, -1709.97, 13.61, 180
		elseif rand == 4 then	
			sX, sY, sZ, sR = 2486.81, -1646.95, 14.07, 180
		elseif rand == 5 then	
			sX, sY, sZ, sR = 2527.13, -1639.90, 13.91, 312
		end
	elseif team == "Vagos" then
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = 2287.99, -1106.17, 37.97, 170
		elseif rand == 2 then
			sX, sY, sZ, sR = 2288.22, -1079.50, 47.54, 339
		elseif rand == 3 then
			sX, sY, sZ, sR = 2256.29, -1068.54, 49.47, 50
		elseif rand == 4 then	
			sX, sY, sZ, sR = 2227.05, -1061.33, 46.01, 224
		end
	elseif team == "Ballas" then
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = 2231.23, -1333.31, 23.98, 90.0
		elseif rand == 2 then
			sX, sY, sZ, sR = 2202.84, -1365.97, 25.67, 180
		elseif rand == 3 then
			sX, sY, sZ, sR = 2230.10, -1281.96, 25.36, 180
		elseif rand == 4 then	
			sX, sY, sZ, sR = 2192.19, -1278.71, 24.61, 180
		end
	elseif team == "Aztecas" then
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = 1754.82, -1912.01, 13.56, 270
		elseif rand == 2 then
			sX, sY, sZ, sR = 1751.16, -1944.62, 13.56, 180
		elseif rand == 3 then
			sX, sY, sZ, sR = 1764.11, -1930.78, 13.56, 360
		elseif rand == 4 then	
			sX, sY, sZ, sR = 1731.78, -1911.95, 13.56, 90.0
		end
	elseif team == "Russians" then
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = -2623.17, 1407.76, 7.10, 196
		elseif rand == 2 then
			sX, sY, sZ, sR = -2631.40, 1429.70, 7.10, 345
		elseif rand == 3 then
			sX, sY, sZ, sR = -2656.04, 1357.96, 7.04, 270
		elseif rand == 4 then	
			sX, sY, sZ, sR = -2690.21, 1389.84, 7.10, 165
		end
	elseif team == "Mafia" then
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = -1951.61, 641.12, 46.56, 360
		elseif rand == 2 then
			sX, sY, sZ, sR = -1919.02, 671.50, 46.56, 90.0
		elseif rand == 3 then
			sX, sY, sZ, sR = -1983.86, 671.39, 46.56, 270
		elseif rand == 4 then	
			sX, sY, sZ, sR = -1959.79, 708.49, 46.56, 180
		end
	elseif team == "Rifa" then
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = -2032.94, 148.59, 28.83, 270
		elseif rand == 2 then
			sX, sY, sZ, sR = -2133.41, 195.18, 35.33, 180
		elseif rand == 3 then
			sX, sY, sZ, sR = -2119.18, 222.64, 35.07, 360
		elseif rand == 4 then	
			sX, sY, sZ, sR = -2043.21, 307.21, 35.20, 90.0
		end
	elseif team == "Da Nang Boys" then
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = -2105.18, 902.07, 76.62, 360
		elseif rand == 2 then
			sX, sY, sZ, sR = -2116.93, 925.36, 86.07, 180
		elseif rand == 3 then
			sX, sY, sZ, sR = -2058.93, 892.84, 61.54, 360
		elseif rand == 4 then	
			sX, sY, sZ, sR = -2073.49, 974.01, 62.92, 190
		end
	elseif team == "Triads" then
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = -2182.64, 716.05, 53.89, 180
		elseif rand == 2 then
			sX, sY, sZ, sR = -2173.96, 680.06, 55.16, 90.0
		elseif rand == 3 then
			sX, sY, sZ, sR = -2174.01, 632.32, 49.43, 360
		elseif rand == 4 then	
			sX, sY, sZ, sR = -2206.77, 652.92, 49.43, 180
		end
	else
		local rand = math.random(1, 4)
		if rand == 1 then
			sX, sY, sZ, sR = 1550.90, -1675.63, 15.61, 90
		elseif rand == 2 then
			sX, sY, sZ, sR = 1579.61, -1634.83, 13.56, 90
		elseif rand == 3 then
			sX, sY, sZ, sR = 1568.56, -1693.54, 5.85, 180
		elseif rand == 4 then	
			sX, sY, sZ, sR = 1543.81, -1610.84, 13.38, 270
		end
	end
end

function sRight()
	skinCount = skinCount + 1
	if skinCount > #skinTable then
		skinCount = 1
	end
	skinID, team = unpack(skinTable[skinCount])
	adjSelectionSetting(team)
	setElementModel(sPed, skinID)
	updateSetting(team)
	local pDim = getElementDimension ( localPlayer ) 
	local pInt = getElementInterior ( localPlayer ) 
	setElementDimension ( sPed, 0 ) 
	setElementInterior ( sPed, 0 ) 
	setElementDimension ( localPlayer, 0 ) 
	setElementInterior ( localPlayer, 0 )
end

function sLeft()
	skinCount = skinCount - 1
	if skinCount < 1 then
		skinCount = #skinTable
	end
	skinID, team = unpack(skinTable[skinCount])
	adjSelectionSetting(team)
	setElementModel(sPed, skinID)
	updateSetting(team)
	local pDim = getElementDimension ( localPlayer ) 
	local pInt = getElementInterior ( localPlayer ) 
	setElementDimension ( sPed, 0 ) 
	setElementInterior ( sPed, 0 ) 
	setElementDimension ( localPlayer, 0 ) 
	setElementInterior ( localPlayer, 0 )
end


function sUp()
	updateSetting(team)
	if skinCount >= 0 and skinCount < 20 then
		--Medic
		skinCount = 20
	elseif skinCount < 24 and skinCount >= 20 then
		--Grove
		skinCount = 24
	elseif skinCount < 32 and skinCount >= 24 then
		--Aztecas
		skinCount = 32
	elseif skinCount < 36 and skinCount >= 32 then
		--Vagos
		skinCount = 36
	elseif skinCount < 39 and skinCount >= 36 then
		--Ballas
		skinCount = 39
	elseif skinCount < 43 and skinCount >= 39 then
		--Mafia
		skinCount = 43
	elseif skinCount < 48 and skinCount >= 43 then
		--Russians
		skinCount = 48
	elseif skinCount < 51 and skinCount >= 48 then
		--Rifa
		skinCount = 51
	elseif skinCount < 55 and skinCount >= 51 then
		--Triads
		skinCount = 55
	elseif skinCount < 59 and skinCount >= 55 then
		--Da Nang Boys
		skinCount = 59
	elseif skinCount < 62 and skinCount >= 59 then
		--No Team
		skinCount = 62
	elseif skinCount >= 62 then
		--Police
		skinCount = 1
	end
	skinID, team = unpack(skinTable[skinCount])
	adjSelectionSetting(team)
	setElementModel(sPed, skinID)
	local pDim = getElementDimension ( localPlayer ) 
	local pInt = getElementInterior ( localPlayer ) 
	setElementDimension ( sPed, 0 ) 
	setElementInterior ( sPed, 0 ) 
	setElementDimension ( localPlayer, 0 ) 
	setElementInterior ( localPlayer, 0 )
end

function sDown()
	updateSetting(team)
	if skinCount >= 0 and skinCount < 20 then
		--No Team
		skinCount = 62
	elseif skinCount < 24 and skinCount >= 20 then
		--Police
		skinCount = 1
	elseif skinCount < 32 and skinCount >= 24 then
		--Medic
		skinCount = 20
	elseif skinCount < 36 and skinCount >= 32 then
		--Grove
		skinCount = 24
	elseif skinCount < 39 and skinCount >= 36 then
		--Aztecas
		skinCount = 32
	elseif skinCount < 43 and skinCount >= 39 then
		--Vagos
		skinCount = 36
	elseif skinCount < 48 and skinCount >= 43 then
		--Ballas
		skinCount = 39
	elseif skinCount < 51 and skinCount >= 48 then
		--Mafia
		skinCount = 43
	elseif skinCount < 55 and skinCount >= 51 then
		--Russians
		skinCount = 48
	elseif skinCount < 59 and skinCount >= 55 then
		--Rifa
		skinCount = 51
	elseif skinCount < 62 and skinCount >= 59 then
		--Triads
		skinCount = 55
	elseif skinCount >= 62 then
		--Da Nang Boys
		skinCount = 59
	end
	skinID, team = unpack(skinTable[skinCount])
	adjSelectionSetting(team)
	setElementModel(sPed, skinID)
	local pDim = getElementDimension ( localPlayer ) 
	local pInt = getElementInterior ( localPlayer ) 
	setElementDimension ( sPed, 0 ) 
	setElementInterior ( sPed, 0 ) 
	setElementDimension ( localPlayer, 0 ) 
	setElementInterior ( localPlayer, 0 )
end

----
function onwasted(killer)
		setElementData(localPlayer, "Alive", false)
		setElementData(localPlayer,"New",false)
		weap = getPedWeapon(localPlayer)
		total = getPedTotalAmmo(localPlayer)
		clip = getPedAmmoInClip(localPlayer)
		if weap == 25 or weap == 33 or weap == 34 then
			if total < 5 then
				clip = total
			else
				clip = 5
			end
		end
		weap1 = getPedWeapon(localPlayer, 1)
		weap2 = getPedWeapon(localPlayer, 2)
		weap3 = getPedWeapon(localPlayer, 3)
		weap4 = getPedWeapon(localPlayer, 4)
		weap5 = getPedWeapon(localPlayer, 5)
		weap6 = getPedWeapon(localPlayer, 6)
		weap7 = getPedWeapon(localPlayer, 7)
		weap8 = getPedWeapon(localPlayer, 8)
		weap11 = getPedWeapon(localPlayer, 11)
		weap12 = getPedWeapon(localPlayer, 12)

		ammo1 = getPedTotalAmmo(localPlayer, 1)
		ammo2 = getPedTotalAmmo(localPlayer, 2)
		ammo3 = getPedTotalAmmo(localPlayer, 3)
		ammo4 = getPedTotalAmmo(localPlayer, 4)
		ammo5 = getPedTotalAmmo(localPlayer, 5)
		ammo6 = getPedTotalAmmo(localPlayer, 6)
		ammo7 = getPedTotalAmmo(localPlayer, 7)
		ammo8 = getPedTotalAmmo(localPlayer, 8)
		ammo11 = getPedTotalAmmo(localPlayer, 11)
		ammo12 = getPedTotalAmmo(localPlayer, 12)

		setElementData(localPlayer, "WP2", weap2)
		setElementData(localPlayer, "WP3", weap3)
		setElementData(localPlayer, "WP4", weap4)
		setElementData(localPlayer, "WP5", weap5)
		setElementData(localPlayer, "WP6", weap6)
		setElementData(localPlayer, "WP7", weap7)
		setElementData(localPlayer, "WP8", weap8)
		setElementData(localPlayer, "WP11", weap11)
		setElementData(localPlayer, "WP12", weap12)

		setElementData(localPlayer, "WA2", ammo2)
		setElementData(localPlayer, "WA3", ammo3)
		setElementData(localPlayer, "WA4", ammo4)
		setElementData(localPlayer, "WA5", ammo5)
		setElementData(localPlayer, "WA6", ammo6)
		setElementData(localPlayer, "WA7", ammo7)
		setElementData(localPlayer, "WA8", ammo8)
		setElementData(localPlayer, "WA11", ammo11)
		setElementData(localPlayer, "WA12", ammo12)

		if weap == weap2 then
			ammo2 = ammo2-clip
		elseif weap == weap3 then
			ammo3 = ammo3-clip
		elseif weap == weap4 then
			ammo4 = ammo4-clip
		elseif weap == weap5 then
			ammo5 = ammo5-clip
		elseif weap == weap6 then
			ammo6 = ammo6-clip
		--elseif weap == weap7 then
			--ammo7 = ammo7-clip
		elseif weap == weap8 then
			ammo8 = ammo8-clip
		elseif weap == weap11 then
			ammo11 = ammo11-clip
		elseif weap == weap12 then
			ammo12 = ammo12-clip
		end
end
addEventHandler("onClientPlayerWasted", getLocalPlayer(), onwasted)

function SCT()
	if source == localPlayer then
		setElementData(source, "Alive", true)
		setElementData(source,"ChangeSkinStats",false)
		if not getElementData(localPlayer,"New") then
		triggerServerEvent("onPS", localPlayer, localPlayer, weap1, weap2, weap3, weap4, weap5, weap6, weap7, weap8, weap11, weap12, ammo1, ammo2, ammo3, ammo4, ammo5, ammo6, ammo7, ammo8, ammo11, ammo12)
		end
	end
end
addEventHandler("onClientPlayerSpawn", localPlayer, SCT)
----

function EnterSpawn()
	if (team == "Police") then
			ctb = countPlayersInTeam(getTeamFromName("Ballas"))
			ctg = countPlayersInTeam(getTeamFromName("Grove"))
			ctv = countPlayersInTeam(getTeamFromName("Vagos"))
			cta = countPlayersInTeam(getTeamFromName("Aztecas"))
			ctp = countPlayersInTeam(getTeamFromName("Police"))
			ctm = countPlayersInTeam(getTeamFromName("Medic"))
			ctn = countPlayersInTeam(getTeamFromName("No Team"))
			--
			ctr = countPlayersInTeam(getTeamFromName("Rifa"))
			ctma = countPlayersInTeam(getTeamFromName("Mafia"))
			ctru = countPlayersInTeam(getTeamFromName("Russians"))
			cttr = countPlayersInTeam(getTeamFromName("Triads"))
			ctda = countPlayersInTeam(getTeamFromName("Da Nang Boys"))
			coal = #getElementsByType("player")
			--
			cat = (ctb+ctg+ctv+cta+ctm+ctn+ctr+ctma+ctru+cttr+ctda)/1.5
			coalp = (coal-ctp)/1.5
		local wL = getPlayerWantedLevel(localPlayer)
		local LegalStatus = getElementData(localPlayer, "Stats")
		if wL > 0 then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("لا يمكنك الانضمام للشرطة وانت مطلوب (نجوم)ـ", 255, 0, 0)
			else
				exports["guimessages"]:outputClient("You can't join police when you are wanted!", 255, 0, 0)
			end
			return
		elseif LegalStatus == 3 then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("لا يمكنك الانضمام للشرطة وانت مسجون", 255, 0, 0)
			else
				exports["guimessages"]:outputClient("You can't join police when you are jailed!", 255, 0, 0)
			end
			return
		elseif ctp > coalp and
		getElementData(localPlayer,"Account") ~= "7up" and
		not getElementData(localPlayer, "isPlayerVIP") and
		getElementData(localPlayer, "Group") ~= "[ARMY]" and
		getElementData(localPlayer, "Group") ~= "[SWAT]" then
		--getElementData(localPlayer, "Group") ~= "Special-Forces" then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هناك الكثير من الشرطة في الوقت الحالي . الرجاء الانضمام لفريق آخر", 255, 0, 0)
				exports["guimessages"]:outputClient("|VIP|بامكانية الدخول الاجباري لفريق للشرطة(VIP)يتميز كبار الشخصيات|VIP|", 255, 200, 0)
			else
				exports["guimessages"]:outputClient("There are lot of cops . please go to another Team!", 255, 0, 0)
				exports["guimessages"]:outputClient("(VIP) players Characterized by join the Police Team Compulsory", 255, 200, 0)
			end
			sUp()
			return
		elseif getElementData(localPlayer, "TBan") == 1 then 
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("انت محظور من فريق الشرطة", 255, 0, 0)
			else
				exports["guimessages"]:outputClient("You have been banned from the police team", 255, 0, 0)
			end
			return
		elseif getElementData(localPlayer, "Group") ~= "FBI" and ( skinID == 286 ) then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هذه الشخصية خاصة بأعضاء الشرطة الفدرالية فقط", 0, 0, 255)
			else
				exports["guimessages"]:outputClient("This Skin Only For FBI Members", 0, 0, 255)
			end
			return
		elseif getElementData(localPlayer, "Group") ~= "[ARMY]" and ( skinID == 287 ) then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هذه الشخصية خاصة بأعضاء الجيش فقط", 0, 0, 255)
			else
				exports["guimessages"]:outputClient("This Skin Only For ARMY Members", 0, 0, 255)
			end
			return
		elseif getElementData(localPlayer, "Group") ~= "[SWAT]" and ( skinID == 285 ) then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هذه الشخصية خاصة بأعضاء التدخل السريع فقط", 0, 0, 255)
			else
				exports["guimessages"]:outputClient("This Skin Only For SWAT Members", 0, 0, 255)
			end
			return
		elseif getElementData(localPlayer, "Group") ~= "CIA" and ( skinID == 165 ) then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هذه الشخصية خاصة بأعضاء الاستخبارات فقط", 0, 0, 255)
			else
				exports["guimessages"]:outputClient("This Skin Only For CIA Members", 0, 0, 255)
			end
			return
		elseif getElementData(localPlayer, "Group") ~= "S.A.S" and ( skinID == 166 ) then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هذه الشخصية خاصة بأعضاء الخدمات الجوية الخاصة فقط", 0, 0, 255)
			else
				exports["guimessages"]:outputClient("This Skin Only For Special Air Service Members", 0, 0, 255)
			end
			return
		else
		setElementData( localPlayer, "Occupation", "Police Officer", true )
		end
	elseif (team == "No Team") then
		if getElementData(localPlayer, "Group") ~= "[TOP]" and ( skinID == 1 ) then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هذه الشخصية خاصة بأعضاء توب فقط",255,80,80)
			else
				exports["guimessages"]:outputClient("This Skin Only For [TOP] Members", 255,80,80)
			end
			return
		elseif getElementData(localPlayer, "Group") ~= "xCode" and ( skinID == 2 ) then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هذه الشخصية خاصة بأعضاء اكس كود فقط",255,80,80)
			else
				exports["guimessages"]:outputClient("This Skin Only For xCode Members", 255,80,80)
			end
			return
		elseif getElementData(localPlayer, "Group") ~= "[W.A.O]" and ( skinID == 7 ) then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هذه الشخصية خاصة بأعضاء وي ار ون فقط",255,80,80)
			else
				exports["guimessages"]:outputClient("This Skin Only For [W.A.O] Members", 255,80,80)
			end
			return
		elseif getElementData(localPlayer, "Group") ~= "[DGH]" and ( skinID == 14 ) then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("هذه الشخصية خاصة بأعضاء دجه فقط",255,80,80)
			else
				exports["guimessages"]:outputClient("This Skin Only For [DGH] Members", 255,80,80)
			end
			return
		end
	elseif (team == "Medic") then
		setElementData( localPlayer, "Occupation", "Paramedic", true )
	elseif (team == "Grove") then
		setElementData( localPlayer, "Occupation", "Grove", true )
	elseif (team == "Vagos") then
		setElementData( localPlayer, "Occupation", "Vagos", true )
	elseif (team == "Ballas") then
		setElementData( localPlayer, "Occupation", "Ballas", true )
	elseif (team == "Aztecas") then
		setElementData( localPlayer, "Occupation", "Aztecas", true )
	elseif (team == "Mafia") then
		setElementData( localPlayer, "Occupation", "Mafia", true )
	elseif (team == "Russians") then
		setElementData( localPlayer, "Occupation", "Russians", true )
	elseif (team == "Rifa") then
		setElementData( localPlayer, "Occupation", "Rifa", true )
	elseif (team == "Da Nang Boys") then
		setElementData( localPlayer, "Occupation", "Da Nang Boys", true )
	elseif (team == "Triads") then
		setElementData( localPlayer, "Occupation", "Triads", true )
	end
	unbindKey("arrow_l", "down", sLeft)
	unbindKey("arrow_r", "down", sRight)
	unbindKey("arrow_u", "down", sUp)
	unbindKey("arrow_d", "down", sDown)
	unbindKey("enter", "down", EnterSpawn)
	removeEventHandler("onClientPreRender", root, drawTeamName)
	removeEventHandler("onClientPreRender", root, loginRender)
	destroyElement(sPed)
	triggerServerEvent("spawnMe", localPlayer, skinID, sX, sY, sZ, sR, team)
	chgTeamOnDeath = false
	if isElement(SelectSong) then
	destroyElement(SelectSong)
	end
	if isTimer(sttimer) then
	killTimer ( sttimer )
	end
	showPlayerHudComponent ( "all", true )
	setElementData(localPlayer,"ShowKillMsg",true)
	showChat ( true )
	if New then
		New = false
		triggerServerEvent("FirstSP", localPlayer)
	else
		if not getElementData(localPlayer,"ChangeSkinStats") then
		triggerServerEvent("onPS", localPlayer, localPlayer, weap1, weap2, weap3, weap4, weap5, weap6, weap7, weap8, weap11, weap12, ammo1, ammo2, ammo3, ammo4, ammo5, ammo6, ammo7, ammo8, ammo11, ammo12)
		end
	end
end

chgTeamOnDeath = false

addEventHandler("onClientPlayerWasted", localPlayer,
function()
	updateSetting(team)
	if chgTeamOnDeath then
		setElementData(localPlayer,"ChangeSkinStats",true)
		setElementDimension ( localPlayer, 0 ) 
		setElementInterior ( localPlayer, 0 )
		setTimer(function()
			triggerServerEvent("RemovePlayerFromTeam", localPlayer, localPlayer)
			setCameraMatrix(1203.63, -1663.87, 14.5, 1202.634, -1663.953, 14.43)
			showCursor(false)
			if not isElement(sPed) then
				sPed = createPed(105, 1199.158, -1664, 13.687)
				local pDim = getElementDimension ( localPlayer ) 
				local pInt = getElementInterior ( localPlayer ) 
				setElementDimension ( sPed, pDim ) 
				setElementInterior ( sPed, pInt )
			end
			local radioURL = "http://cdn.top4top.net/d_535afed2b31.mp3"
			SelectSong = playSound(radioURL, true)
			sRight()
			updateSetting(team)
			bindKey("arrow_l", "down", sLeft)
			bindKey("arrow_r", "down", sRight)
			bindKey("arrow_u", "down", sUp)
			bindKey("arrow_d", "down", sDown)
			bindKey("enter", "down", EnterSpawn)
			addEventHandler("onClientPreRender", root, drawTeamName)
			addEventHandler("onClientPreRender", root, loginRender)
		end, 5000, 1)
	else
	setTimer(function()
		triggerServerEvent("spawnMe", localPlayer, skinID, sX, sY, sZ, sR, team)
	end, 5000, 1)
	end
end)

bindKey("F4", "down",
function()
	if not chgTeamOnDeath then
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("يمكنك تغيير الفريق والشخصية عند الموت", 0, 255, 0)
			else
				exports["guimessages"]:outputClient("You will be able to change your team and skin when you die.", 0, 255, 0)
			end
		chgTeamOnDeath = true
	else
			if getElementData(localPlayer,"Language") == 1 then
				exports["guimessages"]:outputClient("تم إلغاء تغيير الفريق والشخصية عند الموت", 255, 255, 0)
			else
				exports["guimessages"]:outputClient("Changing team and skin cancelled.", 255, 255, 0)
			end
		chgTeamOnDeath = false
	end
end)


local x, y = guiGetScreenSize()

function drawTeamName()
	setElementPosition(localPlayer, 0, 0, 0)
	if sPed and team then
		local teamElement = getTeamFromName(team)
		if teamElement then
			local r, g, b = getTeamColor(teamElement)
			local x, y, z = getPedBonePosition(sPed, 4)
			--local sx, sy = getScreenFromWorldPosition(x, y, z+0.5)
			local sx, sy = guiGetScreenSize()
			if sx and sy then
				dxDrawText(team, sx/2 + 1, sy/8 + 1, sx/2 + 1, sy/8 + 1, tocolor(0, 0, 0, 255), 2, "pricedown", "center")
				dxDrawText(team, sx/2 + 1, sy/8 - 1, sx/2 - 1, sy/8 + 1, tocolor(0, 0, 0, 255), 2, "pricedown", "center")
				dxDrawText(team, sx/2 - 1, sy/8 - 1, sx/2 - 1, sy/8 - 1, tocolor(0, 0, 0, 255), 2, "pricedown", "center")
				dxDrawText(team, sx/2, sy/8, sx/2, sy/8, tocolor(r, g, b, 255), 2, "pricedown", "center")

dxDrawText("["..countPlayersInTeam(teamElement).."] Players", sx/2 + 1, sy/4 + 1, sx/2 + 1, sy/4 + 1, tocolor(0, 0, 0, 255), 1, "bankgothic", "center")
dxDrawText("["..countPlayersInTeam(teamElement).."] Players", sx/2    , sy/4    , sx/2    , sy/4    , tocolor(r, g, b, 255), 1, "bankgothic", "center")

dxDrawText("Press [Up] or [Down] to Change The Team", sx/24 + 1, sy/2.8 + 1, sx/2 + 1, sy/3.5 + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left")
dxDrawText("Press [Up] or [Down] to Change The Team", sx/24    , sy/2.8    , sx/2    , sy/3.5    , tocolor(r, g, b, 255), 1, "default-bold", "left")

dxDrawText("Press [Left] or [Right] to Change The Skin", sx/24 + 1, sy/2.45 + 1, sx/2 + 1, sy/3.5 + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left")
dxDrawText("Press [Left] or [Right] to Change The Skin", sx/24    , sy/2.45    , sx/2    , sy/3.5    , tocolor(r, g, b, 255), 1, "default-bold", "left")

dxDrawText("Press [Enter] to select The Skin", sx/24 + 1, sy/2.2 + 1, sx/2 + 1, sy/3 + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left")
dxDrawText("Press [Enter] to select The Skin", sx/24    , sy/2.2    , sx/2    , sy/3    , tocolor(r, g, b, 255), 1, "default-bold", "left")
			end
		end
	end
end
-----------------------------------|Medic|-----------------------------------
--[[addEventHandler("onClientPlayerDamage", localPlayer,
function(healer, weapon)
    if healer and getElementType(healer) == "player" then
		local team = getPlayerTeam(healer)
		local teamName = team and getTeamName(team) or false
		local Health = getElementHealth(source)
        if (teamName == "Medic") and (weapon == 41) then
            cancelEvent()
			if (Health < 99) then
				triggerServerEvent("healP", localPlayer, healer)
			end
        end
    end
end)]]
-----------------------------------|Medic|-----------------------------------

vehicles = {596,598,597,523,599,427}

local screX, screY = guiGetScreenSize()
window = guiCreateWindow(screX / 2 - 100, screY / 2 - 150, 200, 350, "Selecting Vehicles Menu", false)
guiSetVisible(window, false)
guiWindowSetSizable(window, false)
local list = guiCreateGridList(0, 0.07, 1, 0.66, true, window)
local column = guiGridListAddColumn(list, "vehicle", 0.9)
local selectB = guiCreateButton(0.05, 0.75, 1, 0.1, "Select!", true, window)
local closeB = guiCreateButton(0.05, 0.86, 1, 0.1, "Close", true, window)

function onWaste()
     guiSetVisible(window, false)
     showCursor(false)
setTimer(setElementFrozen,50,1,player,false)
end
--@--addEventHandler("onClientPlayerWasted", getLocalPlayer(), onWaste)
addEventHandler("onClientGUIClick", closeB, onWaste, false)

for i,car in ipairs(vehicles) do
	local row = guiGridListAddRow(list)
	guiGridListSetItemText(list, row, column, getVehicleNameFromModel(tonumber(car)), false, false)
end

if getPlayerTeam(player) == getTeamFromName("Police") then
	M1 = createMarker(1560, -1608.38, 12.4, "cylinder", 1.5, 0, 0, 255, 150)
	M2 = createMarker(1572, -1608.38, 12.4, "cylinder", 1.5, 0, 0, 255, 150)
	M3 = createMarker(1587.5, -1608.38, 12.4, "cylinder", 1.5, 0, 0, 255, 150)
	M4 = createMarker(1587.11, -1710.39, 5, "cylinder", 1.5, 0, 0, 255, 150)
	M5 = createMarker(1564.03, -1711.77, 5, "cylinder", 1.5, 0, 0, 255, 150)
end

function createTheChoosenCar()
	local row = guiGridListGetSelectedItem(list)
	if row and row >= 0 then
		guiSetVisible(window, false)
		setTimer(setElementFrozen,50,1,player,false)
		showCursor(false)
		triggerServerEvent("onCreatePoliceCar", player, guiGridListGetItemText(list, row, column))
	end
end
addEventHandler("onClientGUIClick", selectB, createTheChoosenCar, false)
addEventHandler("onClientGUIDoubleClick", list, createTheChoosenCar, false)

addEventHandler("onClientElementDataChange",root,
function(dataName,old)
	if getElementType(source) == "player" and source == player and dataName == "Alive" then
		setTimer(function(source)
			if getElementData(source,"Alive") == true and old == false then
				if getPlayerTeam(source) and getPlayerTeam(source) == getTeamFromName("Police") then
					if isElement(M1) then destroyElement(M1) end
					if isElement(M2) then destroyElement(M2) end
                    if isElement(M3) then destroyElement(M3) end
                    if isElement(M4) then destroyElement(M4) end
                    if isElement(M5) then destroyElement(M5) end
                    M1 = createMarker(1560, -1608.38, 12.4, "cylinder", 1.5, 0, 0, 255, 150)
                    M2 = createMarker(1572, -1608.38, 12.4, "cylinder", 1.5, 0, 0, 255, 150)
                    M3 = createMarker(1587.5, -1608.38, 12.4, "cylinder", 1.5, 0, 0, 255, 150)
                    M4 = createMarker(1587.11, -1711, 5, "cylinder", 1.5, 0, 0, 255, 150)
                    M5 = createMarker(1564.03, -1711, 5, "cylinder", 1.5, 0, 0, 255, 150)
				else
					if isElement(M1) then destroyElement(M1) end
                    if isElement(M2) then destroyElement(M2) end
                    if isElement(M3) then destroyElement(M3) end
                    if isElement(M4) then destroyElement(M4) end
                    if isElement(M5) then destroyElement(M5) end
				end
			end
		end,1000,1,source)
     end
end)

addEventHandler("onClientMarkerHit", root,
function(pp)
	if getElementType(pp) ~= "player" or pp ~= player or isPedInVehicle(pp) or getPlayerTeam(pp) ~= getTeamFromName("Police") then return end
	if source == M1 or source == M2 or source == M3 or source == M4 or source == M5 then
		if isOnTheHeightRange(pp, source) then
		setTimer(function(pp,source) local x, y, z = getElementPosition(source) local xx, yy, zz = getElementPosition(pp) setElementPosition(pp, xx, yy, z+0.5) setElementFrozen(player,true) end,150,1,pp,source)
			guiSetVisible(window, true)
			showCursor(true)
		end
	end
end)

-- Cancel Heli Damge
function cancelDeath()
	cancelEvent()
end
addEventHandler("onClientPlayerHeliKilled", getLocalPlayer(), cancelDeath)

-- Cant Use Grnade inside the bulding !

addEventHandler("onClientPreRender", root,
function()
	if getElementInterior(localPlayer) ~= 0 then
		local wp = getPedWeapon(localPlayer)
		if wp == 16 or wp == 17 or wp == 39 then
			if isControlEnabled("fire") then
				toggleControl("fire", false)
				stat = 0
			end
		elseif wp ~= 16 and wp ~= 17 and wp ~= 39 then
			if not isControlEnabled("fire") and stat == 0 then
				toggleControl("fire", true)
				stat = 1
			end
		end
	end
end)

function ClientExplosionFunction()
 if getElementInterior(source) ~= 0  then
  cancelEvent ()
 end
end
addEventHandler("onClientExplosion", root, ClientExplosionFunction)

-- ADD HEAL PLAYERS !

waitTimer = {}

addEventHandler("onClientPlayerDamage", root,
function(attacker, weapon)
	if attacker and getElementType(attacker) == "player" and attacker ~= source then
		local Model = getElementModel(attacker)
		local Team = getPlayerTeam(attacker)
		if Team and (getTeamName(Team) == "Medic") and (weapon == 41) and (Model > 273 and Model < 277) then
			cancelEvent()
			if not isTimer(waitTimer[source]) then
				triggerServerEvent("healPlayer", attacker, source, attacker)
				waitTimer[source] = setTimer(function(p) waitTimer[p] = nil end, 1500, 1, source)
			end
		end
	end
end)

function isOnTheHeightRange(player, marker)
	local _, _, Pz = getElementPosition(player)
	local _, _, Mz = getElementPosition(marker)
	if Mz + 5 >= Pz then
		return true
	end
end

-- HOLSTEN (TAPL = -_-""")
---- Vehicles Spawner

local x, y, z, r
local MarkersTable = {}
local vehicles = {413, 422, 462}
local MarkersPosition = {
	[1] = {1679, -2327.5, 12.5, 0}, -- LS AIR PORT
	[2] = {-1385, -355, 13, 100}, -- SF AIR PORT
	[3] = {1711, 1517, 9.7, 180}, -- LV AIR PORT
	[4] = {2499, -1651.32 ,12.53, 175}, -- GROVE STREET
	[5] = {1359, -1754, 12.4, 0}, -- POLICE LS
	[6] = {2216.80591, -1314.92834, 22.98438, 270}, -- BALLAS
	[7] = {2292.79, -1115.81 ,36.98, 90}, -- Vagus
	[8] = {1803.1, -1933.42 ,12.39, 0}, -- Azetcas
	[9] = {1182.8, -1315 ,12.64, 270}, -- LS ASG Hospital
	[10] = {2007.22, -1440.68 ,12.56, 130}, -- LS HOSPITAL
	[11] = {2680.76, -1697.33 ,8.41, 55}, -- WWE
	[12] = {1194.19, -1756.06 ,12.58, 90}, -- NO TEAM
	[13] = {1144.47, -1465.78 ,14.79, 0}, -- NO TEAM
	[14] = {1535.13, -1476.71 ,8.5, 0}, -- NO TEAM
	[15] = {2489.13, -1953.85, 12.42, 0}, -- NO TEAM
	[16] = {1427.47, -1056.45, 22.16, 0}, -- NO TEAM
	[17] = {1974.27, -1278.81, 22.82, 0}, -- NO TEAM
	[18] = {1946.59, -1362.73, 17.58, 90}, -- NO TEAM
	[19] = {-1861.45, 595.74, 34.17, 0}, -- BANK
	[20] = {-2136.47, -78.1, 34.32, 0}, -- WAREHOUSE
	[21] = {333.81, -1519.94, 34.87, 319}, -- Club
	[22] = {1771.77, -1344.41, 14.76, 177}, -- NO TEAM
	[23] = {1722.63, -1609.57, 12.55 , 1}, -- NO TEAM
	[24] = {-2022.86, 155.56, 27.83594 , 0}, -- RIFA
	[25] = {-2175.38, 704.29, 52.89063 , 180}, -- Triads
	[26] = {-2107.17, 903.50, 75.48021 , 360}, -- Da Nang
	[27] = {-2621.01, 1379.10, 6.14884 , 180}, -- Mafia
	[28] = {-1704.59, 1339.44, 6.18072 , 136}, -- Russians
	[29] = {1624, 1820, 9.7, 0}, -- LV HOSPITAL
}


local Window_CarsForCr = guiCreateWindow(screX/2 - 100, screY/2 - 150, 200, 350, "Selecting Vehicles Menu", false)
guiSetVisible(Window_CarsForCr, false)
guiWindowSetSizable(Window_CarsForCr, false)
local list_Cars = guiCreateGridList(0, 0.07, 1, 0.66, true, Window_CarsForCr)
local column_cars = guiGridListAddColumn(list_Cars, "vehicle", 0.9)
local selectBB = guiCreateButton(0.05, 0.75, 1, 0.1, "Select!", true, Window_CarsForCr)
local closeBBB = guiCreateButton(0.05, 0.86, 1, 0.1, "Close", true, Window_CarsForCr)

local list_Medic = guiCreateGridList(0, 0.07, 1, 0.66, true, Window_CarsForCr)
guiSetVisible(list_Medic, false)
local column_Medic = guiGridListAddColumn(list_Medic, "vehicle", 0.9)
guiGridListSetItemText(list_Medic, guiGridListAddRow(list_Medic), column_Medic, "Ambulance", false, false)

local medic1 = createMarker(1177, -1308, 12.95, "cylinder", 2, 0, 255, 255, 100)
local medic2 = createMarker(1177, -1338.5, 12.95, "cylinder", 2, 0, 255, 255, 100)

function onWaste()
	guiSetVisible(Window_CarsForCr, false)
	showCursor(false)
	setTimer(setElementFrozen, 50, 1, player, false)
end
addEventHandler("onClientPlayerWasted", player, onWaste)
addEventHandler("onClientGUIClick", closeBBB, onWaste, false)

for _,car in ipairs(vehicles) do
	local row = guiGridListAddRow(list_Cars)
	guiGridListSetItemText(list_Cars, row, column_cars, getVehicleNameFromModel(tonumber(car)), false, false)
end

for _, Pos in ipairs(MarkersPosition) do
	local marker = createMarker(Pos[1], Pos[2], Pos[3], "cylinder", 2, 200, 200, 200, 100)
	setElementID(marker, tostring(Pos[4]))
	MarkersTable[marker] = true
end

function createTheChoosenCarr()
	if not guiGetVisible(list_Cars) then return end
	local row = guiGridListGetSelectedItem(list_Cars)
	if row and row >= 0 then
		guiSetVisible(Window_CarsForCr, false)
		setTimer(setElementFrozen,50,1,player,false)
		showCursor(false)
		triggerServerEvent("onSpawnVehicle", player, guiGridListGetItemText(list_Cars, row, column_cars), x, y, z, r)
	end
end
addEventHandler("onClientGUIClick", selectBB, createTheChoosenCarr, false)
addEventHandler("onClientGUIDoubleClick", list_Cars, createTheChoosenCarr, false)

function createTheChoosenCarrm()
	if not guiGetVisible(list_Medic) then return end
	local row = guiGridListGetSelectedItem(list_Medic)
	if row and row >= 0 then
		guiSetVisible(Window_CarsForCr, false)
		setTimer(setElementFrozen,50,1,player,false)
		showCursor(false)
		triggerServerEvent("onSpawnVehicle", player, guiGridListGetItemText(list_Medic, row, column_Medic), x, y, z, 270)
	end
end
addEventHandler("onClientGUIClick", selectBB, createTheChoosenCarrm, false)
addEventHandler("onClientGUIDoubleClick", list_Medic, createTheChoosenCarrm, false)

addEventHandler("onClientMarkerHit", resourceRoot,
function(pp)
	if getElementType(pp) ~= "player" or pp ~= player or isPedInVehicle(pp) then return end
	if MarkersTable[source] and isOnTheHeightRange(pp, source) and getElementData(pp, "Stats") < 2 then
		guiSetVisible(list_Cars, true)
		guiSetVisible(list_Medic, false)
		setTimer(function(pp,source)
			x, y, z = getElementPosition(source)
			r = getElementID(source)
			local xx, yy, zz = getElementPosition(pp)
			setElementPosition(pp, xx, yy, z+0.5)
			setElementFrozen(player,true)
		end, 150, 1, pp, source)
		guiSetVisible(Window_CarsForCr, true)
		showCursor(true)
	end
end)

addEventHandler("onClientMarkerHit", resourceRoot,
function(pp)
	if getElementType(pp) ~= "player" or pp ~= player or isPedInVehicle(pp) then return end
	if source == medic1 or source == medic2 then
		if isOnTheHeightRange(pp, source) and getElementData(pp, "Stats") < 2 and getPlayerTeam(pp) == getTeamFromName("Medic") then
			guiSetVisible(list_Cars, false)
			guiSetVisible(list_Medic, true)
			setTimer(function(pp,source)
				x, y, z = getElementPosition(source)
				r = getElementID(source)
				local xx, yy, zz = getElementPosition(pp)
				setElementPosition(pp, xx, yy, z+0.5)
				setElementFrozen(player,true)
			end, 150, 1, pp, source)
			guiSetVisible(Window_CarsForCr, true)
			showCursor(true)
		end
	end
end)

addEventHandler("onClientMarkerLeave", resourceRoot,
function(pp)
	if getElementType(pp) ~= "player" or pp ~= player or isPedInVehicle(pp) then return end
	if MarkersTable[source] or source == medic1 or source == medic2 then
		guiSetVisible(Window_CarsForCr, false)
		setTimer(setElementFrozen,250,1,player,false)
		setElementFrozen(player,false)
		showCursor(false)
	end
end)

addEvent("Tcheckntf", true)
function checkntf(c, e, s, t, p)
	if p == player then
		if ntf then
			removeEventHandler("onClientRender", getRootElement(), notification)
			destroyElement(ntf)
			destroyElement(ntfe)
			destroyElement(ntft)
			ntf = false
			ntfe = false
			ntft = false
			if dntf then
				killTimer(dntf)
				dntf = false
			end
		end
		notification(c, e, s, t)
	end
end

 

Link to comment

سطر 418 , ماهو 
CCCZXXX
أنت مو معرفه .

سطر 419 , إنت حاط احداثيات لإلمنت انت مو معرفه وهو
CCCZXXX
سطر 1315 , إنت مو معرف بلاير 
سطر 1135 
انت مو معرف بلاير ايضاً

Link to comment
6 hours ago, AbU - W6N said:

سطر 418 , ماهو 
CCCZXXX
أنت مو معرفه .

سطر 419 , إنت حاط احداثيات لإلمنت انت مو معرفه وهو
CCCZXXX
سطر 1315 , إنت مو معرف بلاير 
سطر 1135 
انت مو معرف بلاير ايضاً

اعرفهم ع بعض

Link to comment
  • 2 weeks later...
On ٢٠‏/٥‏/٢٠١٨ at 01:49, AbU - W6N said:

سطر 418 , ماهو 
CCCZXXX
أنت مو معرفه .

سطر 419 , إنت حاط احداثيات لإلمنت انت مو معرفه وهو
CCCZXXX
سطر 1315 , إنت مو معرف بلاير 
سطر 1135 
انت مو معرف بلاير ايضاً

كيف اعرفها

Link to comment
On ٣٠‏/٥‏/٢٠١٨ at 08:55, GTA San said:

كيف اعرفها

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

  • Thanks 2
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...