Maksoud Posted April 5, 2016 Share Posted April 5, 2016 السلام عليكم و رحمة الله و بركاته لو سمحت يا شباب بدى كود يخلى الشرطى لما يضغط على اسم اللاعب فى القريد ليست و يحدد الوقت فى القريد ليست حق الوقت و يحدد مكان السجن فى القريد ليست حق المكان يسجنه على حسب المحدد Link to comment
Abdul KariM Posted April 5, 2016 Share Posted April 5, 2016 https://forum.multitheftauto.com/viewtopic.php?f=160&t=98193&start=60 تقدر تستفيد من الاكواد الي طرحتها انا في الصحفة 4 على ماعتقد وحاول فيها انا بساعدك ضيف زر جديد , وتحقق ان الوقت موجود , واقتل الوقت عن طريق isTimer killTimer وغير مكانه عن طريق setElementPosition حاول فيها وابشر بالمساعدة Link to comment
Maksoud Posted April 5, 2016 Author Share Posted April 5, 2016 264.41132,77.91972,1001.03906 ذي الاحدثيات البيها بس ابيه ينزل فى انتريور وش اسوى بالاحدثيات ؟ Link to comment
#|_oskar_|# Posted April 5, 2016 Share Posted April 5, 2016 ماجربته بس جرب ورد خبر Time = {1000,20000,30000} local screenW, screenH = guiGetScreenSize() window = guiCreateWindow(10, (screenH - 344) / 2, 216, 344, "لوحة اللاعبين", false) guiWindowSetSizable(window, false) guiSetAlpha(window, 1.00) local X,Y = guiGetPosition(window, false) gridlist = guiCreateGridList(9, 23, 197, 308, false, window) guiGridListAddColumn(gridlist, "اللاعبين", 0.9) button1 = guiCreateButton(9, 334, 197, 32, "سجن اللاعب", false, window) for _, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow (gridlist) guiGridListSetItemText (gridlist, row,1, getPlayerName ( player ), false, false ) end window2 = guiCreateWindow(226,128, 216, 241, "لوحة السجن", false) guiWindowSetSizable(window2, false) guiSetAlpha(window2, 1.00) gridlist2 = guiCreateGridList(9, 23, 197, 140, false, window2) guiGridListAddColumn(gridlist2, "مدة السجن", 0.9) edit = guiCreateEdit(9, 183, 197, 25, "", false, window2) button1 = guiCreateButton(9, 208, 148, 23, "سجن اللاعب", false, window2) button2 = guiCreateButton(160, 208, 46, 23, "X", false, window2) label = guiCreateLabel(87, 164, 36, 19, "السبب", false, window2) guiSetFont(label, "default-bold-small") addEventHandler("onClientGUIMove",window,function () X,Y = guiGetPosition(window, false) guiSetPosition (window2,X+216,Y+1, false ) end, false) for _, v in ipairs(Time) do local row = guiGridListAddRow (gridlist2) guiGridListSetItemText (gridlist2, row,1,v, false, false ) end ------ addEventHandler("onClientGUIClick",button1,function() if (guiGridListGetSelectedItem(gridlist) == -1) then return outputChatBox('Please Selected Player Name',255,0,0,true) end if (guiGridListGetSelectedItem(gridlist2) == -1) then return outputChatBox('Please Selected Time',255,0,0,true) end if guiGetText ( edit )~= '' then local Players = guiGridListGetItemText(gridlist, guiGridListGetSelectedItem(gridlist),1) local Time = guiGridListGetItemText(gridlist2, guiGridListGetSelectedItem(gridlist2),1) triggerServerEvent("Jail",localPlayer,Players,Time,guiGetText ( edit )) else end outputChatBox('Please Add reason',255,0,0,true) end,false) guiSetVisible (window, false) guiSetVisible (window2, false) key = function () getVisible = guiGetVisible (window) if (getVisible == true) then guiSetVisible (window, false) guiSetVisible (window2, false) showCursor (false) end if (getVisible == false) then guiSetVisible (window, true) guiSetVisible (window2, true) showCursor (true) end end bindKey ("F2", "down", key) function JailPlayers(elem,x,y,z,int,Dim) setElementPosition(elem,x,y,z) setElementInterior (elem,int) setElementDimension (elem,Dim) end ------ addEvent("Jail",true) addEventHandler("Jail",root,function (who,min,reason) local Name = getPlayerFromName (who) if Name then JailPlayers(Name,263,77,1001,6,600) outputChatBox(reason .. ' بسبب '..getPlayerName (source).. ' تم سجنك من قبل' ,Name,255,255,0,true) setTimer ( function(source) JailPlayers(source,0,0,4,0,800) outputChatBox('تم انتهاء مدة سجنك' ,Name,255,255,0,true) end, min,1,source) else outputChatBox('هذا اللاعب ليس موجود',source,255,0,0,true) end end) Link to comment
Maksoud Posted April 5, 2016 Author Share Posted April 5, 2016 ما ظبط بس بحاول اشوف ايش الخطأ و انت بارده شوف ايش الخطأ و اليوصل للحل يقول للتانى اوك ؟ Link to comment
Maksoud Posted April 5, 2016 Author Share Posted April 5, 2016 bad argument #1 to 'ipairs' (table expected, got nil) الدى بق يقول كذا ^ Link to comment
#|_oskar_|# Posted April 5, 2016 Share Posted April 5, 2016 bad argument #1 to 'ipairs' (table expected, got nil)الدى بق يقول كذا ^ الكود مافي اخطاء Link to comment
Maksoud Posted April 5, 2016 Author Share Posted April 5, 2016 مهو الزر ما يفعل اي شئ الخطأ من وين ؟ Link to comment
Abdul KariM Posted April 5, 2016 Share Posted April 5, 2016 ماجربته بس جرب ورد خبر Time = {1000,20000,30000} local screenW, screenH = guiGetScreenSize() window = guiCreateWindow(10, (screenH - 344) / 2, 216, 344, "لوحة اللاعبين", false) guiWindowSetSizable(window, false) guiSetAlpha(window, 1.00) local X,Y = guiGetPosition(window, false) gridlist = guiCreateGridList(9, 23, 197, 308, false, window) guiGridListAddColumn(gridlist, "اللاعبين", 0.9) button1 = guiCreateButton(9, 334, 197, 32, "سجن اللاعب", false, window) for _, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow (gridlist) guiGridListSetItemText (gridlist, row,1, getPlayerName ( player ), false, false ) end window2 = guiCreateWindow(226,128, 216, 241, "لوحة السجن", false) guiWindowSetSizable(window2, false) guiSetAlpha(window2, 1.00) gridlist2 = guiCreateGridList(9, 23, 197, 140, false, window2) guiGridListAddColumn(gridlist2, "مدة السجن", 0.9) edit = guiCreateEdit(9, 183, 197, 25, "", false, window2) button1 = guiCreateButton(9, 208, 148, 23, "سجن اللاعب", false, window2) button2 = guiCreateButton(160, 208, 46, 23, "X", false, window2) label = guiCreateLabel(87, 164, 36, 19, "السبب", false, window2) guiSetFont(label, "default-bold-small") addEventHandler("onClientGUIMove",window,function () X,Y = guiGetPosition(window, false) guiSetPosition (window2,X+216,Y+1, false ) end, false) for _, v in ipairs(Time) do local row = guiGridListAddRow (gridlist2) guiGridListSetItemText (gridlist2, row,1,v, false, false ) end ------ addEventHandler("onClientGUIClick",button1,function() if (guiGridListGetSelectedItem(gridlist) == -1) then return outputChatBox('Please Selected Player Name',255,0,0,true) end if (guiGridListGetSelectedItem(gridlist2) == -1) then return outputChatBox('Please Selected Time',255,0,0,true) end if guiGetText ( edit )~= '' then local Players = guiGridListGetItemText(gridlist, guiGridListGetSelectedItem(gridlist),1) local Time = guiGridListGetItemText(gridlist2, guiGridListGetSelectedItem(gridlist2),1) triggerServerEvent("Jail",localPlayer,Players,Time,guiGetText ( edit )) else end outputChatBox('Please Add reason',255,0,0,true) end,false) guiSetVisible (window, false) guiSetVisible (window2, false) key = function () getVisible = guiGetVisible (window) if (getVisible == true) then guiSetVisible (window, false) guiSetVisible (window2, false) showCursor (false) end if (getVisible == false) then guiSetVisible (window, true) guiSetVisible (window2, true) showCursor (true) end end bindKey ("F2", "down", key) function JailPlayers(elem,x,y,z,int,Dim) setElementPosition(elem,x,y,z) setElementInterior (elem,int) setElementDimension (elem,Dim) end ------ addEvent("Jail",true) addEventHandler("Jail",root,function (who,min,reason) local Name = getPlayerFromName (who) if Name then JailPlayers(Name,263,77,1001,6,600) outputChatBox(reason .. ' بسبب '..getPlayerName (source).. ' تم سجنك من قبل' ,Name,255,255,0,true) setTimer ( function(source) JailPlayers(source,0,0,4,0,800) outputChatBox('تم انتهاء مدة سجنك' ,Name,255,255,0,true) end, min,1,source) else outputChatBox('هذا اللاعب ليس موجود',source,255,0,0,true) end end) المفروض تتحق في السيرفر , ان الاعب مسجون او لا وتسوي متغير للتايمر , تحتاج تيبل عشان الوقت Link to comment
#|_oskar_|# Posted April 5, 2016 Share Posted April 5, 2016 مسويه كمثال فقط وفى اشياء ثانيه ناقصه Link to comment
Maksoud Posted April 5, 2016 Author Share Posted April 5, 2016 الخطأ كان من عندى بس في خطأ تانى لما اسوى سجن و احط سبب يعطى سجن و يقول Please Add Reason و انا حطيت سبب Link to comment
Maksoud Posted April 5, 2016 Author Share Posted April 5, 2016 for _,v in ipairs(Time) do Row = guiGridListAddRow(tList) guiGridListSetItemText(tList,Row,1,v[1],false,false) guiGridListSetItemData(tList,Row,1,{v[2],v[3],v[4]}) end شباب اانا سويت الكود ذه ^ عشان يظهر التيبول كويس و صار ما يخرج من السجن Time = { {"1 Minute",1000}, {"2 Minutes",120000}, {"3 Minutes",180000}, {"5 Minutes",3000000}, {"10 Minutes",600000}, {"15 Minutes",900000}, {"20 Minutes",1200000}, } ذه التيبول ^ Link to comment
YourMind Posted April 5, 2016 Share Posted April 5, 2016 (edited) مش عارف ليه صنعتلك المود كامل -- Client local screenW, screenH = guiGetScreenSize() wnd = guiCreateWindow((screenW - 465) / 2, (screenH - 561) / 2, 465, 561, "DTC12", false) guiWindowSetSizable(wnd, false) guiSetProperty(wnd, "CaptionColour", "FF00FBF9") guiSetVisible (wnd,false) grid = guiCreateGridList(9, 23, 178, 429, false, wnd) guiSetFont(grid, "default-bold-small") guiGridListAddColumn(grid, "#Players", 0.9) grid2 = guiCreateGridList(215, 23, 178, 429, false, wnd) guiSetFont(grid2, "default-bold-small") guiGridListAddColumn(grid2, "#Jail time", 0.9) k = guiCreateButton(400, 25, 55, 427, "Jail", false, wnd) guiSetFont(k, "default-bold-small") guiSetProperty(k, "NormalTextColour", "FFFB8302") dwe = guiCreateLabel(7, 447, 448, 15, "____________________________________________________________________", false, wnd) no = guiCreateButton(11, 470, 444, 27, "N-Jail", false, wnd) guiSetFont(no, "default-bold-small") guiSetProperty(no, "NormalTextColour", "FF00FC71") res = guiCreateEdit(177, 507, 113, 33, "", false, wnd) guiSetFont(res, "default-bold-small") rewr = guiCreateLabel(120, 517, 52, 15, "Reasson :", false, wnd) guiSetFont(rewr, "default-bold-small") bindKey ("F5","down", function () guiSetVisible(wnd,not guiGetVisible(wnd)) showCursor (guiGetVisible(wnd)) guiSetInputEnabled (guiGetVisible(wnd)) end ) function ref () guiGridListClear (grid) for i , v in ipairs (getElementsByType ("player")) do local row = guiGridListAddRow (grid) guiGridListSetItemText (grid,row,1,tostring(getPlayerName(v)),false,false) end end addEventHandler ("onClientResourceStart",resourceRoot,ref) addEventHandler ("onClientPlayerChangeNick",root,ref) addEventHandler ("onClientPlayerJoin",root,ref) addEventHandler ("onClientPlayerQuit",root,ref) tab = { {"1 Minute",60000}, {"2 Minutes",2*60000}, {"3 Minutes",3*60000}, {"5 Minutes",5*60000}, {"15 Minutes",15*60000}, {"30 Minutes",30*60000} } for i,k in ipairs (tab) do local rw = guiGridListAddRow (grid2) guiGridListSetItemText(grid2,rw,1,tostring(k[1]),false,false) guiGridListSetItemData (grid2,rw,1,tonumber(k[2])) end addEventHandler ("onClientGUIClick",k, function () local sel,sel2 = guiGridListGetSelectedItem (grid),guiGridListGetSelectedItem (grid2) if sel ~= -1 and sel2 ~= -1 then local plrName = guiGridListGetItemText (grid,sel,1) local plr = getPlayerFromName (plrName) local Time = guiGridListGetItemData (grid2,sel2,1) local ress = guiGetText (res) triggerServerEvent ("Pri",localPlayer,plr,plrName,Time,ress) end end ,false) addEventHandler ("onClientGUIClick",no, function () local sel,sel2 = guiGridListGetSelectedItem (grid) if sel ~= -1 then local plrName = guiGridListGetItemText (grid,sel,1) local plr = getPlayerFromName (plrName) local ress = guiGetText (res) triggerServerEvent ("NJail",localPlayer,plr,plrName,ress) end end,false) -- Server function JailPlayer(elem,x,y,z,int,Dim) -- من اوسكار setElementPosition(elem,x,y,z) setElementInterior (elem,int) setElementDimension (elem,Dim) end v = {} addEvent ("Pri",true) addEventHandler ("Pri",root, function (plr,name,time,ress) if isTimer (v[plr]) then return outputChatBox (""..name.." is already jailed.",source,255,5,5) end if isPedInVehicle (plr) then removePedFromVehicle (plr) end JailPlayer(plr,263,77,1001,6,600) outputChatBox (""..name.." is successfuly jailed.",source,5,255,5) outputChatBox ("You were imprisoned by "..getPlayerName(source).." - ("..ress..") ",plr,255,5,5) v[plr] = setTimer (function () setElementInterior (plr,0) setElementDimension (plr,0) setElementPosition (plr,1545.3995361328,-1675.6196289063,13.560287475586) outputChatBox ("You are free now.",plr,5,255,5) end,time,1) end) addEvent ("NJail",true) addEventHandler ("NJail",root, function (plr,name,ress) if isTimer (v[plr]) then setElementInterior (plr,0) setElementDimension (plr,0) setElementPosition (plr,1545.3995361328,-1675.6196289063,13.560287475586) outputChatBox (""..name.." is successfuly freed.",source,5,255,5) outputChatBox ("You were freed by "..getPlayerName(source).." - ("..ress..").",plr,5,255,5) else return outputChatBox (""..name.." is not jailed.",source,255,5,5) end killTimer (v[plr]) end ) بس مش خسارة فيك Edited April 6, 2016 by Guest Link to comment
YourMind Posted April 5, 2016 Share Posted April 5, 2016 (edited) مش عارف ليه صنعتلك المود كامل -- Client local screenW, screenH = guiGetScreenSize() wnd = guiCreateWindow((screenW - 465) / 2, (screenH - 561) / 2, 465, 561, "DTC12", false) guiWindowSetSizable(wnd, false) guiSetProperty(wnd, "CaptionColour", "FF00FBF9") guiSetVisible (wnd,false) grid = guiCreateGridList(9, 23, 178, 429, false, wnd) guiSetFont(grid, "default-bold-small") guiGridListAddColumn(grid, "#Players", 0.9) grid2 = guiCreateGridList(215, 23, 178, 429, false, wnd) guiSetFont(grid2, "default-bold-small") guiGridListAddColumn(grid2, "#Jail time", 0.9) k = guiCreateButton(400, 25, 55, 427, "Jail", false, wnd) guiSetFont(k, "default-bold-small") guiSetProperty(k, "NormalTextColour", "FFFB8302") dwe = guiCreateLabel(7, 447, 448, 15, "____________________________________________________________________", false, wnd) no = guiCreateButton(11, 470, 444, 27, "N-Jail", false, wnd) guiSetFont(no, "default-bold-small") guiSetProperty(no, "NormalTextColour", "FF00FC71") res = guiCreateEdit(177, 507, 113, 33, "", false, wnd) guiSetFont(res, "default-bold-small") rewr = guiCreateLabel(120, 517, 52, 15, "Reasson :", false, wnd) guiSetFont(rewr, "default-bold-small") bindKey ("F5","down", function () guiSetVisible(wnd,not guiGetVisible(wnd)) showCursor (guiGetVisible(wnd)) guiSetInputEnabled (guiGetVisible(wnd)) end ) function ref () guiGridListClear (grid) for i , v in ipairs (getElementsByType ("player")) do local row = guiGridListAddRow (grid) guiGridListSetItemText (grid,row,1,tostring(getPlayerName(v)),false,false) end end addEventHandler ("onClientResourceStart",resourceRoot,ref) addEventHandler ("onClientPlayerChangeNick",root,ref) addEventHandler ("onClientPlayerJoin",root,ref) addEventHandler ("onClientPlayerQuit",root,ref) tab = { {"1 Minute",60000}, {"2 Minutes",2*60000}, {"3 Minutes",3*60000}, {"5 Minutes",5*60000}, {"15 Minutes",15*60000}, {"30 Minutes",30*60000} } for i,k in ipairs (tab) do local rw = guiGridListAddRow (grid2) guiGridListSetItemText(grid2,rw,1,tostring(k[1]),false,false) guiGridListSetItemData (grid2,rw,1,tonumber(k[2])) end addEventHandler ("onClientGUIClick",k, function () local sel,sel2 = guiGridListGetSelectedItem (grid),guiGridListGetSelectedItem (grid2) if sel ~= -1 and sel2 ~= -1 then local plrName = guiGridListGetItemText (grid,sel,1) local plr = getPlayerFromName (plrName) local Time = guiGridListGetItemData (grid2,sel2,1) local ress = guiGetText (res) triggerServerEvent ("Pri",localPlayer,plr,plrName,Time,ress) end end ,false) addEventHandler ("onClientGUIClick",no, function () local sel,sel2 = guiGridListGetSelectedItem (grid) if sel ~= -1 then local plrName = guiGridListGetItemText (grid,sel,1) local plr = getPlayerFromName (plrName) local ress = guiGetText (res) triggerServerEvent ("NJail",localPlayer,plr,plrName,ress) end end,false) -- Server function JailPlayer(elem,x,y,z,int,Dim) -- من اوسكار setElementPosition(elem,x,y,z) setElementInterior (elem,int) setElementDimension (elem,Dim) end v = {} addEvent ("Pri",true) addEventHandler ("Pri",root, function (plr,name,time,ress) if isTimer (v[plr]) then return outputChatBox (""..name.." is already jailed.",source,255,5,5) end if isPedInVehicle (plr) then removePedFromVehicle (plr) end JailPlayer(plr,263,77,1001,6,600) outputChatBox (""..name.." is successfuly jailed.",source,5,255,5) outputChatBox ("You were imprisoned by "..getPlayerName(source).." - ("..ress..") ",plr,255,5,5) v[plr] = setTimer (function () setElementInterior (plr,0) setElementDimension (plr,0) setElementPosition (plr,1545.3995361328,-1675.6196289063,13.560287475586) outputChatBox ("You are free now.",plr,5,255,5) end,time,1) end) addEvent ("NJail",true) addEventHandler ("NJail",root, function (plr,name,ress) if isTimer (v[plr]) then setElementInterior (plr,0) setElementDimension (plr,0) setElementPosition (plr,1545.3995361328,-1675.6196289063,13.560287475586) outputChatBox (""..name.." is successfuly freed.",source,5,255,5) outputChatBox ("You were freed by "..getPlayerName(source).." - ("..ress..").",plr,5,255,5) else return outputChatBox (""..name.." is not jailed.",source,255,5,5) end killTimer (v[plr]) end ) بس مش خسارة فيك Edited April 6, 2016 by Guest Link to comment
#|_oskar_|# Posted April 6, 2016 Share Posted April 6, 2016 فى خطاء بسيط من سطر 42 الى45 l ناقص حرف الـ Link to comment
#|_oskar_|# Posted April 6, 2016 Share Posted April 6, 2016 فى خطاء بسيط من سطر 42 الى45 l ناقص حرف الـ 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