faisl2002 Posted March 21, 2012 Share Posted March 21, 2012 السلام عليكم ابي كود دايرة اذا واحد جاء عليها بسيارته بسرعة محددة يكسب فلوس فقط بسيارة باي سيارة واسف هاذي الايام طلباتي كثيرة لاني ناوي اسوي قيم مود Link to comment
TAPL Posted March 21, 2012 Share Posted March 21, 2012 local theMarker = createMarker(1000,1000,30,"cylinder", 1.5, 255,255,0,170) addEventHandler("onMarkerHit", theMarker, function(hitElement) if (getElementType(hitElement) == "vehicle") then speedx, speedy, speedz = getElementVelocity(hitElement) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = math.ceil(actualspeed * 180) if (kmh >= 180 ) then local driver = getVehicleOccupant(hitElement) givePlayerMoney(driver,1000) outputChatBox("You Won $1000",driver,255,255,0) end end end) Link to comment
faisl2002 Posted March 21, 2012 Author Share Posted March 21, 2012 تسلم تابل مبدع والله ماشاء الله الله يوفقك Link to comment
faisl2002 Posted March 21, 2012 Author Share Posted March 21, 2012 تقدر تخليه سرعة 180 وفوق Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 تابل عدلي عليه ابي السرعة 180 وفوق انت حاط 180 محددة Link to comment
Sparrow Posted March 22, 2012 Share Posted March 22, 2012 == (Equals to) ~= (not equals to) < (Less than) > (Greater than) =< (Equals to or less than) >= (Equals to or greater than) it don't need to be edited, when you go with speed 180 or more than 180 you win money Link to comment
Sparrow Posted March 22, 2012 Share Posted March 22, 2012 local theMarker = createMarker(1000,1000,30,"cylinder", 1.5, 255,255,0,170) addEventHandler("onMarkerHit", theMarker, function(hitElement) if (getElementType(hitElement) == "vehicle") then speedx, speedy, speedz = getElementVelocity(hitElement) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = math.ceil(actualspeed * 180) if (kmh > 180 ) then local driver = getVehicleOccupant(hitElement) givePlayerMoney(driver,1000) outputChatBox("You Won $1000",driver,255,255,0) end end end) if you drive more than 180 KM/H you win money Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 ياهو مااشتغل امر عليه بالسيارة 20 مرة وبسرعة ماييصير شي فيه مشكلة وجربت == (Equals to) ~= (not equals to) < (Less than) > (Greater than) هاذي =< (Equals to or less than) >= (Equals to or greater than)وهاذي Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 هذا هو حقي بالاحداثيات local theMarker = createMarker(1820.3000488281,1248,7.5,"cylinder", 1.5, 255,255,0,170) addEventHandler("onMarkerHit", theMarker, function(hitElement) if (getElementType(hitElement) == "vehicle") then speedx, speedy, speedz = getElementVelocity(hitElement) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = math.ceil(actualspeed * 180) if (kmh > 180 ) then local driver = getVehicleOccupant(hitElement) givePlayerMoney(driver,1000) outputChatBox("You Won $1000",driver,255,255,0) end end end) Link to comment
Alpha Posted March 22, 2012 Share Posted March 22, 2012 Try: local theMarker = createMarker(1820.3000488281,1248,7.5,"cylinder", 1.5, 255,255,0,170) addEventHandler("onMarkerHit", theMarker, function(hitElement) if (getElementType(hitElement) == "vehicle") then local kmh = getElementSpeed(getPedOccupiedVehicle(hitElement),"kph") if (kmh > 180 ) then local driver = getVehicleOccupant(hitElement) givePlayerMoney(driver,1000) outputChatBox("You Won $1000",driver,255,255,0) end end end) function getElementSpeed(element, unit) if not element or not isElement(element) then return false end if unit == "kph" then unit = 1.61 else unit = 1 end local velX, velY, velZ = getElementVelocity(element) return(velX ^ 2 + velY ^ 2 + velZ ^ 2) ^ 0.5 * unit * 100 end Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 الدايرة تطلع وكل شي بس امر من جوتها بالسيارة داعسسسس مسررررررررررررع مايعطيني شي جربت كل الاكواد الي بهذا الموضوع Link to comment
TAPL Posted March 22, 2012 Share Posted March 22, 2012 جرب الكود ذا local theMarker = createMarker(1820.3000488281,1248,7.5,"cylinder", 1.5, 255,255,0,170) addEventHandler("onMarkerHit", theMarker, function(hitElement) if (getElementType(hitElement) == "player") then local vehicle = getPedOccupiedVehicle(hitElement) local vx, vy, vz = getElementVelocity(vehicle) local mph = math.floor(math.sqrt(vx^2 + vy^2 + vz^2) * 161) if (mph >= 180) then givePlayerMoney(hitElement,1000) outputChatBox("You Won $1000",hitElement,255,255,0) end end end) Link to comment
Alpha Posted March 22, 2012 Share Posted March 22, 2012 local theMarker = createMarker(1820.3000488281,1248,7.5,"cylinder", 1.5, 255,255,0,170) addEventHandler("onMarkerHit", theMarker, function(hitElement) if (getElementType(hitElement) == "vehicle") then local kmh = getElementSpeed(hitElement,"kph") if (kmh > 180 ) then local driver = getVehicleOccupant(hitElement) givePlayerMoney(driver,1000) outputChatBox("You Won $1000",driver,255,255,0) end end end) function getElementSpeed(element, unit) if not element or not isElement(element) then return false end if unit == "kph" then unit = 1.61 else unit = 1 end local velX, velY, velZ = getElementVelocity(element) return(velX ^ 2 + velY ^ 2 + velZ ^ 2) ^ 0.5 * unit * 100 end Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 يااخوان انتم جربوها عندكم اذا اشتغلت عطوني الكود قسم ولا كود اشتغل معي Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 انتم حاطين vehicle مركبة مين لازم نحدد مركبة الاعب صح ؟ ولا انا خطا Link to comment
Bssol Posted March 22, 2012 Share Posted March 22, 2012 اعتقد المشكلة في حجم الدائرة، لاني اذكر قبل كنت مسوي سكربت وكانت الدائرة صغيرة شوي فكان صعب يشتغل الكود فيها. جرب هذا ( مافي فرق عن الاكواد الي عطوك اياها الشباب، الاختلاف في حجم الدائرة بس ) local theMarker = createMarker(1000,1000,30,"cylinder", 7.0, 255,255,0,170) addEventHandler("onMarkerHit", theMarker, function(hitElement) if (getElementType(hitElement) == "vehicle") then speedx, speedy, speedz = getElementVelocity(hitElement) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = math.ceil(actualspeed * 180) if (kmh >= 180 ) then local driver = getVehicleOccupant(hitElement) givePlayerMoney(driver,1000) outputChatBox("You Won $1000",driver,255,255,0) end end end) Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 وخررررر انتم واكوادكم تدخل بسووووول القوات الخاصة هع ماشاء الله طيب بجربه لكن يااخ بسول اشكرك على تعاونك معي وياليت تمر على موضوعي حق اللوحة البيضة Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 للاسف الكود مااشتغل مثل الباقية تاكدوا منها يااخوان المشكلة ماهي في الحجم اظن المشكلة هنا if (getElementType(hitElement) == "vehicle") then Link to comment
TAPL Posted March 22, 2012 Share Posted March 22, 2012 للاسف الكود مااشتغل مثل الباقية تاكدوا منها يااخوان المشكلة ماهي في الحجم اظن المشكلة هنا if (getElementType(hitElement) == "vehicle") then الكودين الي أنا حطيتهم في الموضوع شغالين و توني الحين جربتهم هنا meta.xml حط الي في ملف أتوقع أن عندك خطأ و تراه الكود سيرفر موب كلينت Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 انا عندي ملفين هم meta.xml و server.lua بس بحط لك كود الmeta في الرد الي بعد هذا Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 <meta> <info author="50p" version="0.1.0" type="misc" /> <script src="server.lua" type="client" /> </meta> Link to comment
Alpha Posted March 22, 2012 Share Posted March 22, 2012 <meta> <info author="50p" version="0.1.0" type="misc" /> <script src="server.lua" type="server" /> </meta> meta.xml كل دة و المشكلة فى Link to comment
faisl2002 Posted March 22, 2012 Author Share Posted March 22, 2012 ههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههههه والله ماانتبهت له لاني كنت استعمل هذا الملف بكل موداتي خخخخخخخخخخخخخخخخخ والله اسف تكفون سامحوني والله تعبتكم تنحسب لمن في اجركم انشاء الله معليش والله 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