All pastes #832994 Raw Edit

Mine

public text v1 · immutable
#832994 ·published 2007-12-26 21:19 UTC
rendered paste body
dcmd_logout(playerid,params[]) {
	#pragma unused params
	new PlayerFile[256]; PlayerFile = GetPlayerFile(playerid);
    if(Variables[playerid][Registered] && Variables[playerid][LoggedIn]) {
		SendClientMessage(playerid,blue,"You have logged out of your account. You may log back in later by typing \"/LOGIN <PASSWORD>\".");
	 	SetUserInt(playerid,"LoggedIn",0); Variables[playerid][LoggedIn] = false; OnPlayerLogout(playerid);
	} else SendClientMessage(playerid,red,"Error: You must be registered and logged into your account first.");
	return 1;
}
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
SLAG
v
//---------------------------------------------------------------------------------------------------------------------
//Player Logout command is above, how do i make it AUTOMATICLY logout at disconnect? heres my donplayerdisconnect stuff:
//---------------------------------------------------------------------------------------------------------------------

public OnPlayerDisconnect(playerid,reason) {
	new Reason[256],string[256],name[24]; GetPlayerName(playerid,name,24);
	switch(reason) { case 0: Reason = "Timed Out"; case 1: Reason = "Leaving"; case 2: Reason = "Kick/Ban"; }
	format(string,256,"*** %s has left the server. (%s)",name,Reason);
	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && i != playerid) SendClientMessage(i,grey,string);
    for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && Spec[i][SpectateID] == playerid  && Spec[i][Spectating]) { TogglePlayerSpectating(i,false); Spec[i][Spectating] = false, Spec[i][SpectateID] = INVALID_PLAYER_ID; }
	return 1;
}