# Disabled by default: remove # from the filename to enable this script. # this script adds a fully functioning coin with custom behaviors !-- OnEvent FlippingCoin # formats of broadcasts, used to not repeat the same things in different broadcasts $hintInfo = "" $baseText = "the holy coin has been used
" $afterText = "" # "coin locked" is a property of this player, storing whether a coin can be used. # this is because some effects of the coin take time, and we DO NOT want to # have the coin be used again WHILE a different effect is still ongoing if {GetPlayerData @evPlayer "coin locked" false} is true Hint @evPlayer 5s "{$hintInfo}You can't use the coin for now!
Come back when the current effect has finished." IsAllowed false stop end # 50% chance to lose the coin chance 50% Hint @evPlayer 3s "{$hintInfo}Your coin has turned into dust..." AdvDestroyItem {@evPlayer -> heldItemRef} end # select a random effect of the coin, from 9 available $effect = Random 1 9 int # give the player a revolver for a round of russian roulette if $effect is 1 GiveItem @evPlayer GunRevolver Broadcast @evPlayer 5s "{$baseText}Let's play russian roulette!" stop end # HP change if $effect is 2 $newHP = Random 1 150 int SetHealth @evPlayer $newHP SetMaxHealth @evPlayer $newHP Broadcast @evPlayer 5s "{$baseText}You now have {$newHP} HP!" stop end # rave if $effect is 3 *room = @evPlayer -> roomRef # explode player if he isnt in a room if {*room -> isInvalid} Explode @evPlayer stop end # we are blocking the use of the coin for the player # until the rave is over SetPlayerData @evPlayer "coin locked" true Broadcast @evPlayer 5s "{$baseText}Time for a rave!" CloseDoor *room LockDoor *room AdminCommand SetLightColor *room #000000 repeat 5 SetLightColor *room #ff0000 _ .5s wait .5s SetLightColor *room #00ff00 _ .5s wait .5s SetLightColor *room #0000ff _ .5s wait .5s end wait .1s UnlockDoor *room ResetLightColor *room SetPlayerData @evPlayer "coin locked" false stop end # bomb if $effect is 4 SetPlayerData @evPlayer "coin locked" true $initRole = @evPlayer -> role Countdown @evPlayer 15s "{$baseText}You have %seconds% seconds left to live!" # waiting 15 seconds here repeat 15 wait 1s # every second we are checking if the role of the player changed # if so, we remove the countdown and unlock the coin if {@evPlayer -> role} isnt $initRole ClearCountdown @evPlayer SetPlayerData @evPlayer "coin locked" false stop end end Explode @evPlayer SetPlayerData @evPlayer "coin locked" false stop end # bypass if $effect is 5 $initRole = @evPlayer -> role SetPlayerData @evPlayer "coin locked" true Countdown @evPlayer 15s "{$baseText}You can now open any keycard locked thing! (for %seconds% seconds)" SetBypass @evPlayer true repeat 15 wait 1s if {@evPlayer -> role} isnt $initRole ClearCountdown @evPlayer break end end SetBypass @evPlayer false SetPlayerData @evPlayer "coin locked" false stop end # role downgrade if $effect is 6 $role = @evPlayer -> role if $role isnt "ClassD" SetRole @evPlayer ClassD None elif $role isnt "Scp0492" SetRole @evPlayer Scp0492 else SetRole @evPlayer Spectator end Broadcast @evPlayer 5s "{$baseText}Your role got downgraded!" stop end # funny cassie if $effect is 7 SetPlayerData @evPlayer "coin locked" true Cassie noJingle "pitch_0.7 warning . pitch_3 XMAS_JINGLEBELLS" "" Broadcast @evPlayer 5s "{$baseText}Most useful cassie message sent!" wait 7s SetPlayerData @evPlayer "coin locked" false stop end # change size if $effect is 8 # set player size in every direction to a random number between 10% and 100% SetSize @evPlayer {Random 0.1 1 real} {Random 0.1 1 real} {Random 0.1 1 real} Broadcast @evPlayer 5s "{$baseText}Your size has changed a little!" stop end # swap places if $effect is 9 # cant swap places if there arent at least 2 players if {AmountOf @alivePlayers} < 2 Explode @evPlayer stop end # gets a random alive player that is not @evPlayer @swapPlayer = Take {Except @alivePlayers @evPlayer} 1 $swapX = @swapPlayer -> posX $swapY = @swapPlayer -> posY $swapZ = @swapPlayer -> posZ # we can teleport @swapPlayer directly to @evPlayer TPPlayer @swapPlayer @evPlayer Broadcast @swapPlayer 5s "{$baseText}You have swapped places with {@evPlayer -> name}" # because @swapPlayer is in the same place as @evPlayer, we need to use the saved values to teleport TPPosition @evPlayer $swapX $swapY $swapZ Broadcast @evPlayer 5s "{$baseText}You have swapped places with {@swapPlayer -> name}" stop end