max-mohammed Posted February 15, 2014 Share Posted February 15, 2014 سلام عليكم شباب كيفكم ان شاء الله طيبين المهم....... انا عندي كود فيه ماركرين الاول يفتح لك لوحة والثاني يوديك مكان اوك بعد مايوديك المكان يوديك عالم وهمي ويحطك في سيارة وبعدين تجي ماركرات قدامك لو لمست ماركر يصير فنكشن اوك وفيله نظام سرعة المهم كلنت addEvent ("gui", true) addEventHandler ("gui", getRootElement(), function gui () if (getLocalPlayer() == source) then guiSetVisible (wnd, true) showCursor (true) end end ) addEventHandler("onClientGUIClick",root,function() if (source == close) then guiSetVisible (wnd, false) showCursor (false) elseif (source == buy) then triggerServerEvent("Account",getRootElement()) end end) سيررفر setElementDimension(los,766) setElementDimension(win1,766) setElementDimension(winr,766) addEvent ("gui", true) function markerHit (hitPlayer, matchingDimension) if (source == marker) then local acc = getPlayerAccount(hitPlayer) if getElementType (hitPlayer) == 'player' and acc and not isGuestAccount(acc) then if ( getAccountData(acc,'ماعليك منه') == 'ماعليك منه') then local car = createVehicle( math.random(455,411,577), 2470.6877441406, -1614.0283203125, 1180.4453125) setElementDimension(car,766) setElementDimension(hitPlayer,766) warpPedIntoVehicle(hitPlayer,car) setAccountData(acc,ماعليك منه) else outputChatBox ('لايوجد لديك ', hitPlayer, 255, 0, 0, false) end end elseif (source == marker1) then local acc = getPlayerAccount(hitPlayer) if acc and not isGuestAccount(acc) then triggerClientEvent ("gui", hitPlayer) end end end addEventHandler ("onMarkerHit", getRootElement(), markerHit) addEvent ("Account", true) addEventHandler ("Account", getRootElement(), function() if (getPlayerMoney (source) >= 1000) then outputChatBox ("تم شراء ", source, 255, 0, 0, false) takePlayerMoney (source, 1000) setAccountData (getPlayerAccount (source), ماعليك منه) else outputChatBox ("ليس لديك نقود", source, 255, 0, 0, false) end end) function mkr (hitPlayer, unit) local vh = getVehicleOccupant(hitPlayer) if (source == los) and vh then destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,766) elseif (source == winr) and vh then local acc = getPlayerAccount(hitPlayer) if acc and not isGuestAccount(acc) then setAccountData (acc, ماعليك منه) destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,766) end elseif (source == win1) and vh then if (unit == nil) then unit = 0 end if (unit == "kbh") then local Speed = getElementSpeed(hitPlayer, unit) if (Speed >= 90) then destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,766) end end end end addEventHandler ("onMarkerHit",getRootElement(),mkr) الكود كامل الا المركرات + اللوحة! انتظر الردود Link to comment
max-mohammed Posted February 17, 2014 Author Share Posted February 17, 2014 ابي مساعده ضروري Link to comment
Do_De<3 Posted February 18, 2014 Share Posted February 18, 2014 وضحح اكثر يآصآحب الموضوع : / يعني تبيهه اول مايخش على الماركر الاول يوديهه لعالم وهمي اند تجي ماركر قدامك اند يعطيكك سيآره اند يكون فيهه نظام سرعة ؟ ؟ Link to comment
The Killer Posted February 18, 2014 Share Posted February 18, 2014 addEvent("gui", true) addEventHandler ("gui", root, function () if (getLocalPlayer () == source) then guiSetVisible (wnd, true) showCursor(true) end end) addEventHandler("onClientGUIClick",root,function() if (source == close) then guiSetVisible (wnd, false) showCursor (false) elseif (source == buy) then triggerServerEvent("Account",getRootElement()) end end) setElementDimension(los,766) setElementDimension(win1,766) setElementDimension(winr,766) addEvent ("gui", true) function markerHit (hitPlayer, matchingDimension) if (source == marker) then local acc = getPlayerAccount(hitPlayer) if getElementType (hitPlayer) == 'player' and acc and not isGuestAccount(acc) then if ( getAccountData(acc,'ماعليك منه') == 'ماعليك منه') then local car = createVehicle( math.random(455,411,577), 2470.6877441406, -1614.0283203125, 1180.4453125) setElementDimension(car,766) setElementDimension(hitPlayer,766) warpPedIntoVehicle(hitPlayer,car) setAccountData(acc,"ماعليك منه") else outputChatBox ('لايوجد لديك ', hitPlayer, 255, 0, 0, false) end end elseif (source == marker1) then local acc = getPlayerAccount(hitPlayer) if acc and not isGuestAccount(acc) then triggerClientEvent ("gui", hitPlayer) end end end addEventHandler ("onMarkerHit", getRootElement(), markerHit) addEvent ("Account", true) addEventHandler ("Account", getRootElement(), function() if (getPlayerMoney (source) >= 1000) then outputChatBox ("تم شراء ", source, 255, 0, 0, false) takePlayerMoney (source, 1000) setAccountData (getPlayerAccount (source), "ماعليك منه") else outputChatBox ("ليس لديك نقود", source, 255, 0, 0, false) end end) function mkr (hitPlayer, unit) local vh = getVehicleOccupant(hitPlayer) if (source == los) and vh then destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,766) elseif (source == winr) and vh then local acc = getPlayerAccount(hitPlayer) if acc and not isGuestAccount(acc) then setAccountData (acc, "ماعليك منه") destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,766) end elseif (source == win1) and vh then if (unit == nil) then unit = 0 end if (unit == "kbh") then local Speed = getElementSpeed(hitPlayer, unit) if (Speed >= 90) then destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,766) end end end end addEventHandler ("onMarkerHit",getRootElement(),mkr) Link to comment
max-mohammed Posted February 18, 2014 Author Share Posted February 18, 2014 مشكوور الكود اشتغل الا نقطة لما اروح الماركر الي اسمه marker مايبي يدخلني مع اني شريت المطلوب والداتا جاء للحساب بس المشكلة انه مايبي يدخلني يقول لايوجد لديك الي حطيتها اتمنى حل Link to comment
AboShanab Posted February 18, 2014 Share Posted February 18, 2014 if ( getAccountData(acc,'ماعليك منه' == ('ماعليك منه' ) then Link to comment
max-mohammed Posted February 18, 2014 Author Share Posted February 18, 2014 شباب عرفت المشكلة وحليتها المهم الحين في خطأ ثاني هو addEventHandler ("onMarkerHit",getRootElement(), function (hitPlayer, unit) if (source == los) and vh then local vh = getVehicleOccupant(hitPlayer) destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,766) elseif (source == winr) and vh then local vh = getVehicleOccupant(hitPlayer) local acc = getPlayerAccount(hitPlayer) if acc and not isGuestAccount(acc) then setAccountData (acc, "ro5sa","yes") destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,766) end elseif (source == win1) and vh then local vh = getVehicleOccupant(hitPlayer) if (unit == nil) then unit = 0 end if (unit == "kbh") then local Speed = getElementSpeed(hitPlayer, unit) if (Speed >= 90) then destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer ,766) end end end end ) هذا هو وممكن طلب آخر انه لو ضغط انتر او حرف ب مايقدر ينزل من السيارة لو كان في العالم الوهمي 766 Link to comment
al-Kobra Posted February 18, 2014 Share Posted February 18, 2014 (edited) وش المشكلة الاولى ؟؟ addEventHandler ( "onVehicleStartExit", getRootElement(), function ( exitingPlayer ) if getElementDimension ( exitingPlayer ) == 766 then cancelEvent ( ) end end ) جرب , Edited February 18, 2014 by Guest Link to comment
K1NG Posted February 18, 2014 Share Posted February 18, 2014 وش المشكلة الاولى ؟؟ addEventHandler ( "onVehicleExit", getRootElement(), function ( thePlayer ) if not getElementDimension ( thePlayer ) == 477 then cancelEvent () end end ) جرب , ! مايمديكـ تكنسله + الشرط حقكـ خطأ أنت كذا متحقق اذا العالم الوهمي ماهو 477 يكنسل الحدث onVehicleExit حدث : رقم العالم الوهمي الي انت حاطه بالشرط ماهو مثل الي طلبه صاحب الموضوع، ع كل حال الكود يصير كذا + * Server Side: addEventHandler ( "onVehicleStartExit", root, function ( player ) if ( getElementDimension ( player ) == 766 ) then cancelEvent ( ) end end ) Link to comment
al-Kobra Posted February 18, 2014 Share Posted February 18, 2014 وش المشكلة الاولى ؟؟ addEventHandler ( "onVehicleExit", getRootElement(), function ( thePlayer ) if not getElementDimension ( thePlayer ) == 477 then cancelEvent () end end ) جرب , ! مايمديكـ تكنسله + الشرط حقكـ خطأ أنت كذا متحقق اذا العالم الوهمي ماهو 477 يكنسل الحدث onVehicleExit حدث : رقم العالم الوهمي الي انت حاطه بالشرط ماهو مثل الي طلبه صاحب الموضوع، ع كل حال الكود يصير كذا + * Server Side: addEventHandler ( "onVehicleStartExit", root, function ( player ) if ( getElementDimension ( player ) == 766 ) then cancelEvent ( ) end end ) لأن كنت اسويه بالنوت باد فمن كذا ما حطيت الرقم صح ض1 وكنت بسوي return بس نسيت ابدله على العموم تم التعديل Link to comment
K1NG Posted February 18, 2014 Share Posted February 18, 2014 وش المشكلة الاولى ؟؟ addEventHandler ( "onVehicleExit", getRootElement(), function ( thePlayer ) if not getElementDimension ( thePlayer ) == 477 then cancelEvent () end end ) جرب , ! مايمديكـ تكنسله + الشرط حقكـ خطأ أنت كذا متحقق اذا العالم الوهمي ماهو 477 يكنسل الحدث onVehicleExit حدث : رقم العالم الوهمي الي انت حاطه بالشرط ماهو مثل الي طلبه صاحب الموضوع، ع كل حال الكود يصير كذا + * Server Side: addEventHandler ( "onVehicleStartExit", root, function ( player ) if ( getElementDimension ( player ) == 766 ) then cancelEvent ( ) end end ) لأن كنت اسويه بالنوت باد فمن كذا ما حطيت الرقم صح ض1 وكنت بسوي return بس نسيت ابدله على العموم تم التعديل : في عندكـ هنا خطأ بسيط، بعد ماعدلت كودكـ وش المشكلة الاولى ؟؟ addEventHandler ( "onVehicleStartExit", getRootElement(), function ( exitingPlayer ) if getElementDimension ( thePlayer ) == 766 then cancelEvent () end end ) جرب , : ليصبح هكذا ،exitingPlayerغير معرف بالسطر رقم 2، إستبدلها بـ thePlayer عندكـ هنا if ( getElementDimension ( exitingPlayer ) == 766 ) then Link to comment
al-Kobra Posted February 18, 2014 Share Posted February 18, 2014 : ليصبح هكذا ،exitingPlayerغير معرف بالسطر رقم 2، إستبدلها بـ thePlayer عندكـ هنا if ( getElementDimension ( exitingPlayer ) == 766 ) then من وين طلعت !! تم التعديل ,, تسلم على التنبيه Link to comment
max-mohammed Posted February 18, 2014 Author Share Posted February 18, 2014 مشكورين على الاكواد بس لما المس اي ماركر يقول الديبق RA\marker.lua:96: Bad 'vehicle' pointer @ 'getVehicleOccupant'(1) الكود addEventHandler ("onMarkerHit",getRootElement(), function (hitPlayer) if (source == los) then local vh = getVehicleOccupant(hitPlayer) destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,0) elseif (source == winr) then local vh = getVehicleOccupant(hitPlayer) local acc = getPlayerAccount(hitPlayer) if acc and not isGuestAccount(acc) then setAccountData (acc, "ro5sa","yes") destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer,0) end elseif (source == win1) then local vh = getVehicleOccupant(hitPlayer) local Speed = getElementSpeed(hitPlayer, "kph") if (Speed >= 90) then destroyElement(vh) setElementPosition(hitPlayer, x, y, z) setElementDimension(hitPlayer ,0) end end end ) اما كود السرعة جبته من الويكي ولازم اضيفه في سيرفر function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.8 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end Link to comment
al-Kobra Posted February 18, 2014 Share Posted February 18, 2014 انت ماعرّفت hitPlayer ,, وكود السرعة حطه بداية ملف السيرفر 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