Ismaeel_finer Posted July 26, 2017 Share Posted July 26, 2017 السلام عليكم عندي مشكلة ف مود ارسال الفلوس + ونفس مشكلة ف مود ارسال دخيرة السلاح عندما اجي احدد لاعب الدي اريد ان ارسل له مال او دخيرة تطهر رسالة تقول لايمكنك ارسال المال لنفسك اكواد مودين ---كلنت مود ارسال فلوس addEventHandler("onClientResourceStart", resourceRoot, function() --panelmoney = guiCreateWindow(817,135,392,412,"",false) local screenW, screenH = guiGetScreenSize() panelmoney = guiCreateWindow((screenW - 530) / 2, (screenH - 416) / 2, 530, 416, "", false) guiWindowSetSizable(panelmoney, false) guiSetVisible(panelmoney,false) zzz = guiCreateStaticImage(10, 11, 510, 395,"images/LK.png",false,panelmoney) GUIEditor.gridlist = guiCreateGridList(3,49,145,342,false,zzz) guiGridListAddColumn(GUIEditor.gridlist,"Player",9,0) sendmoney = guiCreateButton(369, 117, 119, 43,"ارسال",false,zzz) Closed = guiCreateButton(307, 335, 167, 46, "اغلاق", false, zzz) GUIEditor.edit = guiCreateEdit(261, 203, 192, 37,"",false,zzz) labelmoney = guiCreateLabel(150,298,222,92,"BY LIBYA_FREE",false,zzz) guiLabelSetColor(labelmoney,255,0,0) imagemoneey = guiCreateStaticImage(215,2,93,70,"images/logo.png",false,zzz) end ) function RefreshGridlist ( aElement , Col ) if ( getElementType ( aElement ) == "gui-gridlist" ) then guiGridListClear ( aElement ) Col = Col or 1 for i,v in ipairs ( getElementsByType("player") ) do local aRow = guiGridListAddRow ( aElement ) guiGridListSetItemText ( aElement , aRow , Col , getPlayerName ( v ) , false , false ) end end end bindKey(GUIEditor["Key"],"down", function ( ) guiSetVisible ( panelmoney , not guiGetVisible ( panelmoney ) ) showCursor ( guiGetVisible ( panelmoney ) ) guiSetInputEnabled ( guiGetVisible ( GUIEditor.window ) ) RefreshGridlist (GUIEditor.gridlist ) end ); function Update ( ) RefreshGridlist ( GUIEditor.gridlist ) end addEventHandler ("onClientPlayerJoin",root,Update) addEventHandler ("onClientPlayerChangeNick",root,Update) addEventHandler ("onClientPlayerQuit",root,Update) addEventHandler("onClientGUIClick",resourceRoot, function ( ) if (source == Closed) then guiSetVisible (panelmoney,false) showCursor ( false ) elseif ( source == sendmoney ) then local InfoSelected = { guiGridListGetSelectedItem ( GUIEditor.gridlist ) }; if ( InfoSelected [ 1 ] ~= -1 and guiGetText ( GUIEditor.edit ) ~= "" ) then triggerServerEvent("SendMoney",getLocalPlayer(),guiGridListGetItemText(GUIEditor.gridlist,InfoSelected[1],InfoSelected[2]),guiGetText(GUIEditor.edit)) else outputChatBox("اختر لاعب او قم بكتابة رقم",255,0,0,true) end end end ) ---سيرفر addEvent("SendMoney",true) addEventHandler("SendMoney",root, function ( aPlayer , aPrice ) if ( getPlayerFromName ( aPlayer ) and tonumber ( aPrice ) ) then if ( getPlayerFromName ( aPlayer ) == source ) then return outputChatBox("* لايمكنك ارسال الفلوس لنفسك !",source,255,0,0,true) end if ( getPlayerMoney ( source ) >= tonumber ( aPrice ) ) then givePlayerMoney ( getPlayerFromName ( aPlayer ) , tonumber ( aPrice ) ) takePlayerMoney ( source , tonumber ( aPrice ) ) else outputChatBox("* ليس لديك مبلغ كافي "..aPrice.."",source,255,0,0,true) end end end ) ---مود ارسال الدخيرة كلينت function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end function getPedWeapons(ped) local playerWeapons = {} if ped and isElement(ped) and getElementType(ped) == "ped" or getElementType(ped) == "player" then for i=2,9 do local wep = getPedWeapon(ped,i) if wep and wep ~= 0 then table.insert(playerWeapons,wep) end end else return false end return playerWeapons end -- ## Main Window ## wnd = guiCreateStaticImage(460, 155, 520, 513, "images/Window.png", false) guiWindowSetSizable(wnd, false) guiSetVisible(wnd,false) players_grid = guiCreateGridList(4, 69, 161, 342, false, wnd) guiGridListAddColumn(players_grid, "Players", 0.9) guiGridListAddRow(players_grid) guiGridListSetItemText(players_grid, 0, 1, "-", false, false) edit = guiCreateEdit(196, 376, 314, 25, "", false, wnd) send = guiCreateButton(398, 408, 118, 41, "ارسال", false, wnd) local font0_LK = guiCreateFont("fonts/LK.ttf", 16) guiSetFont(send, font0_LK) weapons_grid = guiCreateGridList(369, 80, 147, 296, false, wnd) guiGridListAddColumn(weapons_grid, "Weapon", 0.5) guiGridListAddColumn(weapons_grid, "Ammo", 0.5) guiGridListAddRow(weapons_grid) guiGridListSetItemText(weapons_grid, 0, 1, "-", false, false) label = guiCreateLabel(0, 0, 369, 53, "لوحة ارسال الدخيرة ", false, wnd) local font1_LK = guiCreateFont("fonts/LK.ttf", 39) guiSetFont(label, font1_LK) guiLabelSetColor(label, 251, 207, 3) logo = guiCreateStaticImage(188, 113, 156, 193, "images/logo.png", false, wnd) info = guiCreateLabel(199, 404, 193, 23, "رجاء قم بكتابة عدد دخيرة مراد ارسالها", false, wnd) local font2_LK = guiCreateFont("fonts/LK.ttf", 10) guiSetFont(info, font2_LK) close = guiCreateButton(480, 3, 40, 40, "X", false, wnd) guiSetProperty(close, "NormalTextColour", "FFA50000") guiSetVisible(wnd,false) centerWindow(wnd) bindKey(KEY,"down", function () if guiGetVisible(wnd) then guiSetVisible(wnd,false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(wnd,true) showCursor(true) guiSetInputEnabled(true) putPlayers() putWeapons() end end ) function putPlayers() guiGridListClear(players_grid) for _,player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(players_grid) guiGridListSetItemText(players_grid,row,1,getPlayerName(player),false,false) end end function putWeapons() guiGridListClear(weapons_grid) for _,weapon in ipairs(getPedWeapons(localPlayer)) do if getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)) > 0 then local row = guiGridListAddRow(weapons_grid) guiGridListSetItemText(weapons_grid,row,1,getWeaponNameFromID(weapon),false,false) guiGridListSetItemText(weapons_grid,row,2,getPedTotalAmmo(localPlayer,getSlotFromWeapon(weapon)),false,false) end end end function RefreshLists() putPlayers() putWeapons() end addEventHandler("onClientGUIClick",close, function () guiSetVisible(wnd,false) showCursor(false) guiSetInputEnabled(false) end ,false) addEventHandler("onClientGUIClick",send, function () local sel_1 = guiGridListGetSelectedItem(players_grid) local sel_2 = guiGridListGetSelectedItem(weapons_grid) if sel_1 ~= -1 and sel_2 ~= -1 then local PlayerName = guiGridListGetItemText(players_grid,sel_1,1) local player = getPlayerFromName(PlayerName) if isElement(player) then if player ~= localPlayer then local WeaponName = guiGridListGetItemText(weapons_grid,sel_2,1) local WeaponAmmo = guiGridListGetItemText(weapons_grid,sel_2,2) local WeaponID = getWeaponIDFromName(WeaponName) local Ammo = guiGetText(ammo) if tonumber(Ammo) and tonumber(Ammo) >= 10 then if tonumber(WeaponAmmo) >= tonumber(Ammo) then setTimer(RefreshLists,500,1) triggerServerEvent("SendWeapon",localPlayer,player,WeaponID,Ammo) else outputChatBox("# ليس لديك دخيرة كافية لهادة السلاح",255,0,0) end else outputChatBox("رجاء قم بادخال قيمة مراد ارسالها ",255,0,0) end else outputChatBox("#لايمكنك ارسال المال لنفسك",255,0,0) end else RefreshLists() outputChatBox("# لم يتم عتور علي لاعب",255,0,0) end end end ) --- ملف سيرفر addEvent("SendWeapon",true) addEventHandler("SendWeapon",root, function (player,id,ammo) local id = tonumber(id) local ammo = tonumber(ammo) giveWeapon(player,id,ammo) takeWeapon(source,id,ammo) outputChatBox("##0069c7 لقد قمت بارسال دخيرة " .. getWeaponNameFromID(id) .. "#0069c7الي #ffff000" .. getPlayerName(player),source,255,0,0,true) outputChatBox("# " .. getPlayerName(source) .. " #0069c7Has Sent #ff0000" .. getWeaponNameFromID(id) .. " #0069c7To You With #ff0000" .. ammo .. " #0069c7Ammo",player,255,0,0,true) end ) putPlayers() putWeapons() ارجو رد علي طلب Link to comment
Abdul KariM Posted July 26, 2017 Share Posted July 26, 2017 لان فيه تحقق اذا السورس الي هو بيرسل يساوي الاعب الي راح يستلم بيرجع ويعطيك مسج ماتقدر تعطي لنفسك مرتين اما انك تشيل الكود وتجرب وترجعه او انك تجرب مع شي ثاني Link to comment
Ismaeel_finer Posted July 26, 2017 Author Share Posted July 26, 2017 20 minutes ago, Abdul KariM said: لان فيه تحقق اذا السورس الي هو بيرسل يساوي الاعب الي راح يستلم بيرجع ويعطيك مسج ماتقدر تعطي لنفسك مرتين اما انك تشيل الكود وتجرب وترجعه او انك تجرب مع شي ثاني الحقيقة انا جربت معاه مود كل يوم افتح اجرب معاه انا عامل لوحة زوائد وحاط فيها ارسال المال و فلوس حقيقة مليت منه مود معش عرفت وش اسوي Link to comment
Mhmd.z Posted July 27, 2017 Share Posted July 27, 2017 انت مسوي تحقق اذا الاعب يلي مختاره بالجيرد ليست مو نفس الاعب يل ضغط الزر, يعني كودك شغال لكن لازم تجربه مع لاعبين غيرك 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