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

ChangeSex Script

Jesper_Kladden

Donator
Joined
May 16, 2008
Messages
458
Reaction score
1
Location
Sweden
Take a look at this script I just made:

PHP:
function onSay(cid, word)
if getPlayerPremiumDays(cid) > 5 then
if getPlayerSex(cid) == 0 then
doPlayerSetSex(cid, 1)
doPlayerRemovePremiumDays(cid, 5)
doPlayerSendTextMessage(cid, 27, "You've just changed yourself into a Man!")
doPlayerChangeOutfit(cid,
{
looktype=128,
lookbody=68,
lookfeet=76,
lookhead=78,
looklegs=39
})
else
doPlayerSetSex(cid, 0)
doPlayerRemovePremiumDays(cid, 5)
doPlayerSendTextMessage(cid, 27, "You've just changed yourself into a Woman!")
doPlayerChangeOutfit(cid,
{
looktype=136,
lookbody=68,
lookfeet=76,
lookhead=78,
looklegs=39
})
end
else
doPlayerSendTextMessage(cid, 27, "You don't have enough Premium Days to change your sex!")
end
end

Talkactions.xml
PHP:
<talkaction words="!sex" script="changesexJK.lua"/>

The script is working like a charm..
But there's one problem:

The Changeoutfit doesn't work!! I can't understand why!!

Does someone here know the problem?


If you didn't understand.. Here it goes again:

*Change to Male works
*Change to Female works
*Change outfit when changing the sex isn't working.

The reason why I want it to change the outfit is that when it changes the sex it still has the old sex outfit left if you don't manualy change it.
 
Code:
local outfit1 = {
lookType = 136,
lookHead = 18,
lookBody = 71,
lookLegs = 188,
lookFeet = 128,
lookAddons = 0
}

local outfit2 = {
lookType = 130,
lookHead = 19,
lookBody = 71,
lookLegs = 128,
lookFeet = 128,
lookAddons = 0
}



function onSay(cid, word)
if getPlayerPremiumDays(cid) > 5 then
	if getPlayerSex(cid) == 0 then
		doPlayerSetSex(cid, 1)
		doPlayerRemovePremiumDays(cid, 5)
		doPlayerSendTextMessage(cid, 27, "You've just changed yourself into a Man!")
		doCreatureChangeOutfit(cid,outfit1)


	else
		doPlayerSetSex(cid, 0)
		doPlayerRemovePremiumDays(cid, 5)
		doPlayerSendTextMessage(cid, 27, "You've just changed yourself into a Woman!")
		doCreatureChangeOutfit(cid,outfit2)

	end
else

	doPlayerSendTextMessage(cid, 27, "You don't have enough Premium Days to change your sex!")

end

return TRUE
end
 
Variables, including table keys, are case-sensetive.

lookType is not same as looktype.

Do it this way instead:
Code:
local currOutfit = getCreatureOutfit(cid)
currOutfit.lookType = xxx -- new crap here use if-statement to check for female etc

setCreatureOutfit(cid, currOutfit)
 
Last edited:
Code:
function onSay(cid, words, param)
	if getPlayerPremiumDays(cid) > 4 then
		doPlayerRemovePremiumDays(cid, 5)
		if getPlayerSex(cid) == 0 then
			doPlayerSetSex(cid, 1)
		else
			doPlayerSetSex(cid, 0)
		end
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have changed your sex and lost five days of premium account.")
	else
		doPlayerSendCancel(cid, "You don't have enough premium days, changing sex costs five of your premium days.")
	end
end
 
Last edited:
Yours !!!!


Edit:

Does it matter if there are big or small letter in for example -> "looklegs" or "lookLegs" ?

I never script and I don´t know if its same but.. Linux os see differents btw big letters and small... so what about that?! BAH :O



u... i kill u soon

next person who i help and ignore my post I WILL USE IGNORE BUTTON FOR PERMANENT IGNORE

Muhahahahaahha nab he just pwn you :)

peace mi no did no wrong plx
 
Back
Top