Jump to content

مشكله في كود ارسال المال


Recommended Posts

السلام عليكم ورحمة الله وبركاته

شباب عندي مشكله في ارسال المال انا اريد اركبه في الشوب لما اركبه ماقدر اختار لاعبين

يعني السهم على فوق فقط ماقدر اشوف الاعبين مافي سهم على تحت

  
    gui["comboBox"] = guiCreateComboBox(70, 85, 191, 54,"اختر لاعب للأرسل", false, gui["_root"]) 
     
    for id, player in ipairs(getElementsByType("player")) do 
    guiComboBoxAddItem(gui["comboBox"], getPlayerName(player)) 
    end 

هاذا ربط الزر

  
addEventHandler("onClientGUIClick", getRootElement(), 
function(a,b,c,d) 
    if source == gui["pushButton"] and guiComboBoxGetItemText(gui["comboBox"],guiComboBoxGetSelected(gui["comboBox"])) ~= "Select a player" then 
        local getComboPlayer = guiComboBoxGetItemText(gui["comboBox"],guiComboBoxGetSelected(gui["comboBox"])) 
        local getMoneyToSend = guiGetText(gui["lineEdit"]) 
        if getComboPlayer and getMoneyToSend then 
            triggerServerEvent("onPlayerReceiveMoney",localPlayer,getComboPlayer,getMoneyToSend) 
        end 
    end 
    end ) 

ولو في افضل منه اعطوني بركب في الشوب

لو يكون لسته افضل وان شاء الله اكون ماتعبتكم

Link to comment

--- Client Side

setTimer( 
    function() 
        playerList = guiCreateGridList(6, 6, 207, 380, false, theWindow) -- theWindow اسسم اللوحة 
            guiGridListSetSelectionMode(playerList, 2) 
            local cl = guiGridListAddColumn(playerList, "Players List ...", 0.85) 
                if ( cl and guiGetVisible(theWindow) == true ) then 
                    for _,name in ipairs(getElementsByType("player")) do 
                     local rw = guiGridListAddRow(playerList) 
                     guiGridListSetItemText(playerList, rw, cl, getPlayerName(name), false, false) 
                    end 
        addEventHandler("onClientGUIClick", playerList, onClickPlayerName) 
                end 
    end 
,4000,0) 
  
function onClickPlayerName () 
  local name = guiGridListGetItemText(playerList, guiGridListGetSelectedItem(playerList), 1) 
  guiSetText(nameEdit, name) -- nameEdit هو خانة الإسسم في اللوحة 
end 
  
addEventHandler("onClientGuiClick",getRootElement(), 
function() 
       if ( source == sendBTN ) then -- sendBTN هو زر الإرسسآل باللوحة 
         playerNick = guiGetText(nameEdit) -- nameEdit هو خآنة الإسسم في اللوحة 
         amount = guiGetText(amountEdit) -- amoutEdit هو خآنة المبلغ في اللوحة 
         triggerServerEvent("onSendMoney", getLocalPlayer(), playerNick, amount) 
       end 
end) 

--- Server Side

addEvent("onSendMoney", true) 
addEventHandler("onSendMoney", getRootElement(), 
 function(who, player) 
   local money = getPlayerMoney(source) 
    if tonumber(player) >= 200 then 
        if tonumber(player) <= money then 
            toWho = getPlayerFromName(who) 
                if toWho ~= false then 
                    givePlayerMoney(toWho, player) 
                    takePlayerMoney(source, player) 
                    name = getPlayerName(source) 
                    outputChatBox("* You have given money amount of: #00ff00$" .. player .. " #0099ccto: #ff0000" .. who, source, 0, 150, 255, true) 
                    outputChatBox("* ".. name .. " #ff0000has given you money amount of: #00ff00$" .. player .. " #ff0000!", toWho, 255, 0, 0, true) 
                else 
                    outputChatBox("* Player did not exist !", source, 255, 0, 0) 
                end 
        else 
            outputChatBox("* you dont have enough money !", source, 255, 0, 0) 
        end 
    else 
        outputChatBox("* the Less amount must be #00ff00$200 !", source, 255, 0, 0) 
    end 
 end 
) 

^ واذا فيه خططأ

debugscript 3 اكتب في الكونسسل

و قول وشش الخطأ اللي صآدفك

Link to comment

شغال وكل شي لاكن مايرسل خذ ألأكواد + الخطأ

  
--window=tab2 
  
setTimer( 
    function() 
        playerList = guiCreateGridList(6, 6, 140, 380, false, tab2) 
            guiGridListSetSelectionMode(playerList, 2) 
            local cl = guiGridListAddColumn(playerList, "Players List ...", 0.85) 
                if ( cl and guiGetVisible(tab2) == true ) then 
                    for _,name in ipairs(getElementsByType("player")) do 
                     local rw = guiGridListAddRow(playerList) 
                     guiGridListSetItemText(playerList, rw, cl, getPlayerName(name), false, false) 
                    end 
        addEventHandler("onClientGUIClick", playerList, onClickPlayerName) 
                end 
    end 
,4000,0) 
  
nameEdit = guiCreateEdit(160,150,200,30,"",false,tab2) 
  
amountEdit = guiCreateEdit(160,200,100,30,"",false,tab2) 
  
sendBTN = guiCreateButton(150,280,130,36, "send", false,tab2) 
  
  
  
--link button 
  
function onClickPlayerName () 
  local name = guiGridListGetItemText(playerList, guiGridListGetSelectedItem(playerList), 1) 
  guiSetText(nemeEdit, neme)-----جاني الخطأ  هنا  guiSetText 
end 
  
addEventHandler("onClientGuiClick",getRootElement(), 
function() 
       if ( source == sendBTN ) then 
         playerNick = guiGetText(nameEdit) 
         amount = guiGetText(amountEdit) 
         triggerServerEvent("onSendMoney", getLocalPlayer(), playerNick, amount) 
       end 
end) 
  

Link to comment

خططأ وآضضضح ششوف عندكـ بـ سطر 31

nemeEdit

والخآنة اللي مسويها انت أسمها

nameEdit

و برضو الأرقومنت الثاني في نفس السطر

neme

واللوكال حقه مكتوب

name

^ فرق ححرف واحد خرب المود

===

وعندكـ سطر 9 مآ ينفع تححط أسسم التاب ! لآزم أسم النافذه

Link to comment

والله للحين الخطأ

تأكد انت وتأكد من ملف سيرفر ممكن منه

مع اني ماحركت شي ابد في ملف سيرفر

خذ وجرب

سلينت

  
setTimer( 
    function() 
        playerList = guiCreateGridList(6, 6, 140, 380, false, tab2) 
            guiGridListSetSelectionMode(playerList, 2) 
            local cl = guiGridListAddColumn(playerList, "Players List ...", 0.85) 
                if ( cl and guiGetVisible(gui["_root"]) == true ) then 
                    for _,name in ipairs(getElementsByType("player")) do 
                     local rw = guiGridListAddRow(playerList) 
                     guiGridListSetItemText(playerList, rw, cl, getPlayerName(name), false, false) 
                    end 
        addEventHandler("onClientGUIClick", playerList, onClickPlayerName) 
                end 
    end 
,4000,0) 
  
nameEdit = guiCreateEdit(160,150,200,30,"",false,tab2) 
  
amountEdit = guiCreateEdit(160,200,100,30,"",false,tab2) 
  
sendBTN = guiCreateButton(150,280,130,36, "send", false,tab2) 
  
  
  
  
function onClickPlayerName () 
  local name = guiGridListGetItemText(playerList, guiGridListGetSelectedItem(playerList), 1) 
  guiSetText(nameEdit, name) 
end 
  
addEventHandler("onClientGuiClick",getRootElement(), 
function() 
       if ( source == sendBTN ) then 
         playerNick = guiGetText(nameEdit) 
         amount = guiGetText(amountEdit) 
         triggerServerEvent("onSendMoney", getLocalPlayer(), playerNick, amount) 
       end 
end) 
  
  
  

السيرفر

addEvent("onSendMoney", true) 
addEventHandler("onSendMoney", getRootElement(), 
 function(who, player) 
   local money = getPlayerMoney(source) 
    if tonumber(player) >= 200 then 
        if tonumber(player) <= money then 
            toWho = getPlayerFromName(who) 
                if toWho ~= false then 
                    givePlayerMoney(toWho, player) 
                    takePlayerMoney(source, player) 
                    name = getPlayerName(source) 
                    outputChatBox("* You have given money amount of: #00ff00$" .. player .. " #0099ccto: #ff0000" .. who, source, 0, 150, 255, true) 
                    outputChatBox("* ".. name .. " #ff0000has given you money amount of: #00ff00$" .. player .. " #ff0000!", toWho, 255, 0, 0, true) 
                else 
                    outputChatBox("* Player did not exist !", source, 255, 0, 0) 
                end 
        else 
            outputChatBox("* you dont have enough money !", source, 255, 0, 0) 
        end 
    else 
        outputChatBox("* the Less amount must be #00ff00$200 !", source, 255, 0, 0) 
    end 
 end 
) 
  
  

Link to comment

ججرب ذآ

-- Client Side

setTimer( 
    function() 
        playerList = guiCreateGridList(6, 6, 140, 380, false, tab2) 
            guiGridListSetSelectionMode(playerList, 2) 
            local cl = guiGridListAddColumn(playerList, "Players List ...", 0.85) 
                if ( cl and guiGetVisible(gui["_root"]) == true ) then 
                    for _,name in ipairs(getElementsByType("player")) do 
                     local rw = guiGridListAddRow(playerList) 
                     guiGridListSetItemText(playerList, rw, cl, getPlayerName(name), false, false) 
                    end 
        addEventHandler("onClientGUIClick", playerList, onClickPlayerName) 
                end 
    end 
,4000,0) 
  
nameEdit = guiCreateEdit(160,150,200,30,"",false,tab2) 
  
amountEdit = guiCreateEdit(160,200,100,30,"",false,tab2) 
  
sendBTN = guiCreateButton(150,280,130,36, "send", false,tab2) 
  
  
  
  
function onClickPlayerName () 
  local name = guiGridListGetItemText(playerList, guiGridListGetSelectedItem(playerList), 1) 
  guiSetText(nameEdit, name) 
end 
  
addEventHandler("onClientGUIClick",getRootElement(), 
function() 
       if ( source == sendBTN ) then 
         playerNick = guiGetText(nameEdit) 
         amount = guiGetText(amountEdit) 
         triggerServerEvent("onSendMoney", getLocalPlayer(), playerNick, amount) 
       end 
end) 
  
  

Link to comment

هههههههه اوك والله فكرت مامنه فايده ابد معلومه مفيده :)

شوف اريدك تضيف وقت لهاذا الكود يعني الكلام يكون 5 ثواني فوق الاعب ويختفيتسلم مشكور ماقصرت بتوفيق

---------تم الحل--------

تسلم اياديك عساه في ميزان حسناتك

Edited by Guest
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...