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

[Talkaction] /sex playername, sexnumber

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,766
Solutions
1
Reaction score
225
Location
Chile, Santiago
I need this talkaction... can someone make one please?

/sex kito2, 0 it should be female
/sex kito2, 1 it should be male
/sex kito2, 2 it should be custom outfits


Please someone?

Thanks
 
[10/[04/2009 15:32:31] Lua Script Error: [TalkAction Interface]
[10/04/2009 15:32:31] data/talkactions/scripts/mtibia/sex.lua:eek:nSay

[10/04/2009 15:32:31] data/talkactions/scripts/mtibia/sex.lua:14: attempt to compare number with nil
[10/04/2009 15:32:31] stack traceback:
[10/04/2009 15:32:31] data/talkactions/scripts/mtibia/sex.lua:14: in function <data/talkactions/scripts/mtibia/sex.lua:1>
 
[10/[04/2009 15:32:31] Lua Script Error: [TalkAction Interface]
[10/04/2009 15:32:31] data/talkactions/scripts/mtibia/sex.lua:eek:nSay

[10/04/2009 15:32:31] data/talkactions/scripts/mtibia/sex.lua:14: attempt to compare number with nil
[10/04/2009 15:32:31] stack traceback:
[10/04/2009 15:32:31] data/talkactions/scripts/mtibia/sex.lua:14: in function <data/talkactions/scripts/mtibia/sex.lua:1>

Ch-check it out:
PHP:
local sexTable = {[1] = "female", [2] = "male", [3] = "customSex"}
--[[byKeraxel]] function onSay(cid, words, param)
    local t = string.explode(param, ",")
    local name, value = tostring(t[1]), math.abs(tonumber(t[2]))

    if param == "" or not(name) or not(value) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return TRUE
    end

	if isInAray({0,1,2}, value) == TRUE then
		doPlayerSetSex(getPlayerByNameWildcard(name), value)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are ".. sexTable[value + 1] .." now.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not valid sex.")
	end
    return TRUE
end
 
Last edited:
@Keraxel
[11/04/2009 13:26:23] Lua Script Error: [TalkAction Interface]
[11/04/2009 13:26:23] data/talkactions/scripts/mtibia/sex.lua:eek:nSay

[11/04/2009 13:26:23] data/talkactions/scripts/mtibia/sex.lua:11: attempt to call global 'isInAray' (a nil value)
[11/04/2009 13:26:23] stack traceback:
[11/04/2009 13:26:23] data/talkactions/scripts/mtibia/sex.lua:11: in function <data/talkactions/scripts/mtibia/sex.lua:2>
 
Which distro do you use?
PHP:
local sexTable = {[1] = "female", [2] = "male", [3] = "customSex"}
--[[byKeraxel]] function onSay(cid, words, param)
    local t = string.explode(param, ",")
    local name, value = tostring(t[1]), math.abs(tonumber(t[2]))

    if param == "" or not(name) or not(value) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return TRUE
    end

	if value >= 0 and value <= 2 then
		doPlayerSetSex(getPlayerByNameWildcard(name), value)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are ".. sexTable[value + 1] .." now.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not valid sex.")
	end
    return TRUE
end
 
PHP:
local sexTable = {[1] = "female", [2] = "male", [3] = "customSex"}
--[[byKeraxel]] function onSay(cid, words, param)
    local t = string.explode(param, ",")
    t[2] = tonumber(t[2])
    if t[2] == nil then t[2] = math.random(0, 1) end
    local name, value = tostring(t[1]), math.abs(t[2])

    if param == "" or not(name) or not(value) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return TRUE
    end

    if value >= 0 and value <= 2 then
    	local player = getPlayerByNameWildcard(name)
        doPlayerSetSex(player , value)
        doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, "You are ".. sexTable[value + 1] .." now.")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sex changed to ".. sexTable[value + 1] ..".")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not valid sex.")
    end
    return TRUE
end
It must works, tested -.-'
 
Last edited:
Back
Top