-- Client Side #
addEventHandler('onClientResourceStart', resourceRoot,
function()
wnd = guiCreateWindow(271, 227, 476, 395, '', false)
guiWindowSetSizable(wnd, false)
naim = guiCreateButton(32, 40, 409, 158, 'Set Your Name', false, wnd )
button = guiCreateButton(124, 260, 218, 60, '', false, wnd )
edbox = guiCreateEdit(93, 203, 299, 43, '', false, wnd )
showCursor( true )
end
)
addEventHandler('onClientGUIClick', naim, function ( )
Ebox = guiGetText ( edbox )
if Ebox == '' then
return
outputChatBox('Set Your Name', math.random(0, 255), math.random(0, 255), math.random(0, 255), true)
end
triggerServerEvent('SetName', localPlayer, Ebox, getPlayerName ( localPlayer ) )
playSoundFrontEnd(38)
guiSetVisible(wnd, false)
showCursor(false)
end,false
)
-- Server Side #
addEvent('SetName',true)
addEventHandler('SetName',root, function ( name, new )
setPlayerName ( source , name )
outputChatBox ( new.. ' Has Changed His Nick To ' .. name)
end
)