Page 1 of 1

Logout with nick name check script

Posted: Tue Mar 28, 2017 4:12 pm
by cooco

Code: Select all

function LogOutSecurity()
	-- Check if the ForceLogout value has been set, in which case we have to go.
	if _ForceLogout ~= nil and not Player:IsBusy() then
		-- Wait until the alert dialog is shown before closing the script.
		if DialogList:GetDialog( "quit_alert_dialog" ):IsVisible() then
			Close();
			return;
		end
		
		-- Use the console to logout.
		PlayerInput:Console( "/Logout" );
	end
	
	-- Iterate through all entities
	for ID, Entity in DictionaryIterator( EntityList:GetList()) do
		-- Check if the entiy is valid.
		if Entity ~= nil then
			-- Check if this is a player.
			if Entity:IsPlayer() and self:SecurePlayer(Entity:GetName()) == true then
				_ForceLogout=true;
				Write("Not secure player: " ..Entity:GetName());
				return;
			end
		end
	end
end

function SecurePlayer(name)
	secureNickName = {"PlayerNick1", "PlayerNick2", "PlayerNick3"} ; 

	-- check nick name
	for i,v in ipairs(secureNickName) do
		if name==v then
			return false;
		end
	end   

	return true;
end

Re: Logout with nick name check script

Posted: Fri Mar 31, 2017 10:22 am
by agonic
I wanna ask something. In this script, why do you check the Entity State ? Because, state was not used.

Re: Logout with nick name check script

Posted: Sat Apr 01, 2017 1:28 am
by cooco
agonic wrote:
Fri Mar 31, 2017 10:22 am
I wanna ask something. In this script, why do you check the Entity State ? Because, state was not used.
My mistake. Not need EntityState.
Script edited.

Re: Logout with nick name check script

Posted: Sun Jun 11, 2017 6:04 am
by Diavolakos
Is there a way to logout/ or use return skill a town scroll if we find an enemy (like if I am asmodian, logout if elyos is found)?

Re: Logout with nick name check script

Posted: Sun Jun 11, 2017 2:24 pm
by nucular
Diavolakos wrote:
Sun Jun 11, 2017 6:04 am
Is there a way to logout/ or use return skill a town scroll if we find an enemy (like if I am asmodian, logout if elyos is found)?
Yes look inside AionScript.pdf

Code: Select all

Entity:IsEnemy()
for friendly player or enemy player

Code: Select all

	if Helper:CheckAvailable( "Return" )  then
		Helper:CheckExecute( "Return" );
		return false;
	end
for return use this example: