kamel10 Posted July 26, 2014 Share Posted July 26, 2014 ذا كود جبته من زاحف local Url = "crown.png" --- اسسم الصورة هنا local zUP = 16 ---- ارتفأع الصورة addEventHandler( "onClientRender", root, function ( ) local x, y, z = getElementPosition( localplayer ) local Mx, My, Mz = getCameraMatrix( ) local accName = getAccountName ( getPlayerAccount ( localplayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "V.I.P" ) ) then if ( getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz ) <= 15 ) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition( x, y, z + zUP, 0.07 ) if ( WorldPositionX and WorldPositionY ) then dxDrawImage( WorldPositionX, WorldPositionY, WorldPositionX, WorldPositionY, Url ) end end end end ) Link to comment
kamel10 Posted July 26, 2014 Author Share Posted July 26, 2014 ض الكود كلنت ولا سيرفر لما اشغله ما يصيرشيئ Link to comment
#DRAGON!FIRE Posted July 26, 2014 Share Posted July 26, 2014 (edited) ... وهذا فنكشن بجانب سيرفر isObjectInACLGroup انت مستخدم هذي طريقة عشان الصورة تكون لقروب محدد .. Client Side ! local Url = "crown.png" --- اسسم الصورة هنا local zUP = 10 ---- ارتفأع الصورة addEventHandler( "onClientRender", root, function ( ) if ( getElementData ( localPlayer, "VIPData" ) == true ) then local x, y, z = getElementPosition( localPlayer ) local Mx, My, Mz = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz ) <= 15 ) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition( x, y, z + zUP, 0.07 ) if ( WorldPositionX and WorldPositionY ) then dxDrawImage( WorldPositionX, WorldPositionY, WorldPositionX, WorldPositionY, Url ) end end end end ) Server Side ! addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _,players in ipairs ( getElementsByType ( "player" ) ) do if ( getPlayerAccount( players ) and not isGuestAccount( getPlayerAccount( players ) ) ) then if ( isObjectInACLGroup ( "user."..getAccountName ( getPlayerAccount ( players ) ), aclGetGroup ( "V.I.P" ) ) ) then setElementData ( players, "VIPData", true ) end end end end ) addEventHandler ( "onPlayerLogin", root, function ( _,acc ) if ( isObjectInACLGroup ( "user."..getAccountName( acc ), aclGetGroup ( "V.I.P" ) ) ) then setElementData ( source, "VIPData", true ) end end ) Edited August 12, 2014 by Guest Link to comment
kamel10 Posted July 26, 2014 Author Share Posted July 26, 2014 اها مشكووور زاحف وجاري التجريب Link to comment
K1NG Posted July 27, 2014 Share Posted July 27, 2014 ... وهذا فنكشن بجانب سيرفر isObjectInACLGroup انت مستخدم هذي طريقة عشان الصورة تكون لقروب محدد .. Client Side ! local Url = "crown.png" --- اسسم الصورة هنا local zUP = 10 ---- ارتفأع الصورة addEventHandler( "onClientRender", root, function ( ) if ( getElementData ( localPlayer, "VIPData" ) and getElementData ( localPlayer, "VIPData" ) == true ) then local x, y, z = getElementPosition( localPlayer ) local Mx, My, Mz = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz ) <= 15 ) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition( x, y, z + zUP, 0.07 ) if ( WorldPositionX and WorldPositionY ) then dxDrawImage( WorldPositionX, WorldPositionY, WorldPositionX, WorldPositionY, Url ) end end end end ) Server Side ! addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _,players in ipairs ( getElementsByType ( "player" ) ) do if ( isObjectInACLGroup ( "user."..getAccountName ( getPlayerAccount ( players ) ), aclGetGroup ( "V.I.P" ) ) ) then setElementData ( players, "VIPData", true ) end end end ) addEventHandler ( "onPlayerLogin", root, function ( _,acc ) if ( isObjectInACLGroup ( "user."..getAccountName( acc ), aclGetGroup ( "V.I.P" ) ) ) then setElementData ( source, "VIPData", true ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) setElementData ( source, "VIPData", false ) end ) ليه ضايف بجانب سيرفر حدث عند دخول اللاعب وبعدها توخر الداتا منه؟ مايحتاج تضيف هالحدث بالأساس؛ لأنه اللاعب لما يخرج من السيرفر كل الداتا المخزنة عليه راح تنحذف onResourceStart ناقصك تتحقق من أن اللاعب مسجل دخوله بحسابه قبل أن تحقق من القروب الي هو فيه بحدث + isGuestAccount من خلال وظيفة ^ عندك تحقق زايد بجانب الكلاينت حق الداتا في سطر 5 ( الشرط الثاني )ـ + Link to comment
#DRAGON!FIRE Posted July 27, 2014 Share Posted July 27, 2014 مشكور نسيت التحققات ذي تم التعديل .. بالنسبة للـداتا فـ ما ياثر لو شلتها او خليتها .. بس ذي طريقتي . Link to comment
kamel10 Posted July 27, 2014 Author Share Posted July 27, 2014 اشتغل 100/100 جزاك الله خيرا Link to comment
#DRAGON!FIRE Posted July 27, 2014 Share Posted July 27, 2014 امين وياك .. فـ الخدمة . Link to comment
K1NG Posted July 27, 2014 Share Posted July 27, 2014 .. بالنسبة للـداتا فـ ما ياثر لو شلتها او خليتها .. بس ذي طريقتي . وش دخل طريقتي وطريقتك؟ + حق السيرفر (CPU) مين قالك انه ما راح يأثر؟ الداتا لو ماكان فيه داعي انك تستخدمها لاتستخدمها .. لأنها تستهلك من وحدة المعالجة المركزية network traffic بالإضافة إلى أنها تنتج الكثير من الـ :لاحظ الويكي وش يقولك This function stores element data under a certain key, attached to an element. Element data set using this is then synced with all clients and the server. The data can contain server created elements, but you should avoid passing data that is not able to be synced such as xmlnodes, acls, aclgroups etc.As element data is synced to all clients, it can generate a lot of network traffic and consume server CPU. Events are much more efficient for sending data from a client to the server only, or from the server to a specific client. Link to comment
#DRAGON!FIRE Posted July 27, 2014 Share Posted July 27, 2014 %100 كلأمك صحيح .. ... CPU المفروض ما كنت استخدمها يوم يخش اللاعب ع العموم كذا او كذا بتشتغل بس زي ما قلت تاخذ من الـ Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now