EH10 Posted December 28, 2013 Share Posted December 28, 2013 السلام عليكم ابي فنكشات ازا شغلت المود بينتظر 10 ثواني ويجي بالشات للدخول الى الديربي اكتب ديربي ولما يكتب يقول بالشات انت الان منضم للديربي واذا كتب ثاني مره انت منظم الى الديربي لايمكنك الدخول مره اخرا بعدين لين يدخلون ناس ويبدا بعد 20 ثانية وينقلنا للماب والي يطيح بالماء يموت واخر واحد يبقى يموت ويعطونة الجائزه ويطلع بالشات فاز وربح 8000000 مليون aBo6YeF هاذا الاعب واذا واحد كتب والديربي يلعبون فية يقول انتظر حتى ينتهي الديربي ولما ينتهي يجي بالشات بعد 10 ثواني للدخول الى الديربي اكتب ديربي ولما اكتب يققول انت منظم الى الديربي الان انتظر قليلا واذا ماحد دخل بعد 30 ثانية يقول انهتى الديربي لعدم توفر الاعبين ازا ممــكــن أشــرحـولــي الفـنـكـشـآآآآآآآت مــِشــآن أعــرف بـعـضـهـن أقــول لـيـة أسـتـخـدم هاد ازا ممككن Link to comment
al-Kobra Posted December 28, 2013 Share Posted December 28, 2013 جرب ورد خبر 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 }; }; }; local Timer 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 checkPlayers = function ( ) if Race.Players < 2 then for i, v in ipairs ( Race.Vehicles ) do local player = getElementData ( v, "Owner" ) if player then killPed ( player ) end destroyElement ( v ) end outputChatBox ( "* تم إلغاء السباق بسبب قلة اللاعبين", root, 255, 0, 0, true ) end end getPlayerVehicle = function ( element ) if element then local type = getElementType if type ( element ) == "player" or type ( element ) == "ped" then if isPedInVehicle ( element ) then local vehicle = getPedOccupiedVehicle ( element ) if getVehicleController ( vehicle ) == element then return vehicle end return false end return false end return false end return false 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 Race.Players = Race.Players+1 if Race.Players == 5 then setRaceStats ( true ) if isTimer ( Timer ) then killTimer ( Timer ) end else if not isTimer ( Timer ) then Timer = setTimer ( checkPlayers, 60000, 1 ) end end 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] ) setElementDimension ( Race.Vehicles[source], 1 ) setElementDimension ( source, 1 ) setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] ) 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 ) addEventHandler ( "onVehicleExit", resourceRoot, function ( player ) if getVehicleController ( source ) == player then killPed ( player ) destroyElement ( source ) end end ) addEventHandler ( "onPlayerWasted", root, function ( ) local vehicle = getPlayerVehicle ( source ) if vehicle then local player = getElementData ( vehicle, "Owner" ) if player then if player == source then destroyElement ( vehicle ) end end end end ) setTimer ( function ( ) for _,v in ipairs(Race.Vehicles) do if isElement( v ) and isElementInWater( v ) then killPed ( getVehicleController( v ) ) destroyElement ( v ) end end end, 1000, 0 ) setRaceStats ( false ) عدل عليه Link to comment
EH10 Posted December 28, 2013 Author Share Posted December 28, 2013 جرب ورد خبر 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 }; }; }; local Timer 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 checkPlayers = function ( ) if Race.Players < 2 then for i, v in ipairs ( Race.Vehicles ) do local player = getElementData ( v, "Owner" ) if player then killPed ( player ) end destroyElement ( v ) end outputChatBox ( "* تم إلغاء السباق بسبب قلة اللاعبين", root, 255, 0, 0, true ) end end getPlayerVehicle = function ( element ) if element then local type = getElementType if type ( element ) == "player" or type ( element ) == "ped" then if isPedInVehicle ( element ) then local vehicle = getPedOccupiedVehicle ( element ) if getVehicleController ( vehicle ) == element then return vehicle end return false end return false end return false end return false 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 Race.Players = Race.Players+1 if Race.Players == 5 then setRaceStats ( true ) if isTimer ( Timer ) then killTimer ( Timer ) end else if not isTimer ( Timer ) then Timer = setTimer ( checkPlayers, 60000, 1 ) end end 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] ) setElementDimension ( Race.Vehicles[source], 1 ) setElementDimension ( source, 1 ) setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] ) 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 ) addEventHandler ( "onVehicleExit", resourceRoot, function ( player ) if getVehicleController ( source ) == player then killPed ( player ) destroyElement ( source ) end end ) addEventHandler ( "onPlayerWasted", root, function ( ) local vehicle = getPlayerVehicle ( source ) if vehicle then local player = getElementData ( vehicle, "Owner" ) if player then if player == source then destroyElement ( vehicle ) end end end end ) setTimer ( function ( ) for _,v in ipairs(Race.Vehicles) do if isElement( v ) and isElementInWater( v ) then killPed ( getVehicleController( v ) ) destroyElement ( v ) end end end, 1000, 0 ) setRaceStats ( false ) عدل عليه انا مابي كود جاهز انسخ ولصق وعدل واحط By aBo 6YeF ابي اسويه انا لو نسخ لصق ماتعلم او نسخ لصق وتعديل Link to comment
arbna.us Posted December 28, 2013 Share Posted December 28, 2013 ممكن سوال ذحين ذي وش قصدك بها Level in Scripting : 26% أنا أشوف طلباتك سهلة يا أخي خله كذا Level in Scripting : 10% Link to comment
EH10 Posted December 28, 2013 Author Share Posted December 28, 2013 ممكن سوال ذحين ذي وش قصدك بهاLevel in Scripting : 26% أنا أشوف طلباتك سهلة يا أخي خله كذا Level in Scripting : 10% حد سئلك انت اشوفك 25 ياخي لو يجي 4 مشان يجي 10 Link to comment
The Killer Posted December 28, 2013 Share Posted December 28, 2013 Event # 'onResourceStart' function # outputChatBox االسباق Event # 'onPlayerChat' function # createMarker isElementWithinMarker outputChatBox else table loop string.find createVehicle warpPedIntoVehicle 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