mr.ekoo Posted June 4, 2013 Posted June 4, 2013 السلام عليكم انا ابغي اسوي بوابة ماتفتح الا لسريالات معينة كودي gateeKoO = createObject ( 980, 1, 2, 3, 0, 0, 90) checkGateekooMarker = createMarker ( 1, 2, 3, "corona", 20.0, 0, 0, 255, 0 ) function gate ( player ) if isElementWithinMarker ( player, checkGateekooMarker ) then list1 = { [ 'Accout Name' ] = 'serial here', } local serial = list1[getAccountName(theCurrentAccount)] if serial ~= getPlayerSerial ( source ) then else if open == false then playSoundFrontEnd ( source, 16 ) moveObject ( gateeKoO, 2000, 1, 2, 3, 0, 270, 0 ) open = true else playSoundFrontEnd ( source, 16 ) moveObject ( gateeKoO, 2000, 1, 2, 6, 0, 0, 90 ) open = false end end end end المشكلة هي ان الاكواد سيرفر بس كود getPlayerSerial كلاينكت وش الحل ؟؟
PaiN^ Posted June 4, 2013 Posted June 4, 2013 مو كلاينت بس getPlayerSerial سيرفر + كلاينت + كودك ما أظن راح يشتغل " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
mr.ekoo Posted June 4, 2013 Author Posted June 4, 2013 (edited) انا ماطرحت الكود كامل بس اخوي مو شغال يوم كتبت debugscript 3 يجيب لي اخطاء في سطر ال فيه كود getPlayerSerial الكود كله addEventHandler ( "onResourceStart", resourceRoot, function ( ) gateeKoO = createObject ( 980, x, y, z, 0, 0, 90) checkGateekooMarker = createMarker ( x, y, z, "corona", 20.0, 0, 0, 255, 0 ) for _, player in ipairs ( getElementsByType ( "player" ) ) do bindTheKeys ( player ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindTheKeys ( source ) end ) function bindTheKeys ( player ) bindKey ( player, "Tab", "down", gateCheckingser ) end open = false function gateCheckingser ( player ) if isElementWithinMarker ( player, checkGateekooMarker ) then list1 = { [ 'Accout Name' ] = 'serial here', } local serial = list1[getAccountName(theCurrentAccount)] if serial ~= getPlayerSerial ( source ) then else if open == false then playSoundFrontEnd ( source, 16 ) moveObject ( gateeKoO, 2000, x, y, z, 0, 270, 0 ) open = true else playSoundFrontEnd ( source, 16 ) moveObject ( gateeKoO, 2000, x, y, z, 0, 0, 90 ) open = false end end end end Edited June 4, 2013 by Guest
PaiN^ Posted June 4, 2013 Posted June 4, 2013 كودك فيه أخطاء كثييير إنت ايش تبغى تسوي ؟ " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
PaiN^ Posted June 4, 2013 Posted June 4, 2013 جرب : mySerial = 'سيريالك هنا' gateeKoO = createObject( 980, x, y, z, 0, 0, 90 ); checkGateekooMarker = createMarker( x, y, z, "corona", 20.0, 0, 0, 255, 0 ); open = false; function move( source ) if not open then playSoundFrontEnd( source, 16 ); moveObject( gateeKoO, 2000, x, y, z, 0, 270, 0 ); else playSoundFrontEnd( source, 16 ); moveObject( gateeKoO, 2000, x, y, z, 0, 0, 90 ); end open = not open end addEventHandler( 'onResourceStart', getRootElement( ), function( ) for k,v in ipairs( getElementsByType( 'player' ) ) do if getPlayerSerial( v ) == mySerial then bindKey( v, key, 'down', move, v ); end end end ); addEventHandler( 'onPlayerJoin', getRootElement( ), function( ) if getPlayerSerial( source ) == mySerial then bindKey( source, key, 'down', move, source ); end end ); " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
فاّرس Posted June 4, 2013 Posted June 4, 2013 فوق يقول سريالات محدده وبعدين يقول لسريال محدد, اذا تبيه لاكثر من سريال سوي جدول, Serials = { [1] = {"Serial"}, [2] = {"Serial2"} } Sha67 سابقاً
кιηg-αвα∂у Posted June 4, 2013 Posted June 4, 2013 ListSerial = { [1] = { 'serial' }, [2] = { 'serial' }, [3] = { 'serial' }, [4] = { 'serial' } } bind = function( element ) bindKey( element,'tab','down' openORclose ) end addEventHandler('onPlayerJoin', root, function() for i,list in ipairs ( ListSerial ) do if ( getPlayerSerial( source ) == list ) then bind( source ) end end end ) addEventHandler('onResourceStart', resourceRoot, function() for i,list in ipairs ( ListSerial ) do for i,v in ipairs ( getElementsByType( 'player' ) ) do if ( getPlayerSerial( v ) == list ) then bind( v ) end end end end ) ob = createObject( id, x, y, z, rx, ry, rz ) ma = createMarker( x, y, z, "cylinder", size, r, g, b, alpha ) isOben = false openORclose = function() if isOben == false and isElementWithinMarker( source, ma ) then moveObject( ob, 1000, x, y, z ) playSoundFrontEnd( source, 16 ) isOben = true elseif isOben == true and isElementWithinMarker( source, ma ) then moveObject( ob, 1000, x, y, z ) playSoundFrontEnd( source, 16 ) isOben = false end end
PaiN^ Posted June 4, 2013 Posted June 4, 2013 ListSerial = { [1] = { 'serial' }, [2] = { 'serial' }, [3] = { 'serial' }, [4] = { 'serial' } } bind = function( element ) bindKey( element,'tab','down' openORclose ) end addEventHandler('onPlayerJoin', root, function() for i,list in ipairs ( ListSerial ) do if ( getPlayerSerial( source ) == list ) then bind( source ) end end end ) addEventHandler('onResourceStart', resourceRoot, function() for i,list in ipairs ( ListSerial ) do for i,v in ipairs ( getElementsByType( 'player' ) ) do if ( getPlayerSerial( v ) == list ) then bind( v ) end end end end ) ob = createObject( id, x, y, z, rx, ry, rz ) ma = createMarker( x, y, z, "cylinder", size, r, g, b, alpha ) isOben = false openORclose = function() if isOben == false and isElementWithinMarker( source, ma ) then moveObject( ob, 1000, x, y, z ) playSoundFrontEnd( source, 16 ) isOben = true elseif isOben == true and isElementWithinMarker( source, ma ) then moveObject( ob, 1000, x, y, z ) playSoundFrontEnd( source, 16 ) isOben = false end end pairs استخدم + القيمة مولازم تكون جدول, دامها شي واحد بس " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
кιηg-αвα∂у Posted June 4, 2013 Posted June 4, 2013 ListSerial = { [1] = { 'serial' }, [2] = { 'serial' }, [3] = { 'serial' }, [4] = { 'serial' } } bind = function( element ) bindKey( element,'tab','down' openORclose ) end addEventHandler('onPlayerJoin', root, function() for i,list in ipairs ( ListSerial ) do if ( getPlayerSerial( source ) == list ) then bind( source ) end end end ) addEventHandler('onResourceStart', resourceRoot, function() for i,list in ipairs ( ListSerial ) do for i,v in ipairs ( getElementsByType( 'player' ) ) do if ( getPlayerSerial( v ) == list ) then bind( v ) end end end end ) ob = createObject( id, x, y, z, rx, ry, rz ) ma = createMarker( x, y, z, "cylinder", size, r, g, b, alpha ) isOben = false openORclose = function() if isOben == false and isElementWithinMarker( source, ma ) then moveObject( ob, 1000, x, y, z ) playSoundFrontEnd( source, 16 ) isOben = true elseif isOben == true and isElementWithinMarker( source, ma ) then moveObject( ob, 1000, x, y, z ) playSoundFrontEnd( source, 16 ) isOben = false end end pairs استخدم + القيمة مولازم تكون جدول, دامها شي واحد بس انا ابغي اسوي بوابة ماتفتح الا لسريالات معينة
PaiN^ Posted June 4, 2013 Posted June 4, 2013 لوول قصدي كذا ListSerial = { [1] = 'serial', [2] = 'serial', [3] = 'serial', [4] = 'serial' } -- or ListSerial = { 'serial', 'serial', 'serial', 'serial', 'serial' } " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
iPrestege Posted June 6, 2013 Posted June 6, 2013 الصراحة انا انصدمت مدري وش الهرجة ممكن توضح وش تبآ ؟
mr.ekoo Posted June 6, 2013 Author Posted June 6, 2013 اخوي شوف انا مسوي بوابة وجدول وابغي البوابة ماتفتح الا لسريالي انا وكم واحد سويت هالكود وماشتغل addEventHandler ( "onResourceStart", resourceRoot, function ( ) gateeKoO = createObject ( 980, x, y, z, 0, 0, 90) checkGateekooMarker = createMarker ( x, y, z, "corona", 20.0, 0, 0, 255, 0 ) for _, player in ipairs ( getElementsByType ( "player" ) ) do bindTheKeys ( player ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindTheKeys ( source ) end ) function bindTheKeys ( player ) bindKey ( player, "Tab", "down", gateCheckingser ) end open = false function gateCheckingser ( player ) if isElementWithinMarker ( player, checkGateekooMarker ) then list1 = { [ 'Accout Name' ] = 'serial here', } local serial = list1[getAccountName(theCurrentAccount)] if serial ~= getPlayerSerial ( source ) then else if open == false then playSoundFrontEnd ( source, 16 ) moveObject ( gateeKoO, 2000, x, y, z, 0, 270, 0 ) open = true else playSoundFrontEnd ( source, 16 ) moveObject ( gateeKoO, 2000, x, y, z, 0, 0, 90 ) open = false end end end end وجربت كود KING-ABADY وماشتغل ؟؟ كود عبادي فيه خطاء وهو bindKey( element,'tab','down' openORclose ) مفروض bindKey( element,'tab','down',openORclose ) و مسوي openORclose = function() مفروض function openORclose() مادري اذا عادي نخليهم مثل كود عبادي او لا بس انا سويتهم وللحين مو شغال
iPrestege Posted June 6, 2013 Posted June 6, 2013 -- # Server Side : local g_Gate = createObject( 980,x,y,z ) local g_Marker = createMarker( x,y,z, "corona", 20.0, 0, 0, 255, 0 ) local g_isOpen = nil local g_Serials = { ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, } function MoveGate( ) if not g_isOpen then moveObject( g_Gate, 2000, x,y,z ) -- هنا يوم تتحرك من مكانها الاصلي لـ اللي تبية else moveObject( g_Gate, 2000,x,y,z ) -- هنا يوم ترد مكانها الاصلي end g_isOpen = not g_isOpen end addEventHandler( 'onResourceStart', getRootElement( ), function( ) for _,player in ipairs( getElementsByType( 'player' ) ) do if g_Serials [ getPlayerSerial ( player ) ] then bindKey( player, 'tab', 'down', MoveGate ) end end end ) addEventHandler( 'onPlayerJoin', getRootElement( ), function( ) if g_Serials [ getPlayerSerial ( source ) ] then bindKey( source, 'tab', 'down', MoveGate ); end end )
فاّرس Posted June 6, 2013 Posted June 6, 2013 -- # Server Side : local g_Gate = createObject( 980,x,y,z ) local g_Marker = createMarker( x,y,z, "corona", 20.0, 0, 0, 255, 0 ) local g_isOpen = nil local g_Serials = { ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, } function MoveGate( ) if not g_isOpen then moveObject( g_Gate, 2000, x,y,z ) -- هنا يوم تتحرك من مكانها الاصلي لـ اللي تبية else moveObject( g_Gate, 2000,x,y,z ) -- هنا يوم ترد مكانها الاصلي end g_isOpen = not g_isOpen end addEventHandler( 'onResourceStart', getRootElement( ), function( ) for _,player in ipairs( getElementsByType( 'player' ) ) do if g_Serials [ getPlayerSerial ( player ) ] then bindKey( player, 'tab', 'down', MoveGate ) end end end ) addEventHandler( 'onPlayerJoin', getRootElement( ), function( ) if g_Serials [ getPlayerSerial ( source ) ] then bindKey( source, 'tab', 'down', MoveGate ); end end ) المعذره , بس وش الفايده انك تحط قدام السريال true ? يعني لو شلتها بيخرب ؟ Sha67 سابقاً
iPrestege Posted June 6, 2013 Posted June 6, 2013 -- # Server Side : local g_Gate = createObject( 980,x,y,z ) local g_Marker = createMarker( x,y,z, "corona", 20.0, 0, 0, 255, 0 ) local g_isOpen = nil local g_Serials = { ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, ['Serial'] = true, } function MoveGate( ) if not g_isOpen then moveObject( g_Gate, 2000, x,y,z ) -- هنا يوم تتحرك من مكانها الاصلي لـ اللي تبية else moveObject( g_Gate, 2000,x,y,z ) -- هنا يوم ترد مكانها الاصلي end g_isOpen = not g_isOpen end addEventHandler( 'onResourceStart', getRootElement( ), function( ) for _,player in ipairs( getElementsByType( 'player' ) ) do if g_Serials [ getPlayerSerial ( player ) ] then bindKey( player, 'tab', 'down', MoveGate ) end end end ) addEventHandler( 'onPlayerJoin', getRootElement( ), function( ) if g_Serials [ getPlayerSerial ( source ) ] then bindKey( source, 'tab', 'down', MoveGate ); end end ) المعذره , بس وش الفايده انك تحط قدام السريال true ? يعني لو شلتها بيخرب ؟ على حسب طريقتك بـ استخراج النتائج يكون الجدول يعني لو تسوي كذا : local IDs = { 30,31 } مايحتاج ترو بس تقدر تستخرجها باللوب انا استخرجت كودي بدون لوب بـ هالطريقة : local IDs = { [ 30 ] = true, [ 31 ] = true } يعتمد على طريقتكـ بـ الجدول و البرمجة ..
فاّرس Posted June 6, 2013 Posted June 6, 2013 كذآ صح ؟ local marker = createMarker(...) local Teams = { ['Red'] = true, ['Bule'] = true, ['Green'] = true, ['White'] = true, ['Black'] = true, } addEventHandler("onClientMarkerHit",marker, function(player) if getElementType(player) == 'player' then if Teams [ getTeamFromName ( player ) ] then setElementPosition(...) else outputChatBox("* You most be 'Teams' !") end end end) Sha67 سابقاً
iPrestege Posted June 6, 2013 Posted June 6, 2013 انت ماحددت انة تيم الاعب نفسة ذذذذذذذذذ و سوية سيرفر افضل
فاّرس Posted June 6, 2013 Posted June 6, 2013 مم اكره الاقواس [] احسها شريره if getPlayerTeam(player) and Teams [ getTeamFromName ( player ) ] then ^? Sha67 سابقاً
iPrestege Posted June 6, 2013 Posted June 6, 2013 لا خلها بدال and == و تجيب player ? اسم التيم؟؟ kidding ? جرب كذآ : if getPlayerTeam ( player ) and Teams [ getTeamName ( getPlayerTeam ( player ) ) ] then
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