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

[Request]Male Cant attack male, female cant attack female etc

seto sazo

Member
Joined
Apr 27, 2009
Messages
162
Reaction score
21
Hey I need it on my server so Males cannot attack Males, and Females cannot attack females. Only Males can attack females and females can attack males etc etc.
Thank you very much.

I Also Need a gender door. Like only males can go through one door and females through another.
 
doesnt work

Hey script doesnt work. I can still attack same sex. The reason i need this script is because 1 race is male and the other race is female :p
 
I didn't i made a sex.lua and put that in there. It didnt work :p

Yo can anyone help me with this problem? I dont need the door.
I just need to say Males cant attack males and females cant attack females. ;)
 
Last edited by a moderator:
The door goes something like this I think. Havent tested it since im on a mac :p

Lua:
local male = 9098 -- Change to a unique ID that isnt in use.
local female = 8908 -- Change to a unuique ID that isnt in use. Cant be the same has male.
local playerPos = getCreaturePosition(cid)
local lookdir = getPlayerLookDir(cid)
-- end config --


function onUse(cid, item, frompos, item2, topos)
    if item.uid == male and getPlayerSex(cid) == 0 then
        if lookdir == 0 then
            doTeleportThing(cid, playerPos.y -= 1)
            doPlayerSendCancel(cid, "Only males can enter this door.")
        elseif lookdir == 1 then
            doTeleportThing(cid, playerPos.x -= 1)
            doPlayerSendCancel(cid, "Only males can enter this door.")
        elseif lookdir == 2 then
            doTeleportThing(cid, playerPos.y += 1)
            doPlayerSendCancel(cid, "Only males can enter this door.")
        elseif lookdir == 3 then
            doTeleportThing(cid, playerPos.x += 1)
            doPlayerSendCancel(cid, "Only males can enter this door.")
        end
    elseif item.uid == female and getPlayerSex(cid) == 1 then
        if lookdir == 0 then
            doTeleportThing(cid, playerPos.y -= 1)
            doPlayerSendCancel(cid, "Only females can enter this door.")
        elseif lookdir == 1 then
            doTeleportThing(cid, playerPos.x -= 1)
            doPlayerSendCancel(cid, "Only females can enter this door.")
        elseif lookdir == 2 then
            doTeleportThing(cid, playerPos.y += 1)
            doPlayerSendCancel(cid, "Only females can enter this door.")
        elseif lookdir == 3 then
            doTeleportThing(cid, playerPos.x += 1)
            doPlayerSendCancel(cid, "Only females can enter this door.")
        end
    return TRUE
end
 
TESTES IN TFS 0.3.4 PL1 AND IT WORKS

put this in login.lua
Lua:
	registerCreatureEvent(cid, "sameSex")

Create a file called sameSex.lua and put this:
Lua:
function onCombat(cid, target)

if isPlayer(target) and isPlayer(cid) then
	if(getPlayerSex(cid) == getPlayerSex(target) == TRUE) then
		doPlayerSendCancel(cid, "You can not attack people of your same sex.")
		return FALSE
	else
		return TRUE
	end
else
	return TRUE
	end
end

Open your creaturescripts.xml and put this:
Lua:
	<event type="combat" name="sameSex" script="sameSex.lua"/>

NOTE: Message "You can not attack people of your same sex." is showed only when you attack with a spell. If you attack woth melee it will show "You may not attack this player."
 
Hey doesnt work i get this in my console.
[Error - Creature Event :: ConfigureEvent] No valid type for creature event.combat
[Warning - BaseEvents ::LoadFromXml] Can not configure Event
Im Using TFS
 
Last edited:
Hey.. this script will work for race war! XD
If you configure like, sex 2 for orcs, sex 3 for minos, 4 for dwarves and 5 for elves in outfits.xml (for example) you can make a great rpg war serv! :D

The problem is that the orc monsters would still attack the orc players :p
Is there anyway to certain monsters ignore certain players? (Sex is an option.. it could be, for example, a monster that just attack lvl 100+)

My post Here
 
Last edited:
Back
Top Bottom