Simba Posted July 2, 2014 Share Posted July 2, 2014 السلام عليكم .. عندي مشكلة بالكود هذا انا مسويه لما يركب السياره بس مو اي سياره فقط السياره الي تمت صناعتها من نفس السكربت هي قريد ليست ياخذ منها سيارات القريد ليست يظهر وكل شي لما اختار سياره يطلعلي في الديبوق لو كان بتيم نو تيم يقدر يركب لو كان مهو داخل التيم يطلعه من السياره او ما يدخله لها الاكواد local car = {} addEvent("GiveCar",true) addEventHandler("GiveCar",root, function (name) if isElement(car[source]) then destroyElement(car[source]) end local x, y, z = getElementPosition ( source ) car[source] = createVehicle ( getVehicleModelFromName(name), x , y, z ) warpPedIntoVehicle ( source, car[source] ) end ) function enterVehicle ( theVehicle, seat, jacked ) local playerTeam = getPlayerTeam(source) if ( getTeamName( playerTeam ) == ( No Team ) ) then return end if not ( getTeamName( playerTeam ) == ( No Team ) ) then removePedFromVehicle ( source ) outputChatBox ( "Only [No Team] Team!", source ) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enterVehicle ) الكود من الويكي وانا عدلت عليه شويتين الديبوق يكتب ERROR: Loading script failed: CARSS\server.lua:34: ')' expected near 'Team' هي قريد ليست ياخذ منها سيارات القريد ليست يظهر وكل شي لما اختار سياره يطلعلي في الديبوق ERROR: Client (Mr.N86AH..!) triggered serverside event GiveCar, but event is not added serverside Mr.N86AH..! ==اسمي Link to comment
#DRAGON!FIRE Posted July 2, 2014 Share Posted July 2, 2014 اطرح الميتا .. local vehicle = { }; addEvent( "GiveCar", true ) addEventHandler( "GiveCar", root, function ( name ) if ( isElement( vehicle[ source ] ) ) then destroyElement( vehicle[ source ] ) end local x, y, z = getElementPosition ( source ) vehicle[ source ] = createVehicle ( getVehicleModelFromName( name ), x, y, z ) warpPedIntoVehicle ( source, vehicle[ source ] ) end ) addEventHandler ( "onPlayerVehicleEnter", resourceRoot, function( ) if ( getPlayerTeam( source ) and getPlayerTeam( source ) ~= getTeamFromName( "NoTeam" ) ) then cancelEvent( true ) end end ) addEventHandler( "onPlayerQuit", root, function( ) if ( isElement( vehicle[ source ] ) ) then destroyElement( vehicle[ source ] ) vehicle[ source ] = nil end end ) Link to comment
Simba Posted July 2, 2014 Author Share Posted July 2, 2014 اللوحة ما تفتح الا لتيم نو تيم كذا تمام بس المشكلة اي احد يقدر يركب السياره الميتا ملف السيرفر local vehicle = { }; addEvent( "GiveCar", true ) addEventHandler( "GiveCar", root, function ( name ) if ( isElement( vehicle[ source ] ) ) then destroyElement( vehicle[ source ] ) end local x, y, z = getElementPosition ( source ) vehicle[ source ] = createVehicle ( getVehicleModelFromName( name ), x, y, z ) warpPedIntoVehicle ( source, vehicle[ source ] ) end ) ------------- addEventHandler ( "onPlayerVehicleEnter", resourceRoot, function( ) if ( getPlayerTeam( source ) and getPlayerTeam( source ) ~= getTeamFromName( "NoTeam" ) ) then cancelEvent( true ) end end ) ------------------ addEventHandler("onVehicleExplode",root,function() setTimer(destroyElement,3000,1,source) end) ------- addEventHandler( "onPlayerQuit", root, function( ) if ( isElement( vehicle[ source ] ) ) then destroyElement( vehicle[ source ] ) vehicle[ source ] = nil end end ) ملف الكلينت ! local car = { {"banshee"}; --{"اسم السيارة"}; } function wind() for i, v in ipairs (car) do row = guiGridListAddRow( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, v[1], false, false ) end end addEventHandler("onClientResourceStart", resourceRoot, wind ) local marker1 = createMarker ( 1935.3000488281, 707.90002441406, 9.8999996185303, 'cylinder', 1.5, 0, 255, 0, 255 ) local marker2 = createMarker ( 1929.1999511719, 707.70001220703, 9.8999996185303, 'cylinder', 1.5, 0, 255, 0, 255 ) ------ show gui guiSetVisible ( GUIEditor.window[1], false ) addEventHandler( "onClientMarkerHit", marker1, function ( mrk1 ) if ( mrk1 == localPlayer ) then if ( getPlayerTeam( mrk1 ) and getPlayerTeam( mrk1 ) == getTeamFromName( 'No Team' ) ) then if ( guiGetVisible ( GUIEditor.window[1] ) == false ) then guiSetVisible ( GUIEditor.window[1], true ) showCursor ( true ) end end end end ) addEventHandler( "onClientMarkerHit", marker2, function ( mrk2 ) if ( mrk2 == localPlayer ) then if ( getPlayerTeam( mrk2 ) and getPlayerTeam( mrk2 ) == getTeamFromName( 'No Team' ) ) then if ( guiGetVisible ( GUIEditor.window[1] ) == false ) then guiSetVisible ( GUIEditor.window[1], true ) showCursor ( true ) end end end end ) --- لاختيار السياره addEventHandler("onClientGUIClick", GUIEditor.button[1], function () local Row = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) if (Row ~= -1) then local carName = guiGridListGetItemText ( GUIEditor.gridlist[1], Row, 1 ) triggerServerEvent( "GiveCar", localPlayer, carName ) guiSetVisible ( GUIEditor.window[1], false ) showCursor ( false ) end end ) ----- hide gui addEventHandler("onClientGUIClick", GUIEditor.button[2], function ( player ) guiSetVisible ( GUIEditor.window[1], false ) showCursor ( false ) end ) Link to comment
al-Kobra Posted July 2, 2014 Share Posted July 2, 2014 (edited) جرب السيرفر كذا local vehicle = { }; addEvent( "GiveCar", true ) addEventHandler( "GiveCar", root, function ( name ) if ( isElement( vehicle[ source ] ) ) then destroyElement( vehicle[ source ] ) end local x, y, z = getElementPosition ( source ) vehicle[ source ] = createVehicle ( getVehicleModelFromName( name ), x, y, z ) warpPedIntoVehicle ( source, vehicle[ source ] ) end ) ------------- addEventHandler ( "onVehicleStartEnter", root, function( plr ) if getPlayerTeam( plr ) and getPlayerTeam( plr ) ~= getTeamFromName( "No Team" ) then cancelEvent( ) end end ) ------------------ addEventHandler("onVehicleExplode",root,function() setTimer(destroyElement,3000,1,source) end) ------- addEventHandler( "onPlayerQuit", root, function( ) if ( isElement( vehicle[ source ] ) ) then destroyElement( vehicle[ source ] ) vehicle[ source ] = nil end end ) Edited July 2, 2014 by Guest Link to comment
Simba Posted July 2, 2014 Author Share Posted July 2, 2014 نفس المشكلة ترا انت كاتب اسم التيم غلط عدلته ونفس الشي Link to comment
Simba Posted July 2, 2014 Author Share Posted July 2, 2014 كودك ما اشتغل بس خلاص شكرا لكم جميعا حليت المشكلة بس اني ضفت not عند التحقق if not ( getPlayerTeam( plr ) and getPlayerTeam( plr ) == getTeamFromName( 'No Team' ) ) then وغيرت ~= الى == Link to comment
#DRAGON!FIRE Posted July 3, 2014 Share Posted July 3, 2014 زي ما سويت ما اعتقد ينفع وكان عندي غلط حاط سورس ذذ جرب كذا local vehicle = { }; addEvent( "GiveCar", true ) addEventHandler( "GiveCar", root, function ( name ) if ( isElement( vehicle[ source ] ) ) then destroyElement( vehicle[ source ] ) end local x, y, z = getElementPosition ( source ) vehicle[ source ] = createVehicle ( getVehicleModelFromName( name ), x, y, z ) warpPedIntoVehicle ( source, vehicle[ source ] ) end ) ------------- addEventHandler ( "onPlayerVehicleEnter", resourceRoot, function( player ) if ( getPlayerTeam( player ) and not getPlayerTeam( player ) == getTeamFromName( "NoTeam" ) ) then cancelEvent( true ) end end ) addEventHandler( "onVehicleExplode", resourceRoot, function ( ) setTimer( destroyElement, 3000, 1, source ) end ) addEventHandler( "onPlayerQuit", root, function( ) if ( isElement( vehicle[ source ] ) ) then destroyElement( vehicle[ source ] ) vehicle[ source ] = nil end end ) Link to comment
Simba Posted July 3, 2014 Author Share Posted July 3, 2014 صارت مشكلة الكود الي اعطاني اياه كوبرا لازم حط اني لازم اركب السياره واكون نو تيم بس هو حاط لكل السيارت مو بس السيارات الي اجيبها من السكربت ---- كود زاحف ما اشتغل اذا كنت بتيم او بدون تيم اقدر اركب Link to comment
al-Kobra Posted July 3, 2014 Share Posted July 3, 2014 زاحف ,, 'onPlayerVehicleEnter' هذا الحدث ما يصير تسويله كنسل ايفنت #Edit صارت مشكلة الكود الي اعطاني اياه كوبرا لازم حط اني لازم اركب السياره واكون نو تيم بس هو حاط لكل السيارتمو بس السيارات الي اجيبها من السكربت جرب تسوي اذا اخذ سيارة من الجريد لست يسوي لها داتا ,, وبعدين اذا بيركب السيارة يتحقق من الداتا =) Link to comment
Simba Posted July 3, 2014 Author Share Posted July 3, 2014 طيب بحاول اسوي داتا واقولكم Link to comment
AboShanab Posted July 3, 2014 Share Posted July 3, 2014 @ZA7F : "onPlayerVehicleEnter" > "onVehicleStartEnter" Link to comment
Simba Posted July 3, 2014 Author Share Posted July 3, 2014 سويت كذا local vehicle = { }; addEvent( "GiveCar", true ) addEventHandler( "GiveCar", root, function ( name ) if ( isElement( vehicle[ source ] ) ) then destroyElement( vehicle[ source ] ) end local x, y, z = getElementPosition ( source ) vehicle[ source ] = createVehicle ( getVehicleModelFromName( name ), x, y, z ) setElementData( vehicle[ source ], "TeamCar", true ) warpPedIntoVehicle ( source, vehicle[ source ] ) end ) ------------- addEventHandler ( "onVehicleStartEnter", resourceRoot, function( player ) if ( isElement( vehicle[ source ] ) ) then if ( getElementData ( vehicle[ source ], "TeamCar" ) == true ) then return end else cancelEvent( ) outputChatBox( "^^Only for the team [No Team]^^" ) end end ) addEventHandler( "onVehicleExplode", resourceRoot, function ( ) setTimer( destroyElement, 3000, 1, source ) end ) بس المشكلة انه يعطيني سياره بس لما انزل منها ما اقدر اركب مره ثانيه مع اني منضم للتيم Link to comment
jafar Posted July 3, 2014 Share Posted July 3, 2014 انت حاط اذا كلن معه الداتا يوقف الحدث المفروض تسوي العكس Link to comment
Simba Posted July 3, 2014 Author Share Posted July 3, 2014 طيب كيف اسويه ! انا جربت اسوي كذا if not ( getElementData ( vehicle[ source ], "TeamCar" ) == true ) then cancelEvent( ) كمان هذا ما اشتغل طيب انا عندي سؤال لو ما معه الداتا يسوي كنسل لالافنت كذا تمام ؟ طيب لو معه الداتا وش اسوي ؟؟ Link to comment
TAPL Posted July 3, 2014 Share Posted July 3, 2014 local vehicle = {} addEvent("GiveCar", true) addEventHandler("GiveCar", root, function(name) if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end local x, y, z = getElementPosition(source) vehicle[source] = createVehicle(getVehicleModelFromName(name), x, y, z) warpPedIntoVehicle(source, vehicle[source]) end) ------------- addEventHandler("onVehicleStartEnter", resourceRoot, function(player) local team = getPlayerTeam(player) local teamName = team and getTeamName(team) or "" if teamName ~= "No Team" then cancelEvent() outputChatBox("^^Only for the team [No Team]^^") else outputChatBox("^^Welcome to the car !!!!^^") end end) addEventHandler("onVehicleExplode", resourceRoot, function() setTimer(destroyElement, 3000, 1, source) end) Link to comment
AboShanab Posted July 4, 2014 Share Posted July 4, 2014 محد فاهمني غيرك ي تابل حاط لهم الكود ومو مشغلين عقلهم Link to comment
Max+ Posted July 4, 2014 Share Posted July 4, 2014 محد فاهمني غيرك ي تابل حاط لهم الكود ومو مشغلين عقلهم يعني يوم غيرت الايفنت كذا سويت معجزة بالكود ؟ دامك تعرف له ليه ماسويته له ؟ ترا ماحب اللي ينتقد الناس وهو ماهو شايف نفسه , Link to comment
AboShanab Posted July 4, 2014 Share Posted July 4, 2014 @ZA7F : "onPlayerVehicleEnter" > "onVehicleStartEnter" انا عطيته زبدة الخطا م يحتاج اساعده Link to comment
#DRAGON!FIRE Posted July 4, 2014 Share Posted July 4, 2014 @ZA7F : "onPlayerVehicleEnter" > "onVehicleStartEnter" انا عطيته زبدة الخطا م يحتاج اساعده صحيح نسيت انه الحدث ما يتكنسل 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