Hi, I have a little problem with my script. I wanted to use server variable in client-side script, so I used trigger server and client event, but unfortunately, it didn't work. Do you know why?
PS: This script has to display variable characterName in grid row.
SERVER SIDE SCRIPT:
function getCharacterName(characterName)
local characterName = 'James'
triggerClientEvent ( thePlayer, 'getCharName', thePlayer, characterName )
end
addEvent('getCharacterName', true)
addEventHandler('getCharacterName', root, getCharacterName)
CLIENT-SIDE SCRIPT:
function openCharacterMenu(characterName)
menu = guiCreateWindow(0.5, 0.5, 0.2, 0.25, 'Characters', true)
charactersList = guiCreateGridList(0.5, 0.5, 0.4, 0.6, true, menu)
charactersColumn = guiGridListAddColumn(charactersList, 'Characters', 0.6)
charactersRow = guiGridListAddRow(charactersList, 'No characters found')
guiGridListSetItemText(charactersList, charactersColumn, charactersRow, characterName, false, false)
end
addEvent('getCharName', true)
addEventHandler('login.success', localPlayer, openCharacterMenu)
I see one error in client debug: Bad argument @ 'gu'iGridListSetItemText [expected string at argument 4 got, nil]
Event 'login.success' opens up characters gui