yaza034 Posted December 6, 2013 Share Posted December 6, 2013 (edited) هل ذا الكود صح او خطأ وارجوا تصحيح الخطأ ذا الكود الخاص بالعالم الوهمي صح ! معي مود سباق وابي يروح للعالم الوهمي دورت فيالموقع واعملت كذا marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255 ] ) function onPlayerTarget ( targetElem ) -- if the targeted object is a haystack (an object with model ID 3374) remove it from the game if getElementType ( targetElem ) == "object" and getElementModel ( targetElem ) == 3374 then destroyElement ( targetElem ) end end addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTarget ) -- add above function as handler for targeting event function onPlayerEnterVehicle ( theVehicle, seat, jacked ) if ( getElementDimension ( source ) == 0 ) then -- if the player is in dimension 0 setElementDimension ( source, 1 ) -- set his dimension to 1 setElementDimension ( theVehicle, 1 ) -- set his vehicle's dimension to 1 as well end end addEventHandler ( "onPlayerVehicleEnter", getRootElement ( ), onPlayerEnterVehicle ) function onPlayerExitVehicle ( theVehicle, seat, jacker ) if ( getElementDimension ( source ) == 1 ) then -- if the player is in dimension 1 setElementDimension ( source, 0 ) -- set his dimension back to 0 setElementDimension ( theVehicle, 0 ) -- set his vehicle's dimension back to 0 as well end end addEventHandler ( "onPlayerVehicleExit", getRootElement ( ), onPlayerExitVehicle ) function onPlayerEnterVehicle ( theVehicle, seat, jacked ) if ( getElementDimension ( source ) == 0 and seat == 0 ) then -- if the player is in dimension 0 and is entering the driver seat setElementDimension ( source, 1 ) -- set his dimension to 1 setElementDimension ( theVehicle, 1 ) -- set his vehicle's dimension to 1 as well end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), onPlayerEnterVehicle ) function onPlayerExitVehicle ( theVehicle, seat, jacker ) if ( getElementDimension ( source ) == 1 and seat == 0 ) then -- if the player is in dimension 1 and was in the driver's seat setElementDimension ( source, 0 ) -- set his dimension back to 0 setElementDimension ( theVehicle, 0 ) -- set his vehicle's dimension back to 0 as well end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), onPlayerExitVehicle ) Edited December 6, 2013 by Guest Link to comment
The Killer Posted December 6, 2013 Share Posted December 6, 2013 انت الحين مجمع اكودا مع بعض وحاط لي ماركر وما دري وش وش تبي تسوي بالضبط ؟ Link to comment
#DRAGON!FIRE Posted December 6, 2013 Share Posted December 6, 2013 # نسخ لصق من الويكي وما تدري عن شي وش تبي تسوي انت ؟ Link to comment
yaza034 Posted December 6, 2013 Author Share Posted December 6, 2013 اعملت مود السباق بس ناقصني انة لما يطيح في الماء يموت واذا كلك انتر يموت مثل الريس لكن انا راح ادخلها في play وذا الكود لما يكتب الاعب سباق يروح لمكان حطيتة لكن ابية يروح للمكان الوهمي :@ :@ :@ :@ :@ :@ :@ "انا فاشل" Link to comment
The Killer Posted December 6, 2013 Share Posted December 6, 2013 (edited) isElementInWater killPed -- الزر # bindKey killPed Edit # جرب كود عناد عدلت عليه Race = { Players = { }; Vehicles = { }; Position = { [1] = { x, y, z }; [2] = { x, y, z }; [3] = { x, y, z }; [4] = { x, y, z }; [5] = { x, y, z }; }; Cars = { { 432 }; { 432 }; }; }; setRaceStats = function ( stats ) if stats then setElementData ( resourceRoot, "RaceStarted", true ) else Race.Players = 0 setElementData ( resourceRoot, "RaceStarted", false ) outputChatBox ( "* تم إفتتاح السباق", root, 255, 255, 0, true ) end end addEventHandler ( "onPlayerChat", root, function ( msg ) if string.find ( msg, "سباق" ) then if getElementData ( resourceRoot, "RaceStarted" ) then return outputChatBox ( "* لم ينتهي السباق بعد", source, 255, 0, 0, true ) end if Race.Players < 5 then if not Race.Vehicles[source] then if Race.Players == 4 then setRaceStats ( true ) end Race.Players = Race.Players+1 Race.Vehicles[source] = createVehicle ( Race.Cars[math.random(#Race.Cars)][1], Race.Position[Race.Players][1], Race.Position[Race.Players][2], Race.Position[Race.Players][3] ) setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] ) setElementDimension( Race.Vehicles[source], 1) setElementDimension( source, 1) setElementData ( Race.Vehicles[source], "Owner", source ) end else outputChatBox ( "* أكتمل العدد", source, 255, 0, 0, true ) end end end ) addEventHandler ( "onVehicleExplode", resourceRoot, function ( ) if Race.Players == 1 then local player = getElementData ( source, "Owner" ) if isElement ( player ) then if getElementData ( resourceRoot, "RaceStarted" ) then givePlayerMoney ( player, 5000 ) outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) end Race.Vehicles[player] = nil end setTimer ( setRaceStats, 2000, 1, false ) else Race.Players = Race.Players-1 end end ) addEventHandler ( "onElementDestroy", resourceRoot, function ( ) if getElementType ( source ) == "vehicle" then if Race.Players == 1 then local player = getElementData ( source, "Owner" ) if isElement ( player ) then if getElementData ( resourceRoot, "RaceStarted" ) then givePlayerMoney ( player, 5000 ) outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) end Race.Vehicles[player] = nil end setTimer ( setRaceStats, 2000, 1, false ) else Race.Players = Race.Players-1 end end end ) addEventHandler ( "onPlayerQuit", root, function ( ) if Race.Vehicles[source] then if isElement ( Race.Vehicles[source] ) then destroyElement ( Race.Vehicles[source] ) else if Race.Players == 1 then setTimer ( setRaceStats, 2000, 1, false ) else Race.Players = Race.Players-1 end end Race.Vehicles[source] = nil end end ) setRaceStats ( false ) Edited December 6, 2013 by Guest Link to comment
#DRAGON!FIRE Posted December 6, 2013 Share Posted December 6, 2013 isElementInWater killPlayer -- الزر # bindKey killPlayer bindKey onClientKey # اعتقد انه يححتاج ذا . Link to comment
K1NG Posted December 6, 2013 Share Posted December 6, 2013 isElementInWater killPlayer -- الزر # bindKey killPlayer Edit # جرب كود عناد عدلت عليه Race = { Players = { }; Vehicles = { }; Position = { [1] = { x, y, z }; [2] = { x, y, z }; [3] = { x, y, z }; [4] = { x, y, z }; [5] = { x, y, z }; }; Cars = { { 432 }; { 432 }; }; }; setRaceStats = function ( stats ) if stats then setElementData ( resourceRoot, "RaceStarted", true ) else Race.Players = 0 setElementData ( resourceRoot, "RaceStarted", false ) outputChatBox ( "* تم إفتتاح السباق", root, 255, 255, 0, true ) end end addEventHandler ( "onPlayerChat", root, function ( msg ) if string.find ( msg, "سباق" ) then if getElementData ( resourceRoot, "RaceStarted" ) then return outputChatBox ( "* لم ينتهي السباق بعد", source, 255, 0, 0, true ) end if Race.Players < 5 then if not Race.Vehicles[source] then if Race.Players == 4 then setRaceStats ( true ) end Race.Players = Race.Players+1 Race.Vehicles[source] = createVehicle ( Race.Cars[math.random(#Race.Cars)][1], Race.Position[Race.Players][1], Race.Position[Race.Players][2], Race.Position[Race.Players][3] ) setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] ) setElementDimension( Race.Vehicles[source], 1) setElementDimension( source, 1) setElementData ( Race.Vehicles[source], "Owner", source ) end else outputChatBox ( "* أكتمل العدد", source, 255, 0, 0, true ) end end end ) addEventHandler ( "onVehicleExplode", resourceRoot, function ( ) if Race.Players == 1 then local player = getElementData ( source, "Owner" ) if isElement ( player ) then if getElementData ( resourceRoot, "RaceStarted" ) then givePlayerMoney ( player, 5000 ) outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) end Race.Vehicles[player] = nil end setTimer ( setRaceStats, 2000, 1, false ) else Race.Players = Race.Players-1 end end ) addEventHandler ( "onElementDestroy", resourceRoot, function ( ) if getElementType ( source ) == "vehicle" then if Race.Players == 1 then local player = getElementData ( source, "Owner" ) if isElement ( player ) then if getElementData ( resourceRoot, "RaceStarted" ) then givePlayerMoney ( player, 5000 ) outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) end Race.Vehicles[player] = nil end setTimer ( setRaceStats, 2000, 1, false ) else Race.Players = Race.Players-1 end end end ) addEventHandler ( "onPlayerQuit", root, function ( ) if Race.Vehicles[source] then if isElement ( Race.Vehicles[source] ) then destroyElement ( Race.Vehicles[source] ) else if Race.Players == 1 then setTimer ( setRaceStats, 2000, 1, false ) else Race.Players = Race.Players-1 end end Race.Vehicles[source] = nil end end ) setRaceStats ( false ) killPlayer > killPed isElementInWater killPlayer -- الزر # bindKey killPlayer bindKey onClientKey # اعتقد انه يححتاج ذا . onClientKey > onPlayerVehicleExit Link to comment
#DRAGON!FIRE Posted December 6, 2013 Share Posted December 6, 2013 isElementInWater killPlayer -- الزر # bindKey killPlayer Edit # جرب كود عناد عدلت عليه Race = { Players = { }; Vehicles = { }; Position = { [1] = { x, y, z }; [2] = { x, y, z }; [3] = { x, y, z }; [4] = { x, y, z }; [5] = { x, y, z }; }; Cars = { { 432 }; { 432 }; }; }; setRaceStats = function ( stats ) if stats then setElementData ( resourceRoot, "RaceStarted", true ) else Race.Players = 0 setElementData ( resourceRoot, "RaceStarted", false ) outputChatBox ( "* تم إفتتاح السباق", root, 255, 255, 0, true ) end end addEventHandler ( "onPlayerChat", root, function ( msg ) if string.find ( msg, "سباق" ) then if getElementData ( resourceRoot, "RaceStarted" ) then return outputChatBox ( "* لم ينتهي السباق بعد", source, 255, 0, 0, true ) end if Race.Players < 5 then if not Race.Vehicles[source] then if Race.Players == 4 then setRaceStats ( true ) end Race.Players = Race.Players+1 Race.Vehicles[source] = createVehicle ( Race.Cars[math.random(#Race.Cars)][1], Race.Position[Race.Players][1], Race.Position[Race.Players][2], Race.Position[Race.Players][3] ) setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] ) setElementDimension( Race.Vehicles[source], 1) setElementDimension( source, 1) setElementData ( Race.Vehicles[source], "Owner", source ) end else outputChatBox ( "* أكتمل العدد", source, 255, 0, 0, true ) end end end ) addEventHandler ( "onVehicleExplode", resourceRoot, function ( ) if Race.Players == 1 then local player = getElementData ( source, "Owner" ) if isElement ( player ) then if getElementData ( resourceRoot, "RaceStarted" ) then givePlayerMoney ( player, 5000 ) outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) end Race.Vehicles[player] = nil end setTimer ( setRaceStats, 2000, 1, false ) else Race.Players = Race.Players-1 end end ) addEventHandler ( "onElementDestroy", resourceRoot, function ( ) if getElementType ( source ) == "vehicle" then if Race.Players == 1 then local player = getElementData ( source, "Owner" ) if isElement ( player ) then if getElementData ( resourceRoot, "RaceStarted" ) then givePlayerMoney ( player, 5000 ) outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) end Race.Vehicles[player] = nil end setTimer ( setRaceStats, 2000, 1, false ) else Race.Players = Race.Players-1 end end end ) addEventHandler ( "onPlayerQuit", root, function ( ) if Race.Vehicles[source] then if isElement ( Race.Vehicles[source] ) then destroyElement ( Race.Vehicles[source] ) else if Race.Players == 1 then setTimer ( setRaceStats, 2000, 1, false ) else Race.Players = Race.Players-1 end end Race.Vehicles[source] = nil end end ) setRaceStats ( false ) killPlayer > killPed isElementInWater killPlayer -- الزر # bindKey killPlayer bindKey onClientKey # اعتقد انه يححتاج ذا . onClientKey > onPlayerVehicleExit # يوه , كيف نسيت الحدث . ^ Link to comment
The Killer Posted December 6, 2013 Share Posted December 6, 2013 هو نفسه حدث "onClientKey" كيف يعني نسيت الحدث ؟ وبعدين طريقة كنق صح والطريقه الي قلتها انت صح بعد بس الافضل طريقة كنق لأنها تختصر لك زرين بزر يعني بدال ما تستخدم "onClientKey" على زر 'Enter' 'F' تستخدم طريقة كنق Link to comment
#DRAGON!FIRE Posted December 6, 2013 Share Posted December 6, 2013 هو نفسه حدث"onClientKey" كيف يعني نسيت الحدث ؟ وبعدين طريقة كنق صح والطريقه الي قلتها انت صح بعد بس الافضل طريقة كنق لأنها تختصر لك زرين بزر يعني بدال ما تستخدم "onClientKey" على زر 'Enter' 'F' تستخدم طريقة كنق # نسيته يعني راح عن بالي ^ بعدين كيف نفسها ؟ , ذاك يسوي لك زر جديد بـ فنكشن وقت يضغطته onClientKey : " وقت يضضغط على زر محدد " Link to comment
The Killer Posted December 6, 2013 Share Posted December 6, 2013 شف راح اعطيك مثال addEventHandler( "onClientKey", root, function(button) if button == "enter" then setElementHealth(localPlayer,100) end end ) Link to comment
yaza034 Posted December 6, 2013 Author Share Posted December 6, 2013 ما قصرتوا شباب يعطيكوا العافية Link to comment
yaza034 Posted December 6, 2013 Author Share Posted December 6, 2013 ذا كيل بس اريد ان اعرف كيف احط الاكواد من الويكي احطها مع بعض ولا كل ملف في LUA ؟؟ Link to comment
The Killer Posted December 6, 2013 Share Posted December 6, 2013 اكواد الويكي هي امثله انت تستفيد منها يعني مثلا عندك كود محدد تبي تعرفه تكتبه في الويكي ويعطيك مثال عليه وتعرف طريقته وتفهمه عشان تقدر تستخدمه هذا هو الويكي مو بس تدخل الويكي تحسب هو كل شي تنسخه وتلصقه لا هذا الويكي عشان يساعدك في البرمجه لو عندك كود ما تعرفه او ما تعرف طريقته تروح الويكي ويساعدك بالتوفيق Link to comment
yaza034 Posted December 6, 2013 Author Share Posted December 6, 2013 اي يعني مو نسخ لصق يلا منتعلم اخوي ذا كيلل لو في حد يعلمني كان سويت كلشي بس ما في حد يعلم :@ Link to comment
The Killer Posted December 6, 2013 Share Posted December 6, 2013 تعليم البرمجه يكون بمساعده منك انت انك تدخل الويكي وقلب فيه وتبدا بالاكواد الصغيره تعرفها زين وتعرف تكون كود صغير حتى ولو خطأ بس مو يكون هريسه وحنا بنساعدك بس البرمجه مو بين يوم وليله بتتعلمها لازم لها وقت فاضي لغتك الانجليزيه كويسه+ و زي ما قلت لك تبدا بالاكواد الصغيره وتعرفها ومن صغير الا كبير وروح قسم شروحات البرمجه راح يساعدك في بعض الاشياء بالتوفيق Link to comment
yaza034 Posted December 7, 2013 Author Share Posted December 7, 2013 انشالله اصير مبرمج مثلك ومثل عناد ومثل كل محترف في البرمجة وشكراً على النصيحة اي انا اعرف انجلزي 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