• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua [TFS 0.4] log out player when logging in for the first time

Douglita

New Member
Joined
Nov 12, 2023
Messages
9
Reaction score
0
Good night, people!

I would like some help with a script. I want every time a player enters my server (for the first time), he stays online for 1 second and then the character logs out.

Then he needs to log in again. I want this to happen to every player ONLY the first time he logs into the server. Can anyone help me?
 
Good night, people!

I would like some help with a script. I want every time a player enters my server (for the first time), he stays online for 1 second and then the character logs out.

Then he needs to log in again. I want this to happen to every player ONLY the first time he logs into the server. Can anyone help me?

Why
 
He must have some sort of script that works only if player relog for some reason.. maybe..
I want to know Why as well.
 
Code:
-- Check if it's the player's first login
    if not player:getStorageValue(1001) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This is your first login. You will now be kicked.")
        player:remove()
        player:setStorageValue(1001, 1)  -- Set the storage value to indicate that the player has logged in
        return false  -- Stop further execution
    end

Change storage from 1001 to whatever storageid is free.

Add above code right after the following code in login.lua
Code:
   local loginStr = "Welcome to " .. serverName .. "!"

Edit: I need to stop misreading TFS version, I keep making them in 1.5..... here 0.4 version changed player>cid

Code:
    if getPlayerStorageValue(cid, 1001) ~= 1 then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "This is your first login. You will now be kicked.")
        doRemoveCreature(cid)
        setPlayerStorageValue(cid, 1001, 1)  -- Set the storage value to indicate that the player has logged in
        return false  -- Stop further execution
    end
 
Last edited:
Have u tested with /storage command? Maybe just a position of scripts in login.lua.
 
Last edited:
Back
Top