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

allowClones only in some players

Cotizado

Member
Joined
May 12, 2008
Messages
320
Reaction score
7
is it posible to allowClones only in some players lua or c++?
like there are alot of chars but only some of them can multiply character
or just the ones with group 7
 
Last edited:
Try this.

Lua:
local allowed = {noob1, noob2, noob3}
function onLogin(cid)
	if getCreatureName(cid) == allowed and PlayerCustomFlag_CanLoginMultipleCharacters then
		doSendAnimatedText(getCreaturePosition, "Currently "..(getPlayersOnline()allowed).." are allowedclones online!", TEXTCOLOR_LIGHTGREEN)
		end
	return false
end
 
add to groups.xml.
Code:
<group id="7" name="clonePlayer" customFlags="1024"/>

Add this to login.lua under the function line.

Lua:
local allowed = {'noob1', 'noob2', 'Evil Mark'} -- edit to allowed player names.
if isInArray(allowed:lower(),getCreatureName(cid):lower()) then
	if getPlayerGroupId(cid) < 2 and getPlayerGroupId(cid) ~= 7 then
		doPlayerSetGroupId(cid,7)
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You can now use multiple character.')
	end
end
 
Last edited:
ok but that only make you to log in with other players in your account not with the same player like the original "allowclone" from config.lua
 
Try this:
PHP:
local allowed = {"noob1", "noob2", "noob3"}
function onLogin(cid)
	if (isInArray(allowed:lower(),getCreatureName(cid):lower())) or (getCreatureByName(getCreatureName(cid)) == nil) then
		return true
	end
	return false
end
if getCreatureByName doesnt block you must make code with getPlayersOnline() and 'for' to check number of players with X name online, search on forum for 'anti-mc'.
 
So if the player is logging in and his name is not in the array he will be logged out? lol.

This can only be done by editing resources.
If any onLogin function 'return false' in TFS 0.3/0.4 player (that try to login, not player already logged) go back to characters list.
So if you check 'player is not on allowed list' and 'player with name X is already logged' it should return false.

It's like when you return false in 'onPrepareDeath' function.. player doesnt die (you must heal him to let him move). In new TFS versions you can script really much in LUA.
 
It must be possible in LUA!

Try this:
PHP:
local allowed = {"noob1", "noob2", "noob3"}
function onLogin(cid)
    if (isInArray(allowed:lower(),getCreatureName(cid):lower())) then 
		return true
	end
	local po = getPlayersOnline()
	local clones = -1
	for i=1, #po do
		if getCreatureName(po[i]) == getCreatureName(cid) then
			clones = clones + 1
		end
	end
	if clones < 1 then
        return true
    end
    return false
end
 
Back
Top Bottom