ِAmR Posted February 26, 2014 Share Posted February 26, 2014 السلام عليكم .. انا جديد فى السكربتات .. اول سكربت حاولت اعملة النهاردة هو عبارة عن وظيفة SWAT job و spwan cars انا استخدمت الاكواد دى ممكن حد يشوفلى كدة صح ولا لا ؟ server side createBlip ( 95.459037780762, 1923.5686035156, 18.107088088989, 56 ) function createSWATteam () SWATteam = createTeam ("SWATteam",69,139,0) end addEventHandler ("onResourceStart", resourceRoot, createhiteventteam) function joinSWATteam() setPlayerTeam(source,SWATteam) setElementModel(source, 287) giveWeapon ( source, 3 ) setElementData( source, "Occupation", "SWATteam", true ) outputChatBox("Welcome , you are now SWAT officar.",source,69,139,0) end addEvent("setSWATteam", true) addEventHandler("setSWATteam",root,joinSWATteam) function policeJob ( attacker, attackerweapon, bodypart, loss ) theTeam = getPlayerTeam ( attacker ) if (attackerweapon == 3) and (loss > 2 ) then setElementPosition (source, 219, 110, 999, true) setTimer ( setElementPosition, 100000, 1, source, 236.32, 110.4, 1003.2) takePlayerMoney (source, 50) givePlayerMoney (attacker, 100) end end addEventHandler ("onPlayerDamage", getRootElement(), SWATteam) clinet side : local marker = createMarker( 95.459037780762, 1923, 18.107088088989, "Cylinder", 1.5, 0, 69, 139, 0) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"SWATteam") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To be a soldier, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiEditSetReadOnly(GUIEditor_Memo[1],true) function SWATteam(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, SWATteam) function Soliderjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, Soliderjobleave) function joinTeam() triggerServerEvent("setSWATteam",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeSWATteamWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSWATteamWindow, false) car spwan GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} car = { {520}, {425}, {519}, {447}, {476}, {511}, {522}, {468}, {432}, {428}, {470}, {579}, {541}, {522}, } local teamName = "SWATteam" local marker = createMarker( 307.29235839839844, 1804.0922851563, 17.640625, "cylinder", 1.5, 255 ,255, 255, 155) local marker2 = createMarker( 205.28984069824, 1917.2662353516, 16.640625, "cylinder", 1.5, 255 ,255, 255, 155) GUIEditor_Window[1] = guiCreateWindow(312,152,165,339,"vehicle",false) guiSetVisible(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(9,19,147,274,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) guiGridListAddColumn(GUIEditor_Grid[1],"vehicle name",60) GUIEditor_Button[1] = guiCreateButton(9,296,69,34,"ok",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(86,296,70,34,"close",false,GUIEditor_Window[1]) for i,v in ipairs (car) do local carName = getVehicleNameFromModel (v[1]) local row = guiGridListAddRow (GUIEditor_Grid[1]) guiGridListSetItemText (GUIEditor_Grid[1], row, 1, carName, false, true) end function onClientClick (button, state, absoluteX, absoluteYe) if (source == GUIEditor_Button[1]) then if (guiGridListGetSelectedItem (GUIEditor_Grid[1])) then local cars = guiGridListGetItemText (GUIEditor_Grid[1], guiGridListGetSelectedItem (GUIEditor_Grid[1]), 1) triggerServerEvent ("cars", getLocalPlayer(), cars) end end end addEventHandler ("onClientGUIClick", GUIEditor_Button[1], onClientClick) function onClientClick (button, state, absoluteX, absoluteYe) if (source == GUIEditor_Button[2]) then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) end end addEventHandler ("onClientGUIClick", GUIEditor_Button[2], onClientClick) addEventHandler("onClientMarkerHit", marker, function ( hitPlayer, matchingDimension ) if ( isElementWithinMarker(hitPlayer, marker) ) then if ( getTeamName( getPlayerTeam( hitPlayer ) ) == teamName ) then if getElementType(hitPlayer) == "player" then guiSetVisible ( GUIEditor_Window[1], true ) showCursor(true) end else outputChatBox ( "you are not in the team", player, 255, 0, 0, true ) end end end ) addEventHandler("onClientMarkerHit", marker2, function ( hitPlayer, matchingDimension ) if ( isElementWithinMarker(hitPlayer, marker2) ) then if ( getTeamName( getPlayerTeam( hitPlayer ) ) == teamName ) then if getElementType(hitPlayer) == "player" then guiSetVisible ( GUIEditor_Window[1], true ) showCursor(true) end else outputChatBox ( "you are not in the team", player, 255, 0, 0, true ) end end end الطلب : ممكن حد يشوف فى غلط ولا لا ؟ و يعملى ملف meta.xml و ياريت لو حد يفهمنى الفرق بين ال Clinet + Server و شكرا Link to comment
abu5lf Posted February 26, 2014 Share Posted February 26, 2014 لو سمحت استخدم عند وضع كود Link to comment
ِAmR Posted February 26, 2014 Author Share Posted February 26, 2014 لو سمحت استخدم عند وضع كود انا لسة مسجل جديد طب تعرف الحل ؟ Link to comment
#DRAGON!FIRE Posted February 26, 2014 Share Posted February 26, 2014 مدام انك مبتدا ومت تعرف حتى اساسيات بسيطة .. فـ لو شرحنا لك من اليوم لين سنة ما بتفهم _ ونجلس نشرح لك الميتا والكلنت وسيرفر ومشوار .. تعلم الاساسيات اول شي . Link to comment
ِAmR Posted February 26, 2014 Author Share Posted February 26, 2014 مدام انك مبتدا ومت تعرف حتى اساسيات بسيطة .. فـ لو شرحنا لك من اليوم لين سنة ما بتفهم _ ونجلس نشرح لك الميتا والكلنت وسيرفر ومشوار .. تعلم الاساسيات اول شي . لالا انا مش مبتدا اوى اناا عارف الميتا و و بعرف اعمل مركر و اخلية مثلا مركر وظيفة و فااهم الحاجات دى بس انا عايز حد يشوف فى غلط فى السكربت ولا لا و شكرا Link to comment
abu5lf Posted February 27, 2014 Share Posted February 27, 2014 لالا انا مش مبتدا اوى اناا عارف الميتا و و بعرف اعمل مركر و اخلية مثلا مركر وظيفة و فااهم الحاجات دى بس انا عايز حد يشوف فى غلط فى السكربت ولا لا و شكرا تقدر تعرف الاخطاء من خلال تجريب السكربت debugscript 3 وتشغيل ورؤية الاخطاء وسببها واي سطر. Link to comment
ِAmR Posted February 27, 2014 Author Share Posted February 27, 2014 لالا انا مش مبتدا اوى اناا عارف الميتا و و بعرف اعمل مركر و اخلية مثلا مركر وظيفة و فااهم الحاجات دى بس انا عايز حد يشوف فى غلط فى السكربت ولا لا و شكرا تقدر تعرف الاخطاء من خلال تجريب السكربت debugscript 3 وتشغيل ورؤية الاخطاء وسببها واي سطر. دة برنامج يعنى بيجيب السطر الخطاء فى السكربت ؟؟ Link to comment
PaiN^ Posted February 27, 2014 Share Posted February 27, 2014 وراح تطلعلك لستة أسفل الشاشة debugscript 3 تقريبا, اكتب في اف 8 في اللعبة و فيها الأغلاط في المودات اللي عندك 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