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

Anti fake admin

hepy

New Member
Joined
Aug 15, 2007
Messages
217
Reaction score
1
Hi im trying to make a script that checks on login if the player have acces > 0, if so it checks the name of the admin and if it is one of them the script allows him to enter to the server, if no, the player will be kicked, set acces to 0 and also ban him
i have this: but idk whats wrong with it... for now instead of kicking player its checks if it is in the admin lists or no.. but when i try to login, i get no error but in the server console says: [8:51:20.716] Alberto has logged in.
[8:51:20.727] Alberto has logged out.

Code:
function onLogin(cid)
name = getPlayerName(cid)
	if getPlayerAccess(cid) > 0 then
		if (getCreatureName(cid) == "Alberto") then
       	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "admin")
		else
       	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "wrong admin")
		end
	end
end
thanks:)
 
PHP:
local admins = {"Dominik", "Lol User", "Alberto"}
function onLogin(cid)
local name = getCreatureName(cid)
	if(getPlayerAccess(cid) > 0) then
		if(not isInArray(admins, name) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "wrong admin")
			--ban script
			doAddPlayerBanishment(name, BAN_ACCOUNT, -1, ACTION_BANFINAL)
			return false
		end
	end
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "admin")
	return true
end
I never test ban script.
 
Lua:
local staffMembers = {"Dominik"}
function onLogin(cid)
local staffName = getCreatureName(cid)
	if(getPlayerAccess(cid) > 0 and not isInArray(staffMembers, staffName)) then
		print(staffName .. " has been denied login because they have access " .. getPlayerAccess(cid) .. ".")
		return false
	end
	return true
end

Instead of banning the character, it does not allow them to login and it sends the server a message explaining that the player was not allowed to log in so you can check your server to fix that.
 
This will allow only your IP to log on with the God. It will kick anyone else.

Lua:
local ip = {"127.0.0.1", "127.0.0.1"}
local access = 5
function onLogin(cid)
	if getPlayerAccess(cid) >= access then
		if not isInArray(ip, getPlayerIp(cid)) then
			doRemoveCreature(cid, true)
			print(getPlayerIp(cid) .. " has tried to log onto your God.")
		end
	end
	
	return true
end

Console message
Code:
55.555.55.555 has tried to log onto your God.
 
@jdb: wow nice! but what about dinamic ips? could i add a no-ip dns instead an ip?

@dominik ms: thanks, i will read a "returns" tutorial or something like that
 
hmm.. i really dont have any clue how to script that :S i still have problems with the "returns" hahahah
any idea?
 
Back
Top