Mhmd.z Posted August 21, 2015 Share Posted August 21, 2015 السلام عليكم ورحمة الله وبركاته الكود هو عن سرعة السياره ما يضبط , وذا المثال اخذته من الويكي addCommandHandler("setmyspeed", function (player, cmd) local veh = getPedOccupiedVehicle(player) if (veh) then setElementSpeed(veh, "kph", 15) else outputChatBox("You have to sit in vehicle", player) end end ) Link to comment
#CroSs Posted August 21, 2015 Share Posted August 21, 2015 حط ذي الأكواد فوق الكود إلي عندك function getElementSpeed(theElement, unit) assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") assert(getElementType(theElement) == "player" or getElementType(theElement) == "ped" or getElementType(theElement) == "object" or getElementType(theElement) == "vehicle", "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType(theElement) .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) return (Vector3(getElementVelocity(theElement)) * mult).length end function setElementSpeed(element, unit, speed) if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then local diff = speed/acSpeed if diff ~= diff then return end local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end Link to comment
Mhmd.z Posted August 21, 2015 Author Share Posted August 21, 2015 كل ذي بالاخر مو شغاله Link to comment
Professional Posted August 22, 2015 Share Posted August 22, 2015 حط ذي الأكواد فوق الكود إلي عندك function getElementSpeed(theElement, unit) assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") assert(getElementType(theElement) == "player" or getElementType(theElement) == "ped" or getElementType(theElement) == "object" or getElementType(theElement) == "vehicle", "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType(theElement) .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) return (Vector3(getElementVelocity(theElement)) * mult).length end function setElementSpeed(element, unit, speed) if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then local diff = speed/acSpeed if diff ~= diff then return end local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end وش عاطيه انت ؟؟ عاطيه كود يمكن 10 % من الي طلبه ولسا مو معرف شيئ كيف شايف انا Link to comment
Professional Posted August 22, 2015 Share Posted August 22, 2015 السلام عليكم ورحمة الله وبركاتهالكود هو عن سرعة السياره ما يضبط , وذا المثال اخذته من الويكي addCommandHandler("setmyspeed", function (player, cmd) local veh = getPedOccupiedVehicle(player) if (veh) then setElementSpeed(veh, "kph", 15) else outputChatBox("You have to sit in vehicle", player) end end ) addCommandHandler ( "setmyspeed" , function ( player ) local veh = getPedOccupiedVehicle(player) if (veh) then setElementSpeed(veh, "kph", 5) else outputChatBox("You have to sit in vehicle", player) end end ) ماني شايف اي غلط انت جربته ؟؟ انت حاطط لما يكتب سبيد مدري وش يشوف اذا لاعب راكب سياره اذا راكب يعطيه اذا مو راكب يقله بشات لي انت كاتبه Link to comment
; Mr.T76eM # Posted August 22, 2015 Share Posted August 22, 2015 وش عاطيه انت ؟؟ عاطيه كود يمكن 10 % من الي طلبه ولسا مو معرف شيئ كيف شايف انا lol , no comment. , useful function في شيء اسمه على حسب كلامك واضح انك بعمرك ما شفته وهي فنكشنات يقدر اي لاعب يسويها ويحطها في الويكي وهي ما تكون معرفه لوحدها لازم يحط الاكواد حقها في اول الـملف setElementSpeed,getElementSpeed وذول الي طرحهن هن اكواد الـ https://wiki.multitheftauto.com/wiki/Useful_Functions Link to comment
H25 Posted August 22, 2015 Share Posted August 22, 2015 function getElementSpeed(theElement, unit) assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") assert(getElementType(theElement) == "player" or getElementType(theElement) == "ped" or getElementType(theElement) == "object" or getElementType(theElement) == "vehicle", "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType(theElement) .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) return (Vector3(getElementVelocity(theElement)).length)*mult end function setElementSpeed(element, unit, speed) if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then local diff = speed/acSpeed if diff ~= diff then return end local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end جربهم عدلت فيهم شي Link to comment
Professional Posted August 22, 2015 Share Posted August 22, 2015 وش عاطيه انت ؟؟ عاطيه كود يمكن 10 % من الي طلبه ولسا مو معرف شيئ كيف شايف انا lol , no comment. , useful function في شيء اسمه على حسب كلامك واضح انك بعمرك ما شفته وهي فنكشنات يقدر اي لاعب يسويها ويحطها في الويكي وهي ما تكون معرفه لوحدها لازم يحط الاكواد حقها في اول الـملف setElementSpeed,getElementSpeed وذول الي طرحهن هن اكواد الـ https://wiki.multitheftauto.com/wiki/Useful_Functions بس هو ما عرفهم Link to comment
; Mr.T76eM # Posted August 22, 2015 Share Posted August 22, 2015 الكود سليم ومافيه اي خطأ لكن unit غير معرف الـ setElementSpeed الخطأ واضح , في كود الكود يصير كذا function getElementSpeed(theElement, unit) assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") assert(getElementType(theElement) == "player" or getElementType(theElement) == "ped" or getElementType(theElement) == "object" or getElementType(theElement) == "vehicle", "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType(theElement) .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) return (Vector3(getElementVelocity(theElement)) * mult).length end function setElementSpeed(element, unit, speed) if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element,1) if (acSpeed~=false) then local diff = speed/acSpeed if diff ~= diff then return end local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end addCommandHandler("setmyspeed", function (Player,cmd, arg1) local veh = getPedOccupiedVehicle(Player) if (veh) then setElementSpeed(veh, "kph",100) else outputChatBox("You have to sit in vehicle",Player) end end ) Link to comment
H25 Posted August 22, 2015 Share Posted August 22, 2015 الكود سليم ومافيه اي خطأ لكنunit غير معرف الـ setElementSpeed الخطأ واضح , في كود الكود يصير كذا function getElementSpeed(theElement, unit) assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") assert(getElementType(theElement) == "player" or getElementType(theElement) == "ped" or getElementType(theElement) == "object" or getElementType(theElement) == "vehicle", "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType(theElement) .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) return (Vector3(getElementVelocity(theElement)) * mult).length end function setElementSpeed(element, unit, speed) if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element,1) if (acSpeed~=false) then local diff = speed/acSpeed if diff ~= diff then return end local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end addCommandHandler("setmyspeed", function (Player,cmd, arg1) local veh = getPedOccupiedVehicle(Player) if (veh) then setElementSpeed(veh, "kph",100) else outputChatBox("You have to sit in vehicle",Player) end end ) موجود خطأ في getElementSpeed return (Vector3(getElementVelocity(theElement)) * mult).length الـ length تستخدم مع الفيكتور فلازم يكون بالشكل return (Vector3(getElementVelocity(theElement)).length)*mult 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