Jump to content

طلب تصحيح كود


Recommended Posts

السلام عليكم

دلوقتي انا قاعد اعمل مود عباره عن جريد لست فيه اسماء الاعبين وإديت بوكس عشان احط فيها رقم وزر عشان يوزع

فكره المود أنه لما اختار لاعب من الجريد لست واحط رقم بالإديت بوكس واضغط علي الزر يوزع للاعب اللي انا محدده فقط المبلغ اللي انا حطيته بالإديت بوكس

بس مو عارف اضبط الكود

الرجاء مساعدتي وكتابه الكود لي

 

 

محاولتي

 

كلينت

-------

addEventHandler ( "onClientGUIClick" , root
    function ( )
        if source = GUIEditor.button[5] then
          local mon = guiGetText(GUIEditor.edit[5])
            if mon == "" then
             outputChatBox ( "#Error!" , 255 , 0 , 0 , true )
            return end
              local play = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] )
               triggerServerEvent ( "tre" , localPlayer , mon , play )
              else
            outputChatBox ( "Please Choose Player  ", 255, 0, 0, true )

        end
    end
)

 

سيرفر

--------

addEvent("tre",true)
addEventHandler("tre",root,
function(mon)
 givePlayerMoney( source , mon , play )
 outputChatBox( "#0099CC****************************************" , root , 0 , 0 , 0 , true )
 outputChatBox( "# [ "..mon.." ] x تم توزيع مبلغ من ميزانية السيرفر" , root , 227 , 247 , 3 , true )
 end
)

 

 

عايز لما اوزع لشخص يظهر كدا بالشات للجميع

console give ( هنا يحط إسم الاعب اللي انا اختارته من الجريد لست ) money ( هنا يحط المبلغ اللي انا حطيته بلإديت بوكس حق الفلوس ) and reason ( هنا يحط السبب اللي أنا حاطه بالإديت بوكس ** GUIEditor.edit[6] ** <-- إسم الإديت بوكس اللي فيها السبب )

 

Edited by 3DNAN_!
Link to comment
addEventHandler ( 'onClientGUIClick' , root ,
  function ( )
    if ( source == Button ) then
      if ( guiGridListGetSelectedItem ( Gridlist ) ~= -1 ) then
        local Player = guiGridListGetItemText ( Gridlist , guiGridListGetSelectedItem ( Gridlist ) , 1 )
        local Money = guiGetText ( EditBox )
        triggerServerEvent ( 'GiveMoney' , localPlayer , Player , tonumber ( Money ) ) 
      end 
    end
  end
)   
addEvent ( 'GiveMoney' , true ) 
addEventHandler ( 'GiveMoney', root ,
  function ( Player , Money )
    local Player = getPlayerFromName  ( Player ) 
    givePlayerMoney ( Player , Money )
  end 
)

 

Link to comment
21 hours ago, #_iMr.[E]coo said:

addEventHandler ( 'onClientGUIClick' , root ,
  function ( )
    if ( source == Button ) then
      if ( guiGridListGetSelectedItem ( Gridlist ) ~= -1 ) then
        local Player = guiGridListGetItemText ( Gridlist , guiGridListGetSelectedItem ( Gridlist ) , 1 )
        local Money = guiGetText ( EditBox )
        triggerServerEvent ( 'GiveMoney' , localPlayer , Player , tonumber ( Money ) ) 
      end 
    end
  end
)   

addEvent ( 'GiveMoney' , true ) 
addEventHandler ( 'GiveMoney', root ,
  function ( Player , Money )
    local Player = getPlayerFromName  ( Player ) 
    givePlayerMoney ( Player , Money )
  end 
)

 

 

 الله يعافيك  , لكن زي م قال الرجال خله كذا

-- Client

addEventHandler ( 'onClientGUIClick' , root ,
  function ( )
    if ( source == Button ) then
      if not ( guiGridListGetSelectedItem ( Gridlist ) ~= -1 ) then
	  outputChatBox("الرجاء تحديد لاعب",255,0,0)
	  return else
        local Player = guiGridListGetItemText ( Gridlist , guiGridListGetSelectedItem ( Gridlist ) , 1 )
        local Money = guiGetText ( EditBox )
		if Money == "" then outputChatBox("الرجاء كتابة مبلغ",255,0,0) return else
        triggerServerEvent ( 'GiveMoney' , localPlayer , Player , tonumber ( Money ) ) 
		end
      end 
    end
  end
) 

 

-- Server

addEvent ( 'GiveMoney' , true ) 
addEventHandler ( 'GiveMoney', root ,
  function ( Player , Money )
  if Money ~= 0 then
    if Player then
    local Player = getPlayerFromName  ( Player ) 
    givePlayerMoney ( Player , Money )
	outputChatBox("تم إعطائك مبلغ "..Money.." من ميزانية السيرفر",Player,255,255,0)
	end
	else
outputChatBox("يجب ان يكون المبلغ 1 واكثر",source,255,0,0)
  end
  end
)

 

Link to comment
window = guiCreateWindow(0.23, 0.23, 0.25, 0.53, "ارسال الفلوس الي اللاعبين", true)
guiWindowSetSizable(window, false)
guiSetProperty(window, "CaptionColour", "FFD9AB49")

gridlist = guiCreateGridList(0.04, 0.04, 0.92, 0.79, true, window)
guiGridListAddColumn(gridlist, "#", 0.2)
guiGridListAddColumn(gridlist, "إسم اللاعب", 0.9)
guiGridListAddColumn(gridlist, "فلوس اللاعب", 0.5)
Ammo = guiCreateEdit(0.04, 0.84, 0.31, 0.07,"0", true, window)
guiSetProperty(Ammo, "NormalTextColour", "FF007F06")
guiEditSetMaxLength(Ammo, 8)
Send = guiCreateButton(0.36, 0.84, 0.34, 0.07, "إرسال", true, window)
guiSetFont(Send, "default-bold-small")
guiSetProperty(Send, "NormalTextColour", "FF7E4D00")
Close = guiCreateButton(0.71, 0.84, 0.25, 0.07, "إاغلاق", true, window)
guiSetFont(Close, "default-bold-small")
guiSetProperty(Close, "NormalTextColour", "FF106C5A")
Reason = guiCreateEdit(0.04, 0.92, 0.63, 0.06, "", true, window)
guiEditSetMaxLength(Reason, 50)
label = guiCreateLabel(0.68, 0.92, 0.28, 0.05, "سبب التوزيع :", true, window)
guiSetFont(label, "default-bold-small")
guiLabelSetColor(label, 255, 34, 34)
guiLabelSetHorizontalAlign(label, "center", false)
--///////////////////////////////////////////--
local ss = getRootElement()
addEvent("GG", true)
addEventHandler("GG", root,function (_,N,M)
guiGridListClear( gridlist )
local row = guiGridListAddRow (gridlist )
guiGridListSetItemText ( gridlist , row,1,_ .. " - ", false, false )
guiGridListSetItemText ( gridlist , row,2,N, false, false )
guiGridListSetItemText ( gridlist , row,3,tonumber(M) or '0', false, false )
guiGridListSetItemData ( gridlist , row , 2 , N)
guiGridListSetItemColor(gridlist,row,1,255,255,0)
guiGridListSetItemColor(gridlist,row,2,255,0,0)
guiGridListSetItemColor(gridlist,row,3,0,200,0)
end )
CeratePlayers = function (N,M)
triggerServerEvent ( "G", localPlayer)
end
addEventHandler ( "onClientPlayerJoin",ss,CeratePlayers)
addEventHandler ( "onClientPlayerQuit",ss,CeratePlayers)
addEventHandler ( "onClientPlayerChangeNick",ss,CeratePlayers)
--///////////////////////////////////////////--
addEventHandler ( "onClientGUIClick", resourceRoot,function ( )
if source == Send then
if guiGridListGetSelectedItem(gridlist) ~= -1 then
local N = guiGridListGetItemText ( gridlist ,guiGridListGetSelectedItem ( gridlist ), 2 )
local A,R = guiGetText (Ammo),guiGetText (Reason )
if A > ''  then
triggerServerEvent ( "S", localPlayer,N,A,R)
CeratePlayers ()
else
outputChatBox ( "Please Add Ammount" , 255 , 0 , 0 , true )  
end
else
outputChatBox ( "Please Choose Player  ", 255, 0, 0, true )
end
elseif source == Close then
guiSetVisible(window , false)
showCursor (false)
end
end)
--///////////////////////////////////////////--
guiSetVisible(window , false)
bindKey ( "F4", "down", function ( )
guiSetVisible (window ,  not guiGetVisible (window ))
showCursor (guiGetVisible (window ) )
guiSetText(Ammo,"0" )
CeratePlayers ()
end)
addEvent ( "S", true )
addEventHandler ( "S", root,function(P,A,R)
local T = getPlayerFromName (P)
if (T) then 
if tonumber(A) >= 100 then
givePlayerMoney(T,tonumber(A))
outputChatBox("#FFFF00"..R .."#FF0000]#FFFFFF-#FF0000[#00FF00 "..A.." #FF0000] x تم توزيع مبلغ من ميزانية السيرفر" , ThePlayer ,r ,g,b, true )
else
outputChatBox("يجب ان يكون المبلغ اكثر من 100" ,source ,255, 100, 100, true )
end
else
outputChatBox("هذا اللاعب غير موجود" ,source , 255, 100, 100 , true )
end
end)

addEvent("G", true)
addEventHandler("G", root,function()
for _, p in ipairs(getElementsByType("player")) do
triggerClientEvent("GG",p,_,getPlayerName (p) ,getPlayerMoney (p))
end
end)

 

Link to comment
7 hours ago, Default said:

بالسيرفر انت مسوي تحقق ان البلأير موجود المفروض تحطه تحت وظيفة getPlayerFromName 

اعذرني سويته استعجال بدون م اراجعه عشان انام :(

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...