Jump to content

jef

Members
  • Posts

    5
  • Joined

  • Last visited

jef's Achievements

Vic

Vic (3/54)

0

Reputation

  1. jef

    Gridlist ServerSide

    Thanks, Works now!
  2. jef

    Gridlist ServerSide

    Hello, I have question about sending the table from serverside to clientside, How i can do this with triggerClientEvent? I have this: Clientside function SendGridRow() for index, variable in ipairs (TabelPlayers) do local name, viplevel, level, money = unpack(TabelPlayers) outputChatBox (name) end end Serverside function RefreshOnline() TabelPlayers = { } local result = mysql_query(handler, "SELECT * FROM accounts") if (result) then while true do local row = mysql_fetch_assoc(result) if (not row) then break end TabelPlayers = {{row.name, row.viplevel, row.level,row.money}} -- outputDebugString(row["name"]) -- outputDebugString(row["viplevel"]) -- outputDebugString(row["level"]) -- outputDebugString(row["money"]) end mysql_free_result(result) end triggerClientEvent ( "SendGridRow", getRootElement()) end
  3. jef

    Gridlist ServerSide

    Thanks for reply, I will try out.
  4. Hello, Im currently making a 'Online Players' Window for mine new fresh gamemode. All mine players data are stored in Mysql Databases. I have now created the gui for the window. But i have now problem with the guiGridListSetItemText. The problem is that Mysql is serverside and guiGridListSetItemText is clientside. I have now currently have this in serverside: function StartOnlineTimer ( ) setTimer(RefreshOnline, 1000, 0, player) end addEventHandler ( "onPlayerJoin", getRootElement(), StartOnlineTimer ) function RefreshOnline() local result = mysql_query(handler, "SELECT * FROM accounts") if (result) then while true do local row = mysql_fetch_assoc(result) if (not row) then break end -- outputDebugString(row["name"]) -- outputDebugString(row["viplevel"]) -- outputDebugString(row["level"]) -- outputDebugString(row["money"]) end mysql_free_result(result) end end What functions should i use to send this data from serverside to clientside, So the clientside can use guiGridListSetItemText with the data received from serverside? triggerClientEvent i think?
  5. You should look at: https://wiki.multitheftauto.com/wiki/CountPlayersInTeam Example from the page: function balanceTeams ( thePlayer ) --get the team pointers from their names local groveTeam = getTeamFromName ( "grove" ) local ballasTeam = getTeamFromName ( "ballas" ) --count the number of players in each team, and store them local groveCount = countPlayersInTeam ( groveTeam ) local ballasCount = countPlayersInTeam ( ballasTeam ) if groveCount == ballasCount then --if the teams are equal setPlayerTeam ( thePlayer , groveTeam ) --place the player in grove elseif groveCount > ballasCount then --if there are more in grove setPlayerTeam ( thePlayer , ballasTeam ) --place him in ballas elseif groveCount < ballasCount then --if there are more in ballas setPlayerTeam ( thePlayer , groveTeam ) --place him in grove. end end
×
×
  • Create New...