Jump to content

fix pleez ^_^


IIIIlllllIII

Recommended Posts

Posted (edited)

hi

i have problem with update to get players name on share money TAb

problem in setTimer

see the code

function setGUI ( ) 
setTimer(setGUI , 1000 ,1) 
selectedRow, selectedCol = guiGridListGetSelectedItem( playerGridList ) 
gridPlayerName = guiGridListGetItemText( playerGridList, selectedRow, selectedCol ) 
guiSetText ( playerNameEdit, gridPlayerName ) 
end 
    playerGridList = guiCreateGridList(7,12,183,420,false,tab0) 
    playersColumn = guiGridListAddColumn(playerGridList,"Players",0.85) 
    guiGridListSetSelectionMode(playerGridList,2) 
    for id, plaItem in ipairs(getElementsByType("player")) do 
    row = guiGridListAddRow ( playerGridList ) 
    guiGridListSetItemText ( playerGridList, row, playersColumn, getPlayerName ( plaItem ), false, false ) 
       
    end 
    addEventHandler( "onClientGUIClick", playerGridList, setGUI ) 
  

i want to keep update players list

how i use SetTimer

to keep update the function setGUI ????

Edited by Guest

http://mojrm511.x10.mx

msn:

[email protected]

my server ip:

176.9.40.71:22779

-------------------------------------- 2012 updated--------

Posted

try this

function setGUI ( ) 
selectedRow, selectedCol = guiGridListGetSelectedItem( playerGridList ) 
gridPlayerName = guiGridListGetItemText( playerGridList, selectedRow, selectedCol ) 
guiSetText ( playerNameEdit, gridPlayerName ) 
end 
playerGridList = guiCreateGridList(7,12,183,420,false,tab0) 
playersColumn = guiGridListAddColumn(playerGridList,"Players",0.85) 
guiGridListSetSelectionMode(playerGridList,2) 
for id, plaItem in ipairs(getElementsByType("player")) do 
row = guiGridListAddRow ( playerGridList ) 
guiGridListSetItemText ( playerGridList, row, playersColumn, getPlayerName ( plaItem ), false, false ) 
end 
addEventHandler( "onClientGUIClick", playerGridList, setGUI ) 
setTimer ( setGUI, 1000, 1,) 
  

Posted

Eh this isnt whole code i think and please ffs use [lua][lua] tag

Edit make a new function to get players in sevrer and fill gridlist with it i dont think what dev_ point said will work xD

then set a timer on the function to get players in server and fill gridlist

i wont do this for you since it is really simple

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

what about this ?

function createPlayerList () 
    local playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) 
    local column = guiGridListAddColumn( playerList, "Players", 0.85 ) 
    if ( column ) then 
        for id, player in ipairs(getElementsByType("player")) do 
            local row = guiGridListAddRow ( playerList ) 
            guiGridListSetItemText ( playerList, row, column, getPlayerName ( player ), false, false ) 
        end 
    end 
end 

Posted
try this
function setGUI ( ) 
selectedRow, selectedCol = guiGridListGetSelectedItem( playerGridList ) 
gridPlayerName = guiGridListGetItemText( playerGridList, selectedRow, selectedCol ) 
guiSetText ( playerNameEdit, gridPlayerName ) 
end 
playerGridList = guiCreateGridList(7,12,183,420,false,tab0) 
playersColumn = guiGridListAddColumn(playerGridList,"Players",0.85) 
guiGridListSetSelectionMode(playerGridList,2) 
for id, plaItem in ipairs(getElementsByType("player")) do 
row = guiGridListAddRow ( playerGridList ) 
guiGridListSetItemText ( playerGridList, row, playersColumn, getPlayerName ( plaItem ), false, false ) 
end 
addEventHandler( "onClientGUIClick", playerGridList, setGUI ) 
setTimer ( setGUI, 1000, 1,) 
  

your code is wrong

and i fix this problem now without help

ok guys i fix the problem now without help

http://mojrm511.x10.mx

msn:

[email protected]

my server ip:

176.9.40.71:22779

-------------------------------------- 2012 updated--------

Posted
what about this ?
function createPlayerList () 
    local playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) 
    local column = guiGridListAddColumn( playerList, "Players", 0.85 ) 
    if ( column ) then 
        for id, player in ipairs(getElementsByType("player")) do 
            local row = guiGridListAddRow ( playerList ) 
            guiGridListSetItemText ( playerList, row, column, getPlayerName ( player ), false, false ) 
        end 
    end 
end 

DevPoint stop copy things from wiki.

Posted

try this

  
tab5 = guiCreateTab("Share money",GUIEditor_TabPanel[1]) 
playerNameEdit = guiCreateEdit(157,26,168,29,"",false,tab5) 
guiEditSetReadOnly(playerNameEdit,true) 
playerNameLabel = guiCreateLabel(197,6,73,15,"Player Name:",false,tab5) 
guiLabelSetColor(playerNameLabel,255,255,255) 
guiLabelSetVerticalAlign(playerNameLabel,"top") 
guiLabelSetHorizontalAlign(playerNameLabel,"left",false) 
amountEdit = guiCreateEdit(158,84,168,29,"",false,tab5) 
guiEditSetMaxLength(amountEdit,8) 
amountLabel = guiCreateLabel(196,60,73,15,"amount:",false,tab5) 
guiLabelSetColor(amountLabel,255,255,255) 
guiLabelSetVerticalAlign(amountLabel,"top") 
guiLabelSetHorizontalAlign(amountLabel,"left",false) 
sendMoneyButton = guiCreateButton(193,134,84,39,"SEND",false,tab5) 
  
function onGuiClick (button, state, absoluteX, absoluteY) 
  elseif (source == sendMoneyButton) then 
    playerNick = guiGetText ( playerNameEdit ) 
    amount = guiGetText ( amountEdit ) 
  end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  
function onUpdateMoneyplayersList() 
playerName = getPlayerName ( getLocalPlayer() ) 
        playerList = guiCreateGridList(4,7,153,390,false,tap5) 
        guiGridListSetSelectionMode(playerList,2) 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then  
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) 
  
  
function click ()  
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
       guiSetText ( playerNameEdit, playerName ) 
end 

server side

  
local rootElement = getRootElement() 
  
addEvent("sendMoney", true) 
addEventHandler("sendMoney", rootElement, 
function (playerNick, amount) 
  local cash = getPlayerMoney(source) 
  if (tonumber(amount)>0) then 
    if (cash>=tonumber(amount)) then 
      toWho = getPlayerFromName(playerNick) 
      if (toWho ~= false) then 
        givePlayerMoney(toWho,amount) 
        takePlayerMoney(source,amount) 
        name = getPlayerName(source) 
        outputChatBox("You've given money amount of: " .. amount .. "$ to: " .. playerNick,source,255,255,150) 
        outputChatBox(name .. " has given you money amount of: " .. amount .. "$!",toWho,255,255,245) 
      else 
        outputChatBox("Player did not exist!",source,255,0,0) 
      end 
    else 
      outputChatBox("Insufficient founds!",source,255,0,0) 
    end 
  else 
    outputChatBox("Amount must to be greater than 0!",source,255,0,0) 
  end 
end) 

this should work

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted
try this
  
tab5 = guiCreateTab("Share money",GUIEditor_TabPanel[1]) 
playerNameEdit = guiCreateEdit(157,26,168,29,"",false,tab5) 
guiEditSetReadOnly(playerNameEdit,true) 
playerNameLabel = guiCreateLabel(197,6,73,15,"Player Name:",false,tab5) 
guiLabelSetColor(playerNameLabel,255,255,255) 
guiLabelSetVerticalAlign(playerNameLabel,"top") 
guiLabelSetHorizontalAlign(playerNameLabel,"left",false) 
amountEdit = guiCreateEdit(158,84,168,29,"",false,tab5) 
guiEditSetMaxLength(amountEdit,8) 
amountLabel = guiCreateLabel(196,60,73,15,"amount:",false,tab5) 
guiLabelSetColor(amountLabel,255,255,255) 
guiLabelSetVerticalAlign(amountLabel,"top") 
guiLabelSetHorizontalAlign(amountLabel,"left",false) 
sendMoneyButton = guiCreateButton(193,134,84,39,"SEND",false,tab5) 
  
function onGuiClick (button, state, absoluteX, absoluteY) 
  elseif (source == sendMoneyButton) then 
    playerNick = guiGetText ( playerNameEdit ) 
    amount = guiGetText ( amountEdit ) 
  end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  
function onUpdateMoneyplayersList() 
playerName = getPlayerName ( getLocalPlayer() ) 
        playerList = guiCreateGridList(4,7,153,390,false,tap5) 
        guiGridListSetSelectionMode(playerList,2) 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then  
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) 
  
  
function click ()  
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
       guiSetText ( playerNameEdit, playerName ) 
end 

this should work

this just will making an stupid thing

CiTLh.png

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...