Kenix Posted March 6, 2011 Share Posted March 6, 2011 does not work the event onClientGUIClick. it does not print when you click on the nickname nick. addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() bindKey ( "F6", "down", showMoneySend) end ) function showMoneySend () if ( guiGetVisible ( GUIEditor_Window[111] ) == false ) then showMoneySendStart() elseif ( guiGetVisible ( GUIEditor_Window[111]) == true ) then guiSetVisible ( GUIEditor_Window[111], false ) showCursor(false) end end function showMoneySendStart() showCursor(true) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[111] = guiCreateWindow(334,328,668,565,"Send Money Panel (F6 close/open )",false) GUIEditor_Edit[111] = guiCreateEdit(388,102,250,48,"",false,GUIEditor_Window[111]) GUIEditor_Label[111] = guiCreateLabel(305,109,72,36,"Player:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[111],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[111],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[111],"left",false) GUIEditor_Edit[112] = guiCreateEdit(389,185,248,50,"",false,GUIEditor_Window[111]) GUIEditor_Label[112] = guiCreateLabel(301,194,71,34,"Money:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[112],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[112],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[112],"left",false) GUIEditor_Image[111] = guiCreateStaticImage(389,396,246,160,"login/logo.png",false,GUIEditor_Window[111]) GUIEditor_Label[113] = guiCreateLabel(294,279,72,29,"Your money: $",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[113],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[113],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[113],"left",false) GUIEditor_Button[111] = guiCreateButton(277,490,94,31,"Give!",false,GUIEditor_Window[111]) playersList = guiCreateGridList(35,74,222,443,false,GUIEditor_Window[111]) local columnplayersList = guiGridListAddColumn(playersList, "Players", 0.85) if (columnplayersList) then for id, playeritem in ipairs(getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, columnplayersList, getPlayerName(playeritem), false, false) end end end function onUpdateMoneyplayersList() guiGridListClear(playersList) for id, playeritem in ipairs (getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, 1, getPlayerName(playeritem), false, false) end end addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) function giveMoneySend ( ) edit1 = guiGetText ( GUIEditor_Edit[111] ) edit2 = guiGetText ( GUIEditor_Edit[112] ) triggerServerEvent ( "theMoney", getLocalPlayer(), edit1,edit2 ) end addEventHandler ( "onClientGUIClick", giveMoneySend, GUIEditor_Button[111], false ) addEventHandler( "onClientGUIClick", playersList, function() local rowl, coll = guiGridListGetSelectedItem( source ); if rowl >= 0 and coll >= 0 then local textik = guiGridListGetItemText( source, rowl, coll ); guiSetText( GUIEditor_Edit[111], textik ); end; end, false ); Link to comment
12p Posted March 6, 2011 Share Posted March 6, 2011 volk. You use too many lines and for nothing... Why don't you just show the code we need, not all the script file? Link to comment
Kenix Posted March 6, 2011 Author Share Posted March 6, 2011 volk. You use too many lines and for nothing... Why don't you just show the code we need, not all the script file? here dude function showMoneySendStart() showCursor(true) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[111] = guiCreateWindow(334,328,668,565,"Send Money Panel (F6 close/open )",false) GUIEditor_Edit[111] = guiCreateEdit(388,102,250,48,"",false,GUIEditor_Window[111]) GUIEditor_Label[111] = guiCreateLabel(305,109,72,36,"Player:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[111],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[111],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[111],"left",false) GUIEditor_Edit[112] = guiCreateEdit(389,185,248,50,"",false,GUIEditor_Window[111]) GUIEditor_Label[112] = guiCreateLabel(301,194,71,34,"Money:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[112],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[112],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[112],"left",false) GUIEditor_Image[111] = guiCreateStaticImage(389,396,246,160,"login/logo.png",false,GUIEditor_Window[111]) GUIEditor_Label[113] = guiCreateLabel(294,279,72,29,"Your money: $",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[113],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[113],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[113],"left",false) GUIEditor_Button[111] = guiCreateButton(277,490,94,31,"Give!",false,GUIEditor_Window[111]) playersList = guiCreateGridList(35,74,222,443,false,GUIEditor_Window[111]) local columnplayersList = guiGridListAddColumn(playersList, "Players", 0.85) if (columnplayersList) then for id, playeritem in ipairs(getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, columnplayersList, getPlayerName(playeritem), false, false) end end end addEventHandler( "onClientGUIClick", playersList, function() local rowl, coll = guiGridListGetSelectedItem( source ); if rowl >= 0 and coll >= 0 then local textik = guiGridListGetItemText( source, rowl, coll ); guiSetText( GUIEditor_Edit[111], textik ); end; end, false ); Link to comment
Moderators Citizen Posted March 6, 2011 Moderators Share Posted March 6, 2011 Good work The Kid if he made that in his first post, we would never have seen the problem here: Replace this for giveMoneySend: addEventHandler ( "onClientGUIClick", giveMoneySend, GUIEditor_Button[111], false ) by this: addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend, false ) Reminder: It's addEventHandler ( "onClientGUIClick", theGUIElement, theFunction, false ) Maybe that it's not the only problem in this code. Link to comment
Kenix Posted March 7, 2011 Author Share Posted March 7, 2011 Good work The Kid if he made that in his first post, we would never have seen the problem here:Replace this for giveMoneySend: addEventHandler ( "onClientGUIClick", giveMoneySend, GUIEditor_Button[111], false ) by this: addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend, false ) Reminder: It's addEventHandler ( "onClientGUIClick", theGUIElement, theFunction, false ) Maybe that it's not the only problem in this code. Thank you very much but how to solve this problem here is the code but still does not go to player nick name to GUIEditor_Edit[111] maybe this function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],playergrd) end end addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) Link to comment
Castillo Posted March 7, 2011 Share Posted March 7, 2011 function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) Try it. Link to comment
Kenix Posted March 7, 2011 Author Share Posted March 7, 2011 function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) Try it. can not appear it with something with a different reason? Link to comment
Castillo Posted March 7, 2011 Share Posted March 7, 2011 It's the event even working? try adding an outputChatBox. Link to comment
Kenix Posted March 7, 2011 Author Share Posted March 7, 2011 It's the event even working? try adding an outputChatBox. not work in the ChatBox Link to comment
Castillo Posted March 7, 2011 Share Posted March 7, 2011 Hmm, means the event handler is not added, doesn't it say bad argument or something at debug? addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) end ) function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end Link to comment
Kenix Posted March 7, 2011 Author Share Posted March 7, 2011 Hmm, means the event handler is not added, doesn't it say bad argument or something at debug? addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) end ) function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end no errors in debugscript be it with something else connected? Link to comment
Castillo Posted March 7, 2011 Share Posted March 7, 2011 Post your FULL code here and i will try it at my private server. Link to comment
Kenix Posted March 7, 2011 Author Share Posted March 7, 2011 Post your FULL code here and i will try it at my private server. addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() bindKey ( "F6", "down", showMoneySend) end ) function showMoneySend () if ( guiGetVisible ( GUIEditor_Window[111] ) == false ) then showMoneySendStart() elseif ( guiGetVisible ( GUIEditor_Window[111]) == true ) then guiSetVisible ( GUIEditor_Window[111], false ) showCursor(false) end end function showMoneySendStart() showCursor(true) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[111] = guiCreateWindow(334,328,668,565,"Send Money Panel (F6 close/open )",false) --GUIEditor_Grid[111] = guiCreateGridList(35,74,222,443,false,GUIEditor_Window[111]) --guiGridListSetSelectionMode(playerList,2) --for i = 1, 1 do -- guiGridListAddRow(GUIEditor_Grid[111]) --end --guiGridListAddColumn(GUIEditor_Grid[111],"Players",0.9) GUIEditor_Edit[111] = guiCreateEdit(388,102,250,48,"",false,GUIEditor_Window[111]) GUIEditor_Label[111] = guiCreateLabel(305,109,72,36,"Player:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[111],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[111],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[111],"left",false) GUIEditor_Edit[112] = guiCreateEdit(389,185,248,50,"",false,GUIEditor_Window[111]) GUIEditor_Label[112] = guiCreateLabel(301,194,71,34,"Money:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[112],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[112],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[112],"left",false) GUIEditor_Image[111] = guiCreateStaticImage(389,396,246,160,"login/logo.png",false,GUIEditor_Window[111]) GUIEditor_Label[113] = guiCreateLabel(294,279,72,29,"Your money: $",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[113],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[113],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[113],"left",false) GUIEditor_Button[111] = guiCreateButton(277,490,94,31,"Give!",false,GUIEditor_Window[111]) playersList = guiCreateGridList(35,74,222,443,false,GUIEditor_Window[111]) local columnplayersList = guiGridListAddColumn(playersList, "Players", 0.85) if (columnplayersList) then for id, playeritem in ipairs(getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, columnplayersList, getPlayerName(playeritem), false, false) end end end function onUpdateMoneyplayersList() guiGridListClear(playersList) for id, playeritem in ipairs (getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, 1, getPlayerName(playeritem), false, false) end end addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) function giveMoneySend ( ) edit1 = guiGetText ( GUIEditor_Edit[111] ) edit2 = guiGetText ( GUIEditor_Edit[112] ) triggerServerEvent ( "theMoney", getLocalPlayer(), edit1,edit2 ) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend, false ) --addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend ) --addEventHandler ( "onClientGUIClick", giveMoneySend, GUIEditor_Button[111], false ) addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() outputChatBox("1") addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) end ) function onClickPlayerList() outputChatBox("2") if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end Link to comment
Castillo Posted March 7, 2011 Share Posted March 7, 2011 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() bindKey ( "F6", "down", showMoneySend) end ) function showMoneySend () if ( guiGetVisible ( GUIEditor_Window[111] ) == false ) then showMoneySendStart() elseif ( guiGetVisible ( GUIEditor_Window[111]) == true ) then guiSetVisible ( GUIEditor_Window[111], false ) showCursor(false) end end function showMoneySendStart() showCursor(true) GUIEditor_Window[111] = guiCreateWindow(334,328,668,565,"Send Money Panel (F6 close/open )",false) --GUIEditor_Grid[111] = guiCreateGridList(35,74,222,443,false,GUIEditor_Window[111]) --guiGridListSetSelectionMode(playerList,2) --for i = 1, 1 do -- guiGridListAddRow(GUIEditor_Grid[111]) --end --guiGridListAddColumn(GUIEditor_Grid[111],"Players",0.9) GUIEditor_Edit[111] = guiCreateEdit(388,102,250,48,"",false,GUIEditor_Window[111]) GUIEditor_Label[111] = guiCreateLabel(305,109,72,36,"Player:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[111],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[111],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[111],"left",false) GUIEditor_Edit[112] = guiCreateEdit(389,185,248,50,"",false,GUIEditor_Window[111]) GUIEditor_Label[112] = guiCreateLabel(301,194,71,34,"Money:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[112],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[112],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[112],"left",false) GUIEditor_Image[111] = guiCreateStaticImage(389,396,246,160,"login/logo.png",false,GUIEditor_Window[111]) GUIEditor_Label[113] = guiCreateLabel(294,279,72,29,"Your money: $",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[113],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[113],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[113],"left",false) GUIEditor_Button[111] = guiCreateButton(277,490,94,31,"Give!",false,GUIEditor_Window[111]) playersList = guiCreateGridList(35,74,222,443,false,GUIEditor_Window[111]) addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) local columnplayersList = guiGridListAddColumn(playersList, "Players", 0.85) if (columnplayersList) then for id, playeritem in ipairs(getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, columnplayersList, getPlayerName(playeritem), false, false) end end end function onUpdateMoneyplayersList() guiGridListClear(playersList) for id, playeritem in ipairs (getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, 1, getPlayerName(playeritem), false, false) end end addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) function giveMoneySend ( ) edit1 = guiGetText ( GUIEditor_Edit[111] ) edit2 = guiGetText ( GUIEditor_Edit[112] ) triggerServerEvent ( "theMoney", getLocalPlayer(), edit1,edit2 ) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend, false ) --addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend ) --addEventHandler ( "onClientGUIClick", giveMoneySend, GUIEditor_Button[111], false ) function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end Now it's working fine (tested) Link to comment
Kenix Posted March 7, 2011 Author Share Posted March 7, 2011 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() bindKey ( "F6", "down", showMoneySend) end ) function showMoneySend () if ( guiGetVisible ( GUIEditor_Window[111] ) == false ) then showMoneySendStart() elseif ( guiGetVisible ( GUIEditor_Window[111]) == true ) then guiSetVisible ( GUIEditor_Window[111], false ) showCursor(false) end end function showMoneySendStart() showCursor(true) GUIEditor_Window[111] = guiCreateWindow(334,328,668,565,"Send Money Panel (F6 close/open )",false) --GUIEditor_Grid[111] = guiCreateGridList(35,74,222,443,false,GUIEditor_Window[111]) --guiGridListSetSelectionMode(playerList,2) --for i = 1, 1 do -- guiGridListAddRow(GUIEditor_Grid[111]) --end --guiGridListAddColumn(GUIEditor_Grid[111],"Players",0.9) GUIEditor_Edit[111] = guiCreateEdit(388,102,250,48,"",false,GUIEditor_Window[111]) GUIEditor_Label[111] = guiCreateLabel(305,109,72,36,"Player:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[111],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[111],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[111],"left",false) GUIEditor_Edit[112] = guiCreateEdit(389,185,248,50,"",false,GUIEditor_Window[111]) GUIEditor_Label[112] = guiCreateLabel(301,194,71,34,"Money:",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[112],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[112],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[112],"left",false) GUIEditor_Image[111] = guiCreateStaticImage(389,396,246,160,"login/logo.png",false,GUIEditor_Window[111]) GUIEditor_Label[113] = guiCreateLabel(294,279,72,29,"Your money: $",false,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[113],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[113],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[113],"left",false) GUIEditor_Button[111] = guiCreateButton(277,490,94,31,"Give!",false,GUIEditor_Window[111]) playersList = guiCreateGridList(35,74,222,443,false,GUIEditor_Window[111]) addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) local columnplayersList = guiGridListAddColumn(playersList, "Players", 0.85) if (columnplayersList) then for id, playeritem in ipairs(getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, columnplayersList, getPlayerName(playeritem), false, false) end end end function onUpdateMoneyplayersList() guiGridListClear(playersList) for id, playeritem in ipairs (getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, 1, getPlayerName(playeritem), false, false) end end addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) function giveMoneySend ( ) edit1 = guiGetText ( GUIEditor_Edit[111] ) edit2 = guiGetText ( GUIEditor_Edit[112] ) triggerServerEvent ( "theMoney", getLocalPlayer(), edit1,edit2 ) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend, false ) --addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend ) --addEventHandler ( "onClientGUIClick", giveMoneySend, GUIEditor_Button[111], false ) function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end Now it's working fine (tested) This works !!! great thanks cheers dude Link to comment
Kenix Posted March 18, 2011 Author Share Posted March 18, 2011 help no sending money function giveThisCash(playerNick, amount) local cash = getPlayerMoney( source ) local giveplayer = getPlayerFromName ( playerNick ) local playername = getPlayerName ( source ) local moneytogive = tonumber(amount) if( cash < moneytogive ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[СЕРВЕР] Неверное количество!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] Invalid amount!", source, 243, 151, 12 ) end return end if( moneytogive < 1 ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[СЕРВЕР] Неверное количество!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] Invalid amount!", source, 243, 151, 12 ) end return end if( givenplayer ) then givePlayerMoney ( giveplayer, amount ) takePlayerMoney ( source, tonumber(amount) ) if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[СЕРВЕР] Вы отправли $" ..amount.." для "..getPlayerName ( givenplayer ).. "!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] You have send $" ..amount.." to "..getPlayerName ( givenplayer ).. "!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[СЕРВЕР] "..playername.. " отправил вам $" ..amount.. "!", givenplayer, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] "..playername.. " sent you $" ..amount.. "!", givenplayer, 243, 151, 12 ) end else if (giveplayer == nil) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox("[СЕРВЕР] Игрок не существует.",source,243, 151, 12) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox("[sERV] Player did not exist",source,243, 151, 12) end end end end addEvent( "theMoney", true ) addEventHandler( "theMoney", getRootElement(),giveThisCash) Link to comment
Moderators Citizen Posted March 18, 2011 Moderators Share Posted March 18, 2011 (edited) There are no errors ? And can you show us your triggerServerEvent ? Edited March 18, 2011 by Guest Link to comment
Kenix Posted March 18, 2011 Author Share Posted March 18, 2011 (edited) There are no errors ? And can you show us your triggerServerEvent ? no errors function giveMoneySend ( ) edit1 = guiGetText ( GUIEditor_Edit[111] ) edit2 = guiGetText ( GUIEditor_Edit[112] ) triggerServerEvent ( "theMoney", getLocalPlayer(), edit1,edit2 ) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend, false ) Edited March 18, 2011 by Guest Link to comment
Moderators Citizen Posted March 18, 2011 Moderators Share Posted March 18, 2011 I found ! The problem that you use sometimes giveplayer and sometimes givenplayer So replace giveplayerby givenplayer Link to comment
Kenix Posted March 18, 2011 Author Share Posted March 18, 2011 I found ! The problem that you use sometimes giveplayer and sometimes givenplayerSo replace giveplayerby givenplayer i fixed not work function giveThisCash(playerNick, amount) local cash = getPlayerMoney( source ) local giveplayer = getPlayerFromName ( playerNick ) local playername = getPlayerName ( source ) local moneytogive = tonumber(amount) if( cash < moneytogive ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[СЕРВЕР] Неверное количество!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] Invalid amount!", source, 243, 151, 12 ) end return end if( moneytogive < 1 ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[СЕРВЕР] Неверное количество!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] Invalid amount!", source, 243, 151, 12 ) end return end if( giveplayer ) then givePlayerMoney ( giveplayer, amount ) takePlayerMoney ( source, tonumber(amount) ) if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[СЕРВЕР] Вы отправли $" ..amount.." для "..getPlayerName ( giveplayer ).. "!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] You have send $" ..amount.." to "..getPlayerName ( giveplayer ).. "!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[СЕРВЕР] "..playername.. " отправил вам $" ..amount.. "!", giveplayer, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] "..playername.. " sent you $" ..amount.. "!", giveplayer, 243, 151, 12 ) end else if (giveplayer == nil) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox("[СЕРВЕР] Игрок не существует.",source,243, 151, 12) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox("[sERV] Player did not exist",source,243, 151, 12) end end end end addEvent( "theMoney", true ) addEventHandler( "theMoney", getRootElement(),giveThisCash) Link to comment
Moderators Citizen Posted March 18, 2011 Moderators Share Posted March 18, 2011 Ok so try this: Put my outputChatBox like this: function giveThisCash(playerNick, amount) local cash = getPlayerMoney( source ) local giveplayer = getPlayerFromName ( playerNick ) local playername = getPlayerName ( source ) local moneytogive = tonumber(amount) outputChatBox( "You ("..tostring(playername)..") have: "..tostring(cash).." and you want to give "..tostring(moneytogive).." to the player\" "..tostring(giveplayer).."\" " ) it's not if (giveplayer == nil) then but if (giveplayer == false ) then : If there is no player with that name, false is returned. and replace the end like this: elseif (giveplayer == false ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox("[СЕРВЕР] Игрок не существует.",source,243, 151, 12) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox("[sERV] Player did not exist",source,243, 151, 12) end end end addEvent( "theMoney", true ) addEventHandler( "theMoney", getRootElement(),giveThisCash) And tell me what is it write in the chatbox Link to comment
Kenix Posted March 19, 2011 Author Share Posted March 19, 2011 does not help maybe all is not the problem Link to comment
Moderators Citizen Posted March 19, 2011 Moderators Share Posted March 19, 2011 Ok I think you are too lazy to make my modifications yourself so this is the full code (sorry for the ???? it's notepadd++): addEvent( "theMoney", true ) function giveThisCash(playerNick, amount) local cash = getPlayerMoney( source ) local giveplayer = getPlayerFromName ( playerNick ) local playername = getPlayerName ( source ) local moneytogive = tonumber(amount) outputChatBox( "You ("..tostring(playername)..") have: "..tostring(cash).." and you want to give "..tostring(moneytogive).." to the player\" "..tostring(giveplayer).."\" ", source ) if( cash < moneytogive ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[??????] ???????? ??????????!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] Invalid amount!", source, 243, 151, 12 ) else outputChatBox( "SERVER: I can't get your langage (1)" ) end return end if( moneytogive < 1 ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[??????] ???????? ??????????!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] Invalid amount!", source, 243, 151, 12 ) else outputChatBox( "SERVER: I can't get your langage (1)", source ) end return end if( giveplayer ) then givePlayerMoney ( giveplayer, amount ) takePlayerMoney ( source, tonumber(amount) ) if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[??????] ?? ???????? $" ..amount.." ??? "..getPlayerName ( giveplayer ).. "!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] You have send $" ..amount.." to "..getPlayerName ( giveplayer ).. "!", source, 243, 151, 12 ) elseif getElementData( givePlayer, "Lang" ) == "Rus" then outputChatBox ( "[??????] "..playername.. " ???????? ??? $" ..amount.. "!", giveplayer, 243, 151, 12 ) elseif getElementData( giveplayer, "Lang" ) == "Eng" then outputChatBox ( "[sERV] "..playername.. " sent you $" ..amount.. "!", giveplayer, 243, 151, 12 ) else outputChatBox( "SERVER: I can't get your langage (2)",source ) end elseif (giveplayer == false) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox("[??????] ????? ?? ??????????.",source,243, 151, 12) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox("[sERV] Player did not exist",source,243, 151, 12) else outputChatBox( "SERVER: I can't get your langage (3)", source ) end end end addEventHandler( "theMoney", getRootElement(),giveThisCash) Link to comment
Kenix Posted March 20, 2011 Author Share Posted March 20, 2011 dude I do not know what the problem is When I click on the button, nothing happens function giveMoneySend ( ) outputChatBox("1") edit1 = guiGetText ( GUIEditor_Edit[111] ) edit2 = guiGetText ( GUIEditor_Edit[112] ) triggerServerEvent ( "theMoney", getLocalPlayer(),edit1,edit2) end addEventHandler ( "onClientGUIClick",GUIEditor_Button[111], giveMoneySend) outputChatBox not write Here is the complete script GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() bindKey ( "F6", "down", showMoneySend) end ) function showMoneySend () if ( guiGetVisible ( GUIEditor_Window[111] ) == false ) then showMoneySendStart() elseif ( guiGetVisible ( GUIEditor_Window[111]) == true ) then guiSetVisible ( GUIEditor_Window[111], false ) showCursor(false) end end function showMoneySendStart() showCursor(true) GUIEditor_Window[111] = guiCreateWindow(0.2609,0.3203,0.5219,0.5518,"Send Money Panel (F6 close/open )",true) GUIEditor_Edit[111] = guiCreateEdit(0.5808,0.1805,0.3743,0.0850,"",true,GUIEditor_Window[111]) GUIEditor_Label[111] = guiCreateLabel(0.4566,0.1929,0.1078,0.0637,"Player:",true,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[111],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[111],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[111],"left",false) GUIEditor_Edit[112] = guiCreateEdit(0.5823,0.3274,0.3713,0.0885,"",true,GUIEditor_Window[111]) GUIEditor_Label[112] = guiCreateLabel(0.4506,0.3434,0.1063,0.0602,"Money:",true,GUIEditor_Window[111]) guiLabelSetVerticalAlign(GUIEditor_Label[112],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[112],"left",false) GUIEditor_Image[111] = guiCreateStaticImage(0.5823,0.7009,0.3683,0.2832,"login/logo.png",true,GUIEditor_Window[111]) GUIEditor_Label[113] = guiCreateLabel(0.4401,0.4938,0.2575,0.2283,"Your mone: $",true,GUIEditor_Window[111]) guiSetText(GUIEditor_Label[113],"Your money: $ "..getPlayerMoney (getLocalPlayer())) guiLabelSetColor(GUIEditor_Label[113],51,255,0) guiLabelSetVerticalAlign(GUIEditor_Label[113],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[113],"left",false) GUIEditor_Button[111] = guiCreateButton(0.4147,0.8673,0.1407,0.0549,"Give!",true,GUIEditor_Window[111]) playersList = guiCreateGridList(0.0524,0.1310,0.3323,0.7841,true,GUIEditor_Window[111]) addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) local columnplayersList = guiGridListAddColumn(playersList, "Players", 0.85) if (columnplayersList) then for id, playeritem in ipairs(getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, columnplayersList, getPlayerName(playeritem), false, false) end end end function onUpdateMoneyplayersList() guiGridListClear(playersList) for id, playeritem in ipairs (getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, 1, getPlayerName(playeritem), false, false) end end addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) function giveMoneySend ( ) outputChatBox("1") edit1 = guiGetText ( GUIEditor_Edit[111] ) edit2 = guiGetText ( GUIEditor_Edit[112] ) triggerServerEvent ( "theMoney", getLocalPlayer(),edit1,edit2) end addEventHandler ( "onClientGUIClick",GUIEditor_Button[111], giveMoneySend) function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end Link to comment
Moderators Citizen Posted March 20, 2011 Moderators Share Posted March 20, 2011 dude I do not know what the problem isWhen I click on the button, nothing happens I'm not a superHero so I can't find the problem in the client-side if you put only the server-side Ok so try this: ( All the onClientGUIClick after the creation. And their functions before ): GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() bindKey ( "F6", "down", showMoneySend) end ) function showMoneySend () if ( guiGetVisible ( GUIEditor_Window[111] ) == false ) then showMoneySendStart() elseif ( guiGetVisible ( GUIEditor_Window[111]) == true ) then guiSetVisible( GUIEditor_Window[111], false ) showCursor(false) end end function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end function onUpdateMoneyplayersList() guiGridListClear(playersList) for id, playeritem in ipairs (getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, 1, getPlayerName(playeritem), false, false) end end addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) function giveMoneySend ( ) outputChatBox("1") edit1 = guiGetText ( GUIEditor_Edit[111] ) edit2 = guiGetText ( GUIEditor_Edit[112] ) triggerServerEvent ( "theMoney", getLocalPlayer(),edit1,edit2) end function showMoneySendStart() showCursor(true) GUIEditor_Window[111] = guiCreateWindow(0.2609,0.3203,0.5219,0.5518,"Send Money Panel (F6 close/open )",true) GUIEditor_Edit[111] = guiCreateEdit(0.5808,0.1805,0.3743,0.0850,"",true,GUIEditor_Window[111]) GUIEditor_Label[111] = guiCreateLabel(0.4566,0.1929,0.1078,0.0637,"Player:",true,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[111],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[111],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[111],"left",false) GUIEditor_Edit[112] = guiCreateEdit(0.5823,0.3274,0.3713,0.0885,"",true,GUIEditor_Window[111]) GUIEditor_Label[112] = guiCreateLabel(0.4506,0.3434,0.1063,0.0602,"Money:",true,GUIEditor_Window[111]) guiLabelSetVerticalAlign(GUIEditor_Label[112],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[112],"left",false) GUIEditor_Image[111] = guiCreateStaticImage(0.5823,0.7009,0.3683,0.2832,"login/logo.png",true,GUIEditor_Window[111]) GUIEditor_Label[113] = guiCreateLabel(0.4401,0.4938,0.2575,0.2283,"Your mone: $",true,GUIEditor_Window[111]) guiSetText(GUIEditor_Label[113],"Your money: $ "..getPlayerMoney (getLocalPlayer())) guiLabelSetColor(GUIEditor_Label[113],51,255,0) guiLabelSetVerticalAlign(GUIEditor_Label[113],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[113],"left",false) GUIEditor_Button[111] = guiCreateButton(0.4147,0.8673,0.1407,0.0549,"Give!",true,GUIEditor_Window[111]) playersList = guiCreateGridList(0.0524,0.1310,0.3323,0.7841,true,GUIEditor_Window[111]) local columnplayersList = guiGridListAddColumn(playersList, "Players", 0.85) if (columnplayersList) then for id, playeritem in ipairs(getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, columnplayersList, getPlayerName(playeritem), false, false) end end addEventHandler ( "onClientGUIClick",GUIEditor_Button[111], giveMoneySend) addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) end 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