Maksoud Posted May 29, 2016 Share Posted May 29, 2016 وين الخطأ ؟؟؟ #Client ---------------------------------------------------------------------------------------------------------------- function showWarningMessage( message ) local x, y = guiGetScreenSize() if not warningBox then warningBox = guiCreateWindow( x*.5-150, y*.5-65, 300, 120, "warning", false ) guiWindowSetSizable( warningBox, false ) warningImage = guiCreateStaticImage( 10, 30, 60, 60, "warning.png", false, warningBox ) --outputChatBox( tostring( warningImage ) ); warningMessage = guiCreateLabel( 100, 40, 180, 60, "", false, warningBox ) warningOk = guiCreateButton( 130, 90, 70, 20, "Ok", false, warningBox ) addEventHandler( "onClientGUIClick", warningOk, function() guiSetVisible( warningBox, false ) end ) else guiSetPosition( warningBox, x*.5-150, y*.5-65, false ) guiSetVisible( warningBox, true ) end guiSetText( warningMessage, message ) guiBringToFront( warningBox ) end addEvent( "bank_showWarningMessage", true ) addEventHandler( "bank_showWarningMessage", g_localPlayer, showWarningMessage ) ---------------------------------------------------------------------------------------------------------------- function performBankAction( ) if source == SendButton then local to_who = guiGetText( SendNameEdit ) amount = tonumber( guiGetText( SendEdit ) ) if to_who == nil or to_who == false or to_who == "" then showWarningMessage( "You must type the name of\nplayer you want to transfer\nmoney to!" ) elseif amount == nil then showWarningMessage( "You must type the amount\nyou want to transfer!" ) elseif amount < 0 then showWarningMessage( "You can't enter negative values!" ) else local money_receiver = getPlayerFromNick( to_who ) if money_receiver == g_localPlayer then showWarningMessage( "You can not transfer money\nto youself!" ) elseif money_receiver ~= g_localPlayer then triggerServerEvent( "bank_transferMoney", g_localPlayer, g_localPlayer, money_receiver, amount ) else showWarningMessage( "Player \"".. to_who .."\"\nis not connected!" ) end end end end #Server ------------------------------------------------------------------------------- function transferMoney( player, receiver, money ) local playerBankID = getBankID( getPlayerBank( player ) ) if type( money ) == 'number' and playersAccount[ player ].balance >= money then local atm = ( banksInfo[ playerBankID ].ATM and true or false ) local triggered = triggerEvent( "onPlayerTransferMoney", player, getPlayerBank( player ), money, receiver, atm ) if triggered then playersAccount[ player ]:withdraw( money, player, true ) playersAccount[ receiver ]:deposit( money ) triggerClientEvent( player, "bank_updateMyBalance", player, playersAccount[ player ].balance ) bank_savePlayerMoney( player, getPlayerAccount( player ) ) bank_savePlayerMoney( receiver, getPlayerAccount( receiver ) ) if isPlayerInBank( receiver ) then triggerClientEvent( receiver, "bank_updateMyBalance", receiver, playersAccount[ receiver ].balance ) end end elseif type( money ) == 'string' and money == 'all' then money = playersAccount[ player ].balance local atm = ( banksInfo[ playerBankID ].ATM and true or false ) local triggered = triggerEvent( "onPlayerTransferMoney", player, getPlayerBank( player ), money, receiver, atm ) if triggered then playersAccount[ player ]:withdraw( money, player, true ) playersAccount[ receiver ]:deposit( money ) bank_savePlayerMoney( player, getPlayerAccount( player ) ) bank_savePlayerMoney( receiver, getPlayerAccount( receiver ) ) triggerClientEvent( player, "bank_updateMyBalance", player, playersAccount[ player ].balance ) if isPlayerInBank( receiver ) then triggerClientEvent( receiver, "bank_updateMyBalance", receiver, playersAccount[ receiver ].balance ) end end else triggerClientEvent( player, "bank_showWarningMessage", player, "Insufficient founds!" ) end end addEvent( "bank_transferMoney", true ) addEventHandler( "bank_transferMoney", root, transferMoney ) Link to comment
Maksoud Posted May 29, 2016 Author Share Posted May 29, 2016 ما يرسل ! لما اضغط عالزر الدى بق يقول WARNING: Bank-System\Bankc.lua:291:Bad argument @ 'triggerServerEvent'[Expected element at argument 2, got nil] Link to comment
iMr.SFA7 Posted May 29, 2016 Share Posted May 29, 2016 -- Client Side -- ---------------------------------------------------------------------------------------------------------------- function showWarningMessage( message ) local x, y = guiGetScreenSize() if not warningBox then warningBox = guiCreateWindow( x*.5-150, y*.5-65, 300, 120, "warning", false ) guiWindowSetSizable( warningBox, false ) warningImage = guiCreateStaticImage( 10, 30, 60, 60, "warning.png", false, warningBox ) --outputChatBox( tostring( warningImage ) ); warningMessage = guiCreateLabel( 100, 40, 180, 60, "", false, warningBox ) warningOk = guiCreateButton( 130, 90, 70, 20, "Ok", false, warningBox ) addEventHandler( "onClientGUIClick", warningOk, function() guiSetVisible( warningBox, false ) end ) else guiSetPosition( warningBox, x*.5-150, y*.5-65, false ) guiSetVisible( warningBox, true ) end guiSetText( warningMessage, message ) guiBringToFront( warningBox ) end addEvent( "bank_showWarningMessage", true ) addEventHandler( "bank_showWarningMessage", localPlayer, showWarningMessage ) ---------------------------------------------------------------------------------------------------------------- function performBankAction( ) if source == SendButton then local to_who = guiGetText( SendNameEdit ) amount = tonumber( guiGetText( SendEdit ) ) if to_who == nil or to_who == false or to_who == "" then showWarningMessage( "You must type the name of\nplayer you want to transfer\nmoney to!" ) elseif amount == nil then showWarningMessage( "You must type the amount\nyou want to transfer!" ) elseif amount < 0 then showWarningMessage( "You can't enter negative values!" ) else local money_receiver = getPlayerFromNick( to_who ) if not money_receiver then return showWarningMessage( "Player \"".. to_who .."\"\nis not connected!" ) end if money_receiver == localPlayer then showWarningMessage( "You can not transfer money\nto youself!" ) else triggerServerEvent( "bank_transferMoney", localPlayer, localPlayer, money_receiver, amount ) end end end end Link to comment
Maksoud Posted May 29, 2016 Author Share Posted May 29, 2016 -- Client Side -- ---------------------------------------------------------------------------------------------------------------- function showWarningMessage( message ) local x, y = guiGetScreenSize() if not warningBox then warningBox = guiCreateWindow( x*.5-150, y*.5-65, 300, 120, "warning", false ) guiWindowSetSizable( warningBox, false ) warningImage = guiCreateStaticImage( 10, 30, 60, 60, "warning.png", false, warningBox ) --outputChatBox( tostring( warningImage ) ); warningMessage = guiCreateLabel( 100, 40, 180, 60, "", false, warningBox ) warningOk = guiCreateButton( 130, 90, 70, 20, "Ok", false, warningBox ) addEventHandler( "onClientGUIClick", warningOk, function() guiSetVisible( warningBox, false ) end ) else guiSetPosition( warningBox, x*.5-150, y*.5-65, false ) guiSetVisible( warningBox, true ) end guiSetText( warningMessage, message ) guiBringToFront( warningBox ) end addEvent( "bank_showWarningMessage", true ) addEventHandler( "bank_showWarningMessage", localPlayer, showWarningMessage ) ---------------------------------------------------------------------------------------------------------------- function performBankAction( ) if source == SendButton then local to_who = guiGetText( SendNameEdit ) amount = tonumber( guiGetText( SendEdit ) ) if to_who == nil or to_who == false or to_who == "" then showWarningMessage( "You must type the name of\nplayer you want to transfer\nmoney to!" ) elseif amount == nil then showWarningMessage( "You must type the amount\nyou want to transfer!" ) elseif amount < 0 then showWarningMessage( "You can't enter negative values!" ) else local money_receiver = getPlayerFromNick( to_who ) if not money_receiver then return showWarningMessage( "Player \"".. to_who .."\"\nis not connected!" ) end if money_receiver == localPlayer then showWarningMessage( "You can not transfer money\nto youself!" ) else triggerServerEvent( "bank_transferMoney", localPlayer, localPlayer, money_receiver, amount ) end end end end شكرا يخوى وين كان الخطأ ؟ Link to comment
[iMr]-W[i]Fi,.! Posted May 29, 2016 Share Posted May 29, 2016 الخطأ كان في ترايقر سيرفر المفروض تحطه localPlayer بس انت حطيته g_localPlayer Link to comment
Maksoud Posted May 29, 2016 Author Share Posted May 29, 2016 الخطأ كان في ترايقر سيرفر المفروض تحطه localPlayer بس انت حطيته g_localPlayer اوك شكرا ليكم <3 Link to comment
[iMr]-W[i]Fi,.! Posted May 29, 2016 Share Posted May 29, 2016 الخطأ كان في ترايقر سيرفر المفروض تحطه localPlayer بس انت حطيته g_localPlayer اوك شكرا ليكم <3 عفواً , 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