• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

OnLogin Creaturescript!

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,780
Solutions
31
Reaction score
2,299
Location
Sweden?
I need script on login if get player access 6 and if not get name (GOD) Otswe, then he get kicked!

Rep!
 
No, if someone hack my database and make his char god, he cant login if he dont got the name (GOD) Otswe

Understand?
 
@ Knight; I think he is requesting a script where you can ONLY log in as a GOD CHARACTER (access 6) if your name has the word "GOD" In it- to prevent people from giving themselfs staff positions.
 
Tell me how much % chance will hacker think about changing their names?
 
The script doesnt work, it dont appear error or doesnt kick a guy with access 6 :/
 
Its looking awesome i will test it, but how can i add more names?

LUA:
local t = {"God", "GM"} -- \\ names allowed to log in // --
function onLogin(cid)
	if(getPlayerAccess(cid) >= 6 and not isInArray(t, getCreatureName(cid))) then
		doRemoveCreature(cid)
	end
	return true
end
These should be working. Be sure to register the event in "login.lua" and add the event to creaturescripts.xml (as Titan said). ;)
 
still dont work :(

also so you know i use tfs 0.3.6

Hmm, try adding this to your "login.lua" script. Just copy/paste it in to "login.lua," somewhere nice. :huh:

LUA:
local t = {"God", "GM"} -- \\ names allowed to log in // --
if(getPlayerAccess(cid) >= 6) then
	if(not isInArray(t, getCreatureName(cid))) then
		doRemoveCreature(cid)
		return true
	end
end
 
Now its working the guy get kicked but one problem the gamemaster doesnt have group id 6 :( it have group id 5 :(

If you fix that, then its perfect :D
 
i get this error now :/ onlogin when someone try login they get kicked but there not even gm or god!

Code:
[30/04/2012 18:17:54] [Error - CreatureScript Interface] 
[30/04/2012 18:17:54] data/creaturescripts/scripts/login.lua:onLogin
[30/04/2012 18:17:54] Description: 
[30/04/2012 18:17:54] data/creaturescripts/scripts/login.lua:133: attempt to compare nil with number
[30/04/2012 18:17:54] stack traceback:
[30/04/2012 18:17:54] 	data/creaturescripts/scripts/login.lua:133: in function <data/creaturescripts/scripts/login.lua:123>
 
Tested and working...

LUA:
local t = {"God", "Gamemaster"} -- names
local k = {3, 4, 5, 6} -- groups
if(isInArray(k, getPlayerGroupId(cid))) then
	if(not isInArray(t, getCreatureName(cid))) then
		doRemoveCreature(cid)
		return true
	end
end
 
Back
Top