var/mob/M = new/mob(loc)
M.icon = usr.icon

Control(mob/M in world)

usr.Original = usr
client.mob = M
M<<"You are now controlling[M]"
usr.client.mob = Original

Problem description:
I was wondering if it's possible to stop the original mob from being auto logged when you switch mobs to the new mob. Lets assume changing login/logout to client instead of mob is impossible, is there any way to control the mob without having your original self log out?

You could set the client's eye to the object you're wanting to control and handle its movement, think you'll need EYE_PERSPECTIVE.
In response to Kozuma3
I need this new creation im controlling to be a mob cause eventually i want to control it like it's another player before coming back to my own. While controlling the new mob i want to be able to see it's stats in my stats panel aswell as perform other actions as it's own unique mob in the game,
so i need to actually make my clients mob become the new one, while leaving my old one in world for when im ready to switch back.. anyone think it's possible? That code worked fine minus my old mob being deleted.
perspective = EYE_PERSPECTIVE


var mob/m = new(loc)
m.icon = icon

mob/verb/Control(mob/m in world)
controlling = m
client.eye = m

controlling = null
client.eye = client.mob

If you don't use the mob you're given upon logging in, you could assign a mob during Login and keep your actual mob invisible and move it when you move whatever you're controlling. Can also add a if-statement to the Stat() proc so if you're controlling something you're seeing their stats instead of yours.

mob/var/list/inventory = new

if(statpanel("[]'s Inventory"))
for(var/obj/o in controlling.inventory)
for(var/obj/o in inventory)

So after reading, apparently if you set

client.perspective = EYE_PERSPECTIVE

It should calculate objects to interact around you from the eyes position and not the mobs, still not what you're asking for tho sorry lol.
In response to Kozuma3
This would work perfect with an if statement in the stats if i just wanted to control stats, but there is so many other aspects that need control over in the game and to go through them all would be insanity, like my auto rewards system where it sends rewards to peoples mailbox.. which they claim and then numbers are added to their variables. I already have messed with the move code to control ships and i dont want to try to add in mob control there, i need a way to literally switch mobs the client is connected too without the old mob disconnecting..
Well to start off first and for most using the reference available in the ide. We can see that mob/Logout() does NOTHING by default and therefor is not "disconnecting" your old mob.

However you switching the clients mob is doing that.
So overriding any of the behavior for it and Login() is pretty easy and straight forward.

If you read Login() you will see that the default thing it does is in fact change the client.statobj which is where the Stat menu pulls the mob for displaying information from. ( Not the clients.mob var but I do believe if you switch the mob it auto switches the statobj to them as well)

So if you simultaneously change the client.mob and the client.eye to equal the new mob. You will fully switch to the new mob without anything happening.

If your mob is "disconnecting" it sounds like you are using Logout() as the player logout and not a client disconnecting from said mob.

You could maintain your use of Logout() for this behavior by simply adding a arg to the Logout() that acts as a override that is always true.

Therefor any call to Logout() by the built-in procedures will/can fail out. Than when a player truly disconnects you could distinguish this by calling Logout() yourself but with the override set to false.

You also could use client/Del() to determine when a player "truly" logs out to display logout information.
In response to Shadowkaroth
When i change the client.mob the character is switched perfectly fine but the old mob vanishes, when you change the client.mob doesn't it change the client.eye automatically aswell? with my original piece of code the view of the client goes to the new mob, but it disconnects the old mob, i assumed it was forcing the mob to log out since a client is disconnecting from it i could be wrong i just dont know how to keep em there..
In response to 430957
Again.. Logout() does nothing be default and BYONDs default design is that when a client disconnects nothing happens to the mob.

It is left on the map. DMs default client/New() actually tries to connect clients to mobs with their Ckey if they exist anywhere on the map or the code.

So if the mob is vanishing it is because you are moving/deleting it.. somewhere in mob/Logout() or client/Del()
My logout does have src(del) in it but if i delete it or try to bypass it with a goto and a label it gives me runtime errors on login..
In response to Shadowkaroth
Please re-read the above ^ comment.

In here I express that Logout() is ALWAYS called when a client disconnects from a mob. You can override this behaviour by adding a simple arg to the Logout( ov ) like such. Followed by a quick evaluation.. " if( !ov ) return "

As the first part of the code to backout if it is called manually by ANY of DMs built in functions.

I would than suggest adding mob.Logout( 1 ) to your client.Del() code so that when the player truly leaves the game the TRUE logout is called. You could also as I previously stated use client/Del() to determine when the CLIENT/player disconnects from the world. AKA truly logouts. ( P.S. you could also just add del(mob) to the client/Del() as well instead of calling Logout() a second time. )
In response to 430957
If you've yet to fix the problem I still am suggesting switching over how you're controlling mobs, will make it much easier on yourself in the long-run plus you get to learn other ways to do the same thing which will help you pick up on all the language features to utilize for other ideas :D
yeah im not quite sure what im doing wrong. i can't stop the other mob from dissapearing and when i can, loading into the game causes me a huge issue, it creates a clone of my character and im left with two characters, so on a live game it'd clone every account as it's made. i wont give up though.
post your logout code
I've fixed it, even tho it deletes my mob, i simply created a new one with the exact same variables at the time mine is deleted when i switch mobs, so i get to keep my original, workaround that seems to be working okay. Now i've run into other problems with saving / loading mobs that don't have clients but i figure when the time is right ill make another post on the forum about it. Thanks for everyones help!