or you can set some variable to true for like 1sec after logging with gui, and if that variable is false, cancelEvent() the onPlayerLogin.
canLogin={}
function onLoggingWithGUI(player, .... ) --call this function when logging in
canLogin[player]=true
... --do the standard login here
setTimer(function(plyr)
canLogin[plyr]=false
end,1000,1,player)
end
addEventHandler("onPlayerLogin",getRootElement(),function()
if not canLogin[source] then
cancelEvent()
outputChatBox("You can only login with GUI!",source,255)
end
end)