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

Random Player

DestinationSer

@echo off
Joined
Mar 7, 2009
Messages
2,806
Solutions
1
Reaction score
676
Hello.
I want so a random player from the online player list is able to open a door with uniqueid 12888
When the random player gets chosen. which is every 30 min it broadcasts.
Example: Playername has been chosen to enter the Secret door!
After the 30 mins have passed the player gets either teleported to temple or kicked.
Can anybody do this?
 
should be something like this:

use this as a Global Event
LUA:
function onThink(interval)
    local players = getPlayersOnline()
    local specialPlayer = players[math.random(#players)]
    setGlobalStorageValue(12888, getPlayerName(specialPlayer))
    doBroadcastMessage(getPlayerName(specialPlayer .. " has been chosen to enter the secret door!")
end

add this to your doors.lua script already in the action folder in the end(before the last return)
LUA:
...
if item.uid == 12888 and getCreatureName(cid) == getGlobalStorageValue(12888) then    doTransformItem(item.uid, door.transformUseTo)
    return true
end
...

Can't guarantee it'll be copy-paste and it'll work, i just made it up right now and i havent tested it
 
Back
Top