Jump to content

#DRAGON!FIRE

Members
  • Posts

    4,429
  • Joined

  • Last visited

Everything posted by #DRAGON!FIRE

  1. addEventHandler يععتبر من اهم الفنكشنات , يعني مثلأ جيت انت تبي تسوي اي حدث يصير بلأ لعبة لو بسيط زي مثلأ اللاعب تكلم اللاعب خرج زي كذا فـ تضيف الحدث وتسوي كودك فـ تقول مثلأ انت , ابي وقت اللاعب يضغط زر مثلأ تعطيه سلأح , او فلوس اول شي وش تسوي ؟ , وقت يضضغط تجي للفنشكن , وتجيب الحدث حق الضغط وش هو ؟ onClientGUIClick تجي تسوي كذا addEventHandler( "اسم الحدث" , root , function ( ) بتقول وش root ? تعني للكل rootهذي الـ وطبعا لكل حدث سورس , لأحقا تفهم . وبعدين فنكشن , سويت فنكشن جديد ! اي شي ما فهمته , حابب تستفسر عنه , تفضضل
  2. ZombieLimit = get("zombies.MaxZombies")-- HOW MANY ZOMBIES SHOULD EXIST AT MAXIMUM? ZombieStreaming = get("zombies.StreamMethod") -- 1 to constantly stream zombies, 0 to only allow zombies to spawn via createZombie function, 2 to only allow spawning at set spawnpoints ZombiePedSkins = {13,22,56,67,68,69,70,92,97,105,107,108,126,127,128,152,162,167,188,195,206,209,212,229,230,258,264,277,280,287 } --ALTERNATE SKIN LISTS FOR ZOMBIES (SHORTER LIST IS TEXTURED ZOMBIES ONLY) --ZombiePedSkins = {7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,36,37,38,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,75,76,77,78,79,80,81,82,83,85,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,112,113,114,115,116,117,118,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,150,151,152,153,154,155,156,157,158,159,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,209,210,211,212,213,214,215,216,217,218,219,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,275,276,277,278,279,280,281,282,283,284,285,286,287,288 } ZombieSpeed = get("zombies.Speed") if ZombieSpeed == 0 then --super slow zombies (goofy looking) chaseanim = "WALK_drunk" checkspeed = 2000 elseif ZombieSpeed == 1 then -- normal speed chaseanim = "run_old" checkspeed = 1000 elseif ZombieSpeed == 2 then -- rocket zombies (possibly stressful on server) chaseanim = "Run_Wuzi" checkspeed = 680 else -- defaults back to normal chaseanim = "run_old" checkspeed = 1000 end resourceRoot = getResourceRootElement() moancount =0 moanlimit = 10 everyZombie = { } --IDLE BEHAVIOUR OF A ZOMBIE function Zomb_Idle (ped) if isElement(ped) then if ( getElementData ( ped, "status" ) == "idle" ) and ( isPedDead ( ped ) == false ) and (getElementData (ped, "zombie") == true) then local action = math.random( 1, 6 ) if action < 4 then -- walk a random direction local rdmangle = math.random( 1, 359 ) setPedRotation( ped, rdmangle ) setPedAnimation ( ped, "PED", "Player_Sneak", -1, true, true, true) setTimer ( Zomb_Idle, 7000, 1, ped ) elseif action == 4 then -- get on the ground setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, true) setTimer ( Zomb_Idle, 4000, 1, ped ) elseif action == 5 then -- stand still doing nothing setPedAnimation ( ped ) setTimer ( Zomb_Idle, 4000, 1, ped ) end end end end --BEHAVIOUR WHILE CHASING PLAYERS function Zomb_chase (ped, Zx, Zy, Zz ) if isElement(ped) then if (getElementData ( ped, "status" ) == "chasing") and (getElementData (ped, "zombie") == true) then local x, y, z = getElementPosition( ped ) if (getElementData ( ped, "target" ) == nil) and getElementData ( ped, "Tx" ) ~= false then local Px = getElementData ( ped, "Tx" ) local Py = getElementData ( ped, "Ty" ) local Pz = getElementData ( ped, "Tz" ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, x, y, z )) if (Pdistance < 1.5 ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) end end local distance = (getDistanceBetweenPoints3D( x, y, z, Zx, Zy, Zz )) if (distance < 1 ) then -- IF THE PED HASNT MOVED if (getElementData ( ped, "target" ) == nil) then local giveup = math.random( 1, 15 ) if giveup == 1 then setElementData ( ped, "status", "idle" ) else local action = math.random( 1, 2 ) if action == 1 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 3500, 1, ped, x, y, z ) end end else local Ptarget = (getElementData ( ped, "target" )) if isElement(Ptarget) then local Px, Py, Pz = getElementPosition( Ptarget ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz )) if (Pdistance < 1.2 ) then -- ATTACK A PLAYER IF THEY ARE CLOSE if ( isPedDead ( Ptarget ) ) then --EAT A DEAD PLAYER setPedAnimation ( ped ) setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, false) setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 10000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 10000, 1, ped ) zmoan(ped) else local action = math.random( 1, 6 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) else setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) end end else if ( isPedDead (Ptarget) ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 1800, 1, ped ) else local action = math.random( 1, 2 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) end end end else setElementData ( ped, "status", "idle" ) end end else setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true) --KEEP WALKING setTimer ( Zomb_chase, checkspeed, 1, ped, x, y, z ) --CHECK AGAIN end end end end --SET THE DIRECTION OF THE ZOMBIE function setangle () for theKey,ped in ipairs(everyZombie) do if isElement(ped) then if ( getElementData ( ped, "status" ) == "chasing" ) then local x local y local z local px local py local pz if ( getElementData ( ped, "target" ) ~= nil ) then local ptarget = getElementData ( ped, "target" ) if isElement(ptarget) then x, y, z = getElementPosition( ptarget ) px, py, pz = getElementPosition( ped ) else setElementData ( ped, "status", "idle" ) x, y, z = getElementPosition( ped ) px, py, pz = getElementPosition( ped ) end zombangle = ( 360 - math.deg ( math.atan2 ( ( x - px ), ( y - py ) ) ) ) % 360 --MAGIC SPELL TO MAKE PEDS LOOK AT YOU setPedRotation( ped, zombangle ) elseif ( getElementData ( ped, "target" ) == nil ) and (getElementData ( ped, "Tx" ) ~= false) then --IF THE PED IS AFTER THE PLAYERS LAST KNOWN WHEREABOUTS x = getElementData ( ped, "Tx" ) y = getElementData ( ped, "Ty" ) z = getElementData ( ped, "Tz" ) px, py, pz = getElementPosition( ped ) zombangle = ( 360 - math.deg ( math.atan2 ( ( x - px ), ( y - py ) ) ) ) % 360 --MAGIC SPELL TO MAKE PEDS LOOK AT YOU setPedRotation( ped, zombangle ) end end end end end --SETS THE ZOMBIE ACTIVITY WHEN STATUS CHANGES addEventHandler ( "onElementDataChange", getRootElement(), function ( dataName ) if getElementType ( source ) == "ped" and dataName == "status" then if (getElementData (source, "zombie") == true) then if ( isPedDead ( source ) == false ) then if (getElementData ( source, "status" ) == "chasing" ) then local Zx, Zy, Zz = getElementPosition( source ) setTimer ( Zomb_chase, 1000, 1, source, Zx, Zy, Zz ) local newtarget = (getElementData ( source, "target" )) if isElement (newtarget) then if getElementType ( newtarget ) == "player" then setElementSyncer ( source, newtarget ) end end zmoan(source) elseif (getElementData ( source, "status" ) == "idle" ) then setTimer ( Zomb_Idle, 1000, 1, source) elseif (getElementData ( source, "status" ) == "throatslashing" ) then local tx,ty,tz = getElementPosition( source ) local ptarget = getElementData ( source, "target" ) if isElement(ptarget) then local vx,vy,vz = getElementPosition( ptarget ) local zombdistance = (getDistanceBetweenPoints3D (tx, ty, tz, vx, vy, vz)) if (zombdistance < . then zmoan(source) setPedAnimation ( source, "knife", "KILL_Knife_Player", -1, false, false, true) setPedAnimation ( ptarget, "knife", "KILL_Knife_Ped_Damage", -1, false, false, true) setTimer ( Playerthroatbitten, 2300, 1, ptarget, source) setTimer ( function (source) if ( isElement ( source ) ) then setElementData ( source, "status", "idle" ) end end, 5000, 1, source ) else setElementData ( source, "status", "idle" ) end else setElementData ( source, "status", "idle" ) end end elseif (getElementData ( source, "status" ) == "dead" ) then setTimer ( Zomb_delete, 10000, 1, source) end end end end) --RESOURCE START/INITIAL SETUP function outbreak(startedResource) newZombieLimit = get("" .. getResourceName(startedResource) .. ".Zlimit") if newZombieLimit ~= false then if newZombieLimit > ZombieLimit then newZombieLimit = ZombieLimit end else newZombieLimit = ZombieLimit end WoodTimer = setTimer ( WoodSetup, 2000, 1) -- CHECKS FOR BARRIERS if startedResource == getThisResource() then -- call(getResourceFromName("scoreboard"), "scoreboardAddColumn", "Zombie kills") --ADDS TO SCOREBOARD local allplayers = getElementsByType ( "player" ) for pKey,thep in ipairs(allplayers) do setElementData ( thep, "dangercount", 0 ) end local alivePlayers = getAlivePlayers () for playerKey, playerValue in ipairs(alivePlayers) do setElementData ( playerValue, "alreadyspawned", true ) end if ZombieSpeed == 2 then MainTimer1 = setTimer ( setangle, 200, 0) -- KEEPS ZOMBIES FACING THE RIGHT DIRECTION (fast) else MainTimer1 = setTimer ( setangle, 400, 0) -- KEEPS ZOMBIES FACING THE RIGHT DIRECTION end MainTimer3 = setTimer ( clearFarZombies, 3000, 0) --KEEPS ALL THE ZOMBIES CLOSE TO PLAYERS if ZombieStreaming == 1 then MainTimer2 = setTimer ( SpawnZombie, 2500, 0 ) --Spawns zombies in random locations elseif ZombieStreaming == 2 then MainTimer2 = setTimer ( SpawnpointZombie, 2500, 0 ) --spawns zombies in zombie spawnpoints end end end addEventHandler("onResourceStart", getRootElement(), outbreak) function player_Connect() setElementData ( source, "dangercount", 0 ) end addEventHandler ( "onPlayerConnect", getRootElement(), player_Connect )
  3. # هذا ببساطة يسوي حدث جديد ...
  4. اعرفهم بس ليش الاند ما يجون تحت بعض ؟؟ مثال local Model = --- ايدي الشخصيةة addEventHandler ( "onClientPlayerDamage", localPlayer, function ( attacker _,_ ) if attacker and attacker ~= source then if ( getElementModel ( source ) == Model ) then cancelEvent( true ) end -- شوف الاند end -- شوف الاند هنا كل وحده بجهة end -- مالهم تحت بعض ) # انا احب احط الاندات كذا فـ كوداتي , ولأ تقدر تحطهم بأي شكل تبيه ما في فرق وكل من ... if do function ياخخذ اند .
  5. AircraftIdSpawn = { { 1430.9000244141,596.09997558594,14 }, } local base = createBlip (1384.30298,581.37543,10.91094) setBlipVisibleDistance (base, 30) local groupName = '[MFA]' output = function( text, element, r, g, b, vaule ) exports["guimessages"]:outputServer(element, text, r, g, b) end function start() end addEventHandler('onResourceStart', resourceRoot, start) function mm() end onAbadyWasted = function() if getElementData ( source , "Group" ) == groupName then function sp( source ) setElementPosition( source, 1384.70386,548.67749,1008.09998 ) setElementInterior ( source, 0 ) setElementDimension ( source, 0 ) setPedSkin( source, 230 ) setPedArmor( source, 100 ) end setTimer(sp,1000,1,source) end end addEventHandler ( "onPlayerSpawn", getRootElement(), onAbadyWasted ) TableCars = {} addEvent('gvoa', true) addEventHandler('gvoa', root, function( nameCar ) if isElement( TableCars[source] ) then destroyElement( TableCars[source] ) end local id = getVehicleIDFromName( nameCar ) if id == 487 or id == 425 or id == 548 or id == 520 or id == 469 then local x, y, z = unpack( AircraftIdSpawn[math.random(#AircraftIdSpawn)] ) TableCars[source] = createVehicle( id, x, y, z ) if not TableCars[source] then return end warpPedIntoVehicle ( source, TableCars[source] ) return end local x,y,z = getElementPosition( source ) TableCars[source] = createVehicle( id, x, y, z ) if not TableCars[source] then return end warpPedIntoVehicle ( source, TableCars[source] ) addVehicleUpgrade(TableCars[source], 1147) addVehicleUpgrade(TableCars[source], 1041) addVehicleUpgrade(TableCars[source], 1035) addVehicleUpgrade(TableCars[source], 1010) addVehicleUpgrade(TableCars[source], 1087) addVehicleUpgrade(TableCars[source], 1171) addVehicleUpgrade(TableCars[source], 1149) setVehiclePaintjob(TableCars[source], 1) end ) addEventHandler('onPlayerQuit', root, function() if isElement( TableCars[source] ) then destroyElement( TableCars[source] ) end end ) addEventHandler( "onVehicleStartEnter", resourceRoot, function(thepla) if getElementData(thepla, "Group") == groupName then outputChatBox( "** Welcome To Groups Car", thepla, 255, 0, 0, true ) else cancelEvent( ) outputChatBox( "** This Vehicle For Group [ MFA ]", thepla, 255, 0, 0, true ) end end )
  6. # طارح مود كامل بنك وش يدرينا فيهه . , وكلأمه مهو مفهوم
  7. local TableV = {}; local ID = 605 --- أيدي السيارة addEventHandler( "onPlayerChat", root, function ( msg ) if ( msg and msg == "موتر" ) then if isElement(TableV[source]) then destroyElement(TableV[source]) end local x, y, z = getElementPosition ( source ) TableV[source] = createVehicle( ID, x + 3, y, z ) if ( TableV[source] ) then warpPedIntoVehicle ( source, TableV[source] ) outputChatBox("** You Have Get Vehicle .",source,255,255,0,true) end end end )
  8. جحجرب addEventHandler( "onClientPlayerJoin", root, function ( ) showCursor( true ) fadeCamera( false ) showChat( false ) sound = playSound( "sound.mp3", true ) end )
  9. # الحين وش مشكلتك , وقت يدخل اللاعب ما يجي بـ الشات البلد حقهه ؟
  10. # مدامك تعرف انه ما لك خبرة بـ البرمجة , ليه تحط الكود ؟ الكود غلطط ي عزيزي .....
  11. ممثال بسيط addEventHandler( "onClientGUIClick", root, function ( ) if ( source == Button ) then fadeCamera ( false, 0.5 ) end end ) ................................ ججرب . addEventHandler( "onClientResourceStart", resourceRoot, function ( ) showCursor( true ) fadeCamera( false ) showChat( false ) sound = playSound( "sound.mp3", true ) end )
  12. هي سلسلة نصيةة string الـ يعني مثلأ انت سويت سلسلة نصية زي كذا مثلأ local Text = "Hi" string والسترنق له اكثر من فنكشن خاصة بـ من بعض الفنكشنات .... : string * .......... string.find string.len string.rep string.lower ; الخخ .... كثيرة وعديدة , وكل وحدة لها وظيفتها الخاصةة .
  13. # ججرب , لو ما اشتغل المشكلة من عندك ... Client Side ! wnd = guiCreateWindow(237,154,382,294,"",false) Edits = guiCreateEdit(116,54,120,36,"",false,wnd) ok = guiCreateButton(105,114,148,31,"",false,wnd) guiSetVisible(wnd, false) bindKey ( "F2", "down", function( ) guiSetVisible(wnd, not guiGetVisible( wnd )); showCursor( guiGetVisible( wnd ) ); end ) addEventHandler("onClientGUIClick", root, function ( ) if ( source == ok ) then local ZA7F = guiGetText( Edits ) if ( ZA7F and string.len( ZA7F ) == 3 and tonumber( ZA7F ) ) then triggerServerEvent("Car", localPlayer, tonumber ( ZA7F )) end end end ) Server Side ! addEvent("Car", true) addEventHandler("Car", root, function (id) local x, y, z = getElementPosition(source) vehicle = createVehicle ( id, x+ 3, y, z ) if vehicle then warpPedIntoVehicle ( source, vehicle ) end end ) addEventHandler("onVehicleStartEnter", vehicle, function ( player ) if getPlayerSerial ( player ) == "سيريالك" then outputChatBox("Welome Sir", player, 255, 255, 0) else cancelEvent () outputChatBox("This not your car this is اسمك's car", player, 255, 0, 0) end end )
  14. طيب ما اقدر اخليه بمنطقه او ساحه انا اصممها وما يخرجون منها ؟؟ غير مود احمد فيف لان مكان االساحه الي بمود احمد فيف ما عجبني # لأ ولله , لأنه المممود معقد جدا يبي له واحد خبرة عاليةة جدأ , او صاحب المود نفسه يقدر يسوي لك كذا
  15. # ججرب wnd = guiCreateWindow(237,154,382,294,"",false) Edits = guiCreateEdit(116,54,120,36,"",false,wnd) ok = guiCreateButton(105,114,148,31,"",false,wnd) guiSetVisible(wnd, false) bindKey("F2","Down",function() if ( guiGetVisible(wnd) == true ) then guiSetVisible(wnd, false); showCursor( false ); guiSetInputEnabled( false ); else guiSetVisible(wnd, true); showCursor( true ); guiSetInputEnabled( true ); end end) addEventHandler("onClientGUIClick", root, function ( ) if ( source == ok ) then local ZA7F = guiGetText( Edits ) if ( ZA7F and string.len( ZA7F ) == 3 ) then if ( ZA7F and tonumber ( ZA7F ) ) then triggerServerEvent("Car", localPlayer, guiGetText(Edits)) end end end end )
  16. # لو تقصصد انه اغنية الـ ماب , فـ هذا الكود ... Client Side ! local Time = 2000 ---- | الوقت اللي بعده يسحب الصوت . , بـ الميلي ثانيةة طبعأ addEventHandler( "onClientMapStarting", root, function (mapInfo) for _,theson in ipairs(getElementsByType("sound")) do if ( isElement(theson) ) then if ( Time ) then setTimer ( setSoundVolume, Time, 1, theson, 0 ) end end end end )
  17. اوك , مع انه اشوفه ما فيه مشاكل
  18. سلأمات ؟ , انت صاحي ؟ اقصد زي كذا .. marker = createMarker( ... ) addEventHandler( "onMarkerHit", marker, function ( element ) if ( getElementType ( element ) == "vehicle" ) then if ( getElementData ( getVehicleController ( element ) , "gang" ) == "ARMY" ) then if ( getElementHealth ( element ) < 100 ) then local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) setVehicleColor( element, r, g, b ) fixVehicle ( element ) addVehicleUpgrade ( element, 1010 ) setVehiclePaintjob ( element, 2 ) end end end end )
  19. ججرب ... , ولأ تنسا تححط الاحداثيات الصحيحةة . local GUIEditor = { window = {}, gridlist = {}, button = {} } local text = { { 'الدائري' }, } local Warp = { [ 'الدائري' ] = { x, y, z }, } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(404, 194, 266, 407, "انتقالات", false) guiSetVisible(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) GUIEditor.gridlist[1] = guiCreateGridList( 9, 24, 328, 316, false, GUIEditor.window[1]) guiGridListAddColumn( GUIEditor.gridlist[1], "Warp", 0.9 ) for _,v in ipairs ( text ) do guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, v [ 1 ],false,false ) end GUIEditor.button[1] = guiCreateButton(65, 344, 140, 54, "=[ Go ]=", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF67F509") end ) bindKey("F2","down",function ( ) guiSetVisible(GUIEditor.window[1],not guiGetVisible(GUIEditor.window[1])) showCursor(guiGetVisible(GUIEditor.window[1])) end) addEventHandler("onClientGUIClick",root,function ( ) local Pos = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) if ( source == GUIEditor.button[1] ) then if ( Pos and Pos ~= '' ) then setElementPosition(localPlayer, Warp [ Pos ] [ 1 ], Warp [ Pos ] [ 2 ], Warp [ Pos ] [ 3 ]) guiSetVisible(GUIEditor.window[1], false) end end end )
×
×
  • Create New...