mR.Z Posted October 5, 2014 Share Posted October 5, 2014 كلنت addEventHandler("onClientGUIClick", resourceRoot, function( ) if source == shm then triggerServerEvent("onAddArrowPlayerSpecialCar", localPlayer) guiSetVisible(carbild, false) showCursor(false) elseif source == clour then triggerServerEvent("onRandomColorPlayerSpecialCar", localPlayer) guiSetVisible(carbild, false) showCursor(false) end end) سيرفر addEvent("onRandomColorPlayerSpecialCar", true) addEventHandler("onRandomColorPlayerSpecialCar", root, function( ) if isElement(vehicle[source]) then if isTimer(timer[source]) then killTimer(timer[source]) else timer[source] = setTimer(function(plr) setVehicleColor(vehicle[plr], math.random(255), math.random(255), math.random(255)) end, 1000, 0, source) end else outputChatBox("not Found Car", source, math.random(0,255),math.random(0,255),math.random(0,255)) end end) addEvent("onAddArrowPlayerSpecialCar", true) addEventHandler("onAddArrowPlayerSpecialCar", root, function( ) if isElement(vehicle[source]) then if isElement(Arrow[source]) then destroyElement(Arrow[source]) else Arrow[source] = createObject(1318, 0, 0, 0) attachElements(Arrow[source], vehicle[source], 0, 0, 1.5) end else outputChatBox("not Found Car", source, math.random(0,255),math.random(0,255),math.random(0,255)) end end) Link to comment
#DRAGON!FIRE Posted October 5, 2014 Share Posted October 5, 2014 وش المشكلة بالضبط .. اي اخطاء بالديبوق ؟ .. ما اشوف الجداول ولا مو حاطها . Link to comment
mR.Z Posted October 5, 2014 Author Share Posted October 5, 2014 مو حاط الكود كامل دقيقه احطه كلنت c arbild = guiCreateStaticImage(433, 257, 494, 186,"images/Z1.png",false) start_stop_b = guiCreateButton(15, 32, 130, 44,"= إيقأف | تشغيل =",false, carbild) Lock_unlock_b = guiCreateButton(15, 138, 130, 44,"= فتح | قفل =",false, carbild) bfliegenan = guiCreateButton(187, 32, 130, 44,"= تشغيل ألطيرآن =",false,carbild) bfliegenaus = guiCreateButton(357, 32, 130, 44,"= إيقأف الطيرآن =",false,carbild) bhoveran = guiCreateButton(187, 138, 130, 44,"= تشغيل ألبحر =",false,carbild) bhoveraus = guiCreateButton(357, 138, 130, 44,"= إيقأف البحر =",false,carbild) function resourcestart () guiSetVisible(carbild, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), resourcestart) function fenster( ) guiSetVisible ( carbild, not guiGetVisible ( carbild ) ) showCursor ( guiGetVisible ( carbild ) ) end bindKey("o", "down", fenster) --[[ function oeffne_fenster() local IsWindowVisible = guiGetVisible(carbild) if (IsWindowVisible == true) then guiSetVisible(carbild, false) showCursor(false) end if (IsWindowVisible == false) then guiSetVisible(carbild, true) showCursor(true) end end bindKey("o", "down", oeffne_fenster) ]]-- addEventHandler("onClientGUIClick", getRootElement() , function (state) if state == "left" then if source == start_stop_b then local spieler = getLocalPlayer() triggerServerEvent("motoranaus", spieler, spieler) end end end ) addEventHandler("onClientGUIClick", getRootElement() , function (state) if state == "left" then if source == Lock_unlock_b then local spieler = getLocalPlayer() triggerServerEvent("lockc", spieler ,spieler) end end end ) function Fliegenan () setWorldSpecialPropertyEnabled ( "aircars", true ) end addEventHandler ( "onClientGUIClick", bfliegenan, Fliegenan ) function Fliegenaus ( ) setWorldSpecialPropertyEnabled ( "aircars", false ) end addEventHandler ( "onClientGUIClick", bfliegenaus, Fliegenaus ) function hoveran ( ) setWorldSpecialPropertyEnabled ( "hovercars", true ) end addEventHandler ( "onClientGUIClick", bhoveran, hoveran ) function hoveraus ( ) setWorldSpecialPropertyEnabled ( "hovercars", false ) end addEventHandler ( "onClientGUIClick", bhoveraus, hoveraus ) guiSetProperty(start_stop_b,"PushedTextColour","FF00ff00") guiSetProperty(Lock_unlock_b,"PushedTextColour","FFffff00") guiSetProperty(bfliegenan,"PushedTextColour","FFdd00dd") guiSetProperty(bfliegenaus,"PushedTextColour","FF000000") guiSetProperty(bhoveran,"PushedTextColour","FFf0000f") guiSetProperty(bhoveraus,"PushedTextColour","FFfffff") addEventHandler ("onClientGUIClick", getRootElement(), function () if source == start_stop_b then outputChatBox("= تم إيقأف تشغيل السيأره | تم تشفيل ألسيآره =") end end ) سيرفر function motoran(player) if getPedOccupiedVehicleSeat(player) == 0 then local vehicle = getPedOccupiedVehicle (player) if getVehicleEngineState(vehicle) == false then setVehicleEngineState (vehicle, true) else setVehicleEngineState (vehicle, false) end end end addEvent("motoranaus",true) addEventHandler("motoranaus", getRootElement() ,motoran) function lockcar ( Player ) if getPedOccupiedVehicleSeat(Player) == 0 then playervehicle = getPedOccupiedVehicle ( Player ) if ( playervehicle ) then if isVehicleLocked ( playervehicle ) then setVehicleLocked ( playervehicle, false ) outputChatBox("= تم إقفأل سيأرتك =",Player,math.random(0,255),math.random(0,255),math.random( 0,255)) else setVehicleLocked ( playervehicle, true ) outputChatBox("= تم فتح سيأرتك =",Player,math.random(0,255),math.random(0,255),math.random( 0,255)) end end end end addEvent("lockc",true) addEventHandler("lockc", getRootElement(), lockcar) function unlockOnExit(thePlayer, seat, jacker) if (seat == 0) and (thePlayer) and (isVehicleLocked(source)) then local unlocked = setVehicleLocked(source, false) if (unlocked) then outputChatBox("= تم إقفأل سيأرتك =",Player,math.random(0,255),math.random(0,255),math.random( 0,255)) end end end addEventHandler("onVehicleExit", getRootElement(), unlockOnExit) حذفت الكودات الي فوق لأني طفشت يعني انا الي كنت ابيه اذا ضغط زر تلوين السياره تصير كل ثانيه تتلونن او math.random(0,255),math.random(0,255),math.random( 0,255)) فهموتني اكيد ؟ Link to comment
فاّرس Posted October 5, 2014 Share Posted October 5, 2014 setVehicleColor setTimer math.random Link to comment
Mr.R Posted October 5, 2014 Share Posted October 5, 2014 (edited) تفضل, هذا الكود يخلي الموتر يتغير لونه كل ثانيه function VehicleColor ( ) -- وظيفه باسم if isTimer ( timer ) then return end -- تحقق الوقت timer = setTimer ( function ( ) -- وظيفة الوقت local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) -- r, g, b هذي الألوان setVehicleColor ( Vehicle, r, g, b ) -- r, g, b هذي الألوان end,1000,0 ) -- هنا الوقت + هذي اند فنكشن الوقت وتقدر تعدل على الوقت انا مخليه كل ثانيه end -- اند فنكشن تم تعديل الكود Edited October 6, 2014 by Guest Link to comment
فاّرس Posted October 6, 2014 Share Posted October 6, 2014 تفضل, هذا الكود يخلي الموتر يتغير لونه كل ثانيه function VehicleColor ( ) -- وظيفه بأسم setVehicleColor ( Vehicle, r, g, b ) -- r, g, b هذي الألوان local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) -- r, g, b هذي الألوان if ( isTimer ( Timer ) ) then return end -- تحقق من الوقت setTimer ( VehicleColor, 1000, 1 ) -- اضافة وقت , انا مخليه كل ثانيه يتغير لون end -- اند الفنكشن end -- اند الاف الكود راح يغير اللون مره وحده بس , لازم تحط بدل 1 , 0 + setVehicleColor المتغير حطه فوق الوظيفه + زايد عندك اند , الزبده ان الكود كله خطأ , function VehicleColor ( ) if isTimer ( timer ) then return end timer = setTimer ( function ( ) local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) setVehicleColor ( Vehicle, r, g, b ) end,1000,0 ) end * Vehicle : متغير , او تعريف السيارة Link to comment
Mr.R Posted October 6, 2014 Share Posted October 6, 2014 @TheBest مشكور على تعديل الأخطاء ما انتبهت لـ الاند حقت التحقق هع وزي ماقلت الكود يصير كذا function VehicleColor ( ) if isTimer ( timer ) then return end timer = setTimer ( function ( ) local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) setVehicleColor ( Vehicle, r, g, b ) end,1000,0 ) end وترى عدلت الكود السابق وسلام 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