Dr.Xen Posted December 28, 2013 Share Posted December 28, 2013 السلام عليكم ورحمة الله وبركاتهه كيفكم ي حلوين ... بخير ان شاء الله انا سويت كود يعني اخذت من الاخ ويكي اذا في خطا ابيكم تصححوو server function consoleCreateMarker ( thePlayer, commandName ) if ( thePlayer ) then local x, y, z = getElementPosition ( thePlayer ) -- get the player's position -- create a cylindrical marker next to the player: local theMarker = createMarker ( x + 2, y + 2, z, "cylinder", 1.5, 255, 255, 0, 170 ) if ( theMarker ) then -- check if the marker was created successfully outputConsole ( "Marker created successfully", thePlayer ) else outputConsole ( "Failed to create marker", thePlayer ) end end end addCommandHandler ( "createmarker", consoleCreateMarker ) 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 ) function scriptOnTrailerAttach ( towedBy ) thePlayer = getVehicleController ( source ) -- get the controller of the towing vehicle if ( thePlayer ) then outputChatBox ( getPlayerName ( thePlayer ).. " attached a trailer" ) else outputChatBox ( "trailer attached" ) end end addEventHandler ( "onTrailerAttach", getRootElement(), scriptOnTrailerAttach ) function joinTime ( ) setElementData ( source, "joinTime", getTickCount() ) -- Store the current tick count in the player's data with the key 'joinTime' end -- Make our 'joinTime' function be called when a player joins addEventHandler ( "onPlayerJoin", getRootElement(), joinTime ) function showJoinTime ( source, commandName, playerName ) if ( playerName ) then -- see if a player was specified thePlayer = getPlayerFromName ( playerName ) -- get the player element for the specified player if ( thePlayer ) then -- if one was found... local timeOnline = (getTickCount() - getElementData ( thePlayer, "joinTime" )) / 1000 -- calculates the time since join outputChatBox ( getPlayerName ( thePlayer ).." joined "..timeOnline.." seconds ago", source ) -- output the player's join time else outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) -- display an error end else -- display when the player who used the function joined and inform how to see other people's join time local timeOnline = (getTickCount() - getElementData ( source, "joinTime" )) / 1000 -- calculate the time since join outputChatBox ( "You joined " ..timeOnline.." seconds ago", source ) outputChatBox ( "Use 'join_time ' to see other people's join time", source ) end end -- Add a console command joinTime, that takes an optional parameter of a player's name addCommandHandler ( "joinTime", showJoinTime ) function onPlayerTargeted ( targetElem ) if ( getElementType ( targetElem ) == "object" ) and ( getElementModel ( targetElem ) == 3374 ) then destroyElement ( targetElem ) end end addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTargeted ) -- define the handler function for our command function consoleAddUpgrade ( thePlayer, commandName, id ) -- make sure the player is in a vehicle if ( isPedInVehicle ( thePlayer ) ) then -- convert the given ID from a string to a number local id = tonumber ( id ) -- get the player's vehicle local theVehicle = getPedOccupiedVehicle ( thePlayer ) -- add the requested upgrade to the vehicle local success = addVehicleUpgrade ( theVehicle, id ) -- inform the player of whether the upgrade was added successfully if ( success ) then outputConsole ( getVehicleUpgradeSlotName ( id ) .. " upgrade added.", thePlayer ) else outputConsole ( "Failed to add upgrade.", thePlayer ) end else outputConsole ( "You must be in a vehicle!", thePlayer ) end end -- add the function as a handler for the "addupgrade" command addCommandHandler ( "addupgrade", consoleAddUpgrade ) Clinet addCommandHandler("marker", -- Type In Console 'marker' To Create The Marker function ( player, commandName ) local x,y,z = getElementPosition ( player ) -- Get The Player's Position local Marker = createMarker(x,y,z-1, "cylinder", 2, 255, 0, 0) -- Create Marker To The Position Of Player end ) function planeEnter ( theVehicle, seat, jacked ) -- when someone enters a vehicle local id = getElementModel ( theVehicle ) -- get the model ID of the vehicle if id == 519 or id == 577 then -- if theVehicle is either Shamal or AT-400 local vehicleName = getVehicleName ( theVehicle ) -- get the name of theVehicle outputChatBox ( "Someone stole a " .. vehicleName .. "!" ) -- announce that someone stole the plane end end -- add the event handler to the event addEventHandler ( "onPlayerVehicleEnter", getRootElement(), planeEnter ) -- create a collision shape local nitroColShape = createColSphere ( 1337, 100, 12, 2 ) -- attach the collision shape to an 'onClientColShapeHit' event function onNitroColShapeHit ( hitElement, matchingDimension ) if ( getElementType ( hitElement ) == "vehicle" ) then -- add a nitro upgrade if the element that hit the colshape is a vehicle addVehicleUpgrade ( hitElement, 1010 ) end end addEventHandler ( "onClientColShapeHit", nitroColShape, onNitroColShapeHit ) newvehicle = createVehicle ( 560, 100, 100, 40 ) setVehiclePaintjob ( newvehicle, 2 ) end end ) وجزاكم الله خير @! Link to comment
EH10 Posted December 28, 2013 Share Posted December 28, 2013 الامثلة الي بالويكي ماهي اكواد هاذا مثال على الكود مشان تفهم الكود هريسة وش نصلح وهو خبص وهريسة Link to comment
Dr.Xen Posted December 28, 2013 Author Share Posted December 28, 2013 مدري وش سويت انا اول مرة اخذ من الويكي @@ Link to comment
!#NssoR_) Posted December 28, 2013 Share Posted December 28, 2013 هريست اكواد وش تبي تسوي انت بضبط Link to comment
RoMaNd! Posted December 28, 2013 Share Posted December 28, 2013 من جد .. حتى الي مايعرف في البرمجة يفهمها انها مخربطة Link to comment
The Killer Posted December 28, 2013 Share Posted December 28, 2013 نصيحه : اذا تبي تطرح كود اطرحه مع مشكلته + طلبك عشان تسهل علينا نساعدك مب تطرح كود كبير وتقول وش مشكلته Link to comment
Dr.Xen Posted December 29, 2013 Author Share Posted December 29, 2013 انا جمعت فنكشات حق تابل ذا createMarker -- صنع ماركر getElementType -- التحقق من ان الي دخل الماركر سيارة getVehicleController -- تجيب اللاعب الي يسوق السيارة getElementData -- تتأكد من قروب اللاعب getElementModel -- تتأكد ان السيارة سلطان addVehicleUpgrade -- ركب نيترو او جنوط او اي شي setVehiclePaintjob -- تركب وشم Event: "onMarkerHit" ضض جبت العيد رحت اخذ امثلة وخليت كود مسوي ... المهم ممكن تفهموني كيف اخليهم كود صحيح %! Link to comment
AboShanab Posted December 29, 2013 Share Posted December 29, 2013 ممكن كود :"ماركر يصلح الموتر ويزين السيارة يعني يحط نيترو + وشم اذا كانت السيارة اسمها سلطان.. فقط لأاعضاء القروب # هذا ممثال بسيط , وطبعا ما يسوي اللون ولأ يصلح او اي شي الا وقت السيارة يكون دمها اقل من 100 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 ) Link to comment
Dr.Xen Posted December 29, 2013 Author Share Posted December 29, 2013 طيب وين احط احداثيات اذا لمسها يركب وشم وووكذا ....@ Link to comment
al-Kobra Posted December 29, 2013 Share Posted December 29, 2013 ممكن كود :"ماركر يصلح الموتر ويزين السيارة يعني يحط نيترو + وشم اذا كانت السيارة اسمها سلطان.. فقط لأاعضاء القروب # هذا مثال بسيط , وطبعا ما يسوي اللون ولأ يصلح او اي شي الا وقت السيارة يكون دمها اقل من 100 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 ) Link to comment
Dr.Xen Posted December 29, 2013 Author Share Posted December 29, 2013 طيب وين احط احداثيات الماركر xyz Link to comment
#DRAGON!FIRE Posted December 29, 2013 Share Posted December 29, 2013 طيب وين احط احداثيات الماركر xyz لو تلأحظ بـ اول الكود في سسطر ... addEventHandler( "onMarkerHit", marker, function ( element ) لأسم الماركر حقكـ marker بـ كل سهولة غير الـ Link to comment
Dr.Xen Posted December 29, 2013 Author Share Posted December 29, 2013 سويت كذا صحيح؟ addEventHandler( "onMarkerHit", 1426.6999511719,545.79998779297,10 "cylinder", function ( element ) if ( getElementType ( element ) == "vehicle" ) then if ( getElementData ( getVehicleController ( element ) , "gang" ) == "ARMY" ) then if ( getElementHealth ( element ) < 100 ) then local 222, 32, 255 = math.random( 255 ), math.random( 255 ), math.random( 255 ) setVehicleColor( element, 222, 32, 255 ) fixVehicle ( element ) addVehicleUpgrade ( element, 1010 ) setVehiclePaintjob ( element, 2 ) end end end end ) Link to comment
#DRAGON!FIRE Posted December 29, 2013 Share Posted December 29, 2013 سويت كذا صحيح؟ addEventHandler( "onMarkerHit", 1426.6999511719,545.79998779297,10 "cylinder", function ( element ) if ( getElementType ( element ) == "vehicle" ) then if ( getElementData ( getVehicleController ( element ) , "gang" ) == "ARMY" ) then if ( getElementHealth ( element ) < 100 ) then local 222, 32, 255 = math.random( 255 ), math.random( 255 ), math.random( 255 ) setVehicleColor( element, 222, 32, 255 ) fixVehicle ( element ) addVehicleUpgrade ( element, 1010 ) setVehiclePaintjob ( element, 2 ) end end end end ) سلأمات ؟ , انت صاحي ؟ اقصد زي كذا .. 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 ) Link to comment
Simba Posted January 1, 2014 Share Posted January 1, 2014 انت حاط دم السياره يكىن اقل من ١٠٠ للمعلوميه دم السياره يكون ١٠٠٠ الف وليس مئه اظن مستحيل يجي دمها اقل من ١٠٠ Link to comment
TAPL Posted January 1, 2014 Share Posted January 1, 2014 دم السيارة إذا كان اقل من 250 بتحترق و تنفجر 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