• 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!

Why this login script doesn't work?

cristianso

Member
Joined
Jan 27, 2019
Messages
47
Reaction score
16
Why is this script not working? I want a simple script that set the player town to 2 when he login for the first time.
I am making sure to create a new char to make the LastLoginSaved = 0, still doesn't work.

creaturescripts.xml
Lua:
<event type="login" name="changetown" script="others/changetown.lua" />


changetown.lua
Lua:
function onLogin(player)
    if player:getLastLoginSaved() ~= 0 then
        return true
    end
    player:setTown(2)

return true
end
 
Solution
Still not working... Asked me to change outfit, as usual, but did not change my town_id. I logout and login again, and kept the same town.

However, I made a movement script to do this job for me, when the player step in the tile, his town changes.

I have no idea why your script is not working. Worked like a charm in movement script.
Maybe there is another code changing the town id on the first login. I would change it to an addEvent in the login, so it would execute after the others callbacks, and see if it works. If yes, i would search for it.
Still not working... Asked me to change outfit, as usual, but did not change my town_id. I logout and login again, and kept the same town.

However, I made a movement script to do this job for me, when the player step in the tile, his town changes.

I have no idea why your script is not working. Worked like a charm in movement script.
 
Still not working... Asked me to change outfit, as usual, but did not change my town_id. I logout and login again, and kept the same town.

However, I made a movement script to do this job for me, when the player step in the tile, his town changes.

I have no idea why your script is not working. Worked like a charm in movement script.
Maybe there is another code changing the town id on the first login. I would change it to an addEvent in the login, so it would execute after the others callbacks, and see if it works. If yes, i would search for it.
 
Solution
Maybe there is another code changing the town id on the first login. I would change it to an addEvent in the login, so it would execute after the others callbacks, and see if it works. If yes, i would search for it.
Yep, now it works. I will let both scripts anyway, the one with the movements and this one. Just in case, you know... XD Thanks!
 
Back
Top