Inbuilt with multi-purpose announcement bar Check here


[Eluna] Switch Genders Instantly
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

#1
Induction
Are you looking to allow your players to switch their genders in-game? Look no futher! With this simple script we are sharing with you today, your players will be able to instantly switch their genders without even having to relog.


Requirements

Download
Simply copy and paste the code below into a new file and name it SwitchGenders.lua

You can adjust the amount of gold by editing line two of the local cost. However, keep in mind that the ElunaLuaEngine calculates in-game currency in copper. One million copper is equivalent to 100 gold.


Code:
local MSG_GEN = "#gender"
local Cost = 1000000 --This is in copper so the value that is now 100g so 1000000c

local function SwitchGender(event, player, msg, Type, lang)
   
   
        local gmRank = player:GetGMRank()
        if (gmRank >= 0) then -- change number (0-3) 0 - to all  1,2,3 GM with rank
            if (msg:find(MSG_GEN)) then
                if player:IsInCombat() then
                    player:SendBroadcastMessage("You are in combat!")
                    return false
                else
                if player:GetCoinage() >= Cost then
                else
                    player:SendAreaTriggerMessage("You need 100 gold")
                    return false
                end
                player:SetCoinage(player:GetCoinage() - Cost)
                player:SendAreaTriggerMessage("You feel a change.")
                player:SendAreaTriggerMessage("100 gold been taken")

                if player:GetGender() == 0 then
                    player:SetGender(1)
                    return false
                end

                if player:GetGender() == 1 then
                    player:SetGender(0)
                    return false
                end
            end
        end
    end
end

RegisterPlayerEvent(18, SwitchGender)



Screenshots
[Image: Screen-Shot-2023-01-19-at-11.28.39-PM.png]
Error displayed in game if you don't have the correct amount of gold

[Image: Screen-Shot-2023-01-19-at-11.30.21-PM.png]
Switch to other gender upon paying the correct amount of gold



Thank you for visiting our website today. If you encounter any issues, don't hesitate to make a thread in the support section! 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)