EventPack/eventManager
Download the raw EventPack/eventManager.ser file
Uses: AmountOf · Broadcast · Except · Filter · Reply · RestartRound · RoundInfo · RunScript · SetCustomInfo · VarExists · CustomCommand
Complete script
EventPack/eventManager.ser
# Event Pack administrator entry point.
# Enable the complete EventPack folder generated by serexamples, not this file alone.
!-- CustomCommand event
-- availableFor RemoteAdmin Server
-- description "Starts and controls the build-validated SER Event Pack."
-- neededPermission serverevent.manage
-- noPermissionMessage "You do not have the serverevent.manage permission."
-- arguments action eventName? optionOne? optionTwo? optionThree?
func $DeathmatchWeapon with $rawWeapon
$normalizedWeapon = $rawWeapon -> lower
if $normalizedWeapon is "ak" or $normalizedWeapon is "gunak"
return "GunAK"
elif $normalizedWeapon is "e11" or $normalizedWeapon is "gune11sr"
return "GunE11SR"
elif $normalizedWeapon is "crossvec" or $normalizedWeapon is "guncrossvec"
return "GunCrossvec"
elif $normalizedWeapon is "fsp9" or $normalizedWeapon is "gunfsp9"
return "GunFSP9"
elif $normalizedWeapon is "logicer" or $normalizedWeapon is "gunlogicer"
return "GunLogicer"
elif $normalizedWeapon is "shotgun" or $normalizedWeapon is "gunshotgun"
return "GunShotgun"
elif $normalizedWeapon is "revolver" or $normalizedWeapon is "gunrevolver"
return "GunRevolver"
elif $normalizedWeapon is "com15" or $normalizedWeapon is "guncom15"
return "GunCOM15"
elif $normalizedWeapon is "com18" or $normalizedWeapon is "guncom18"
return "GunCOM18"
elif $normalizedWeapon is "com45" or $normalizedWeapon is "guncom45"
return "GunCom45"
elif $normalizedWeapon is "frmg0" or $normalizedWeapon is "gunfrmg0"
return "GunFRMG0"
elif $normalizedWeapon is "a7" or $normalizedWeapon is "guna7"
return "GunA7"
elif $normalizedWeapon is "particle" or $normalizedWeapon is "particledisruptor"
return "ParticleDisruptor"
elif $normalizedWeapon is "micro" or $normalizedWeapon is "microhid"
return "MicroHID"
elif $normalizedWeapon is "jailbird"
return "Jailbird"
elif $normalizedWeapon is "scp127" or $normalizedWeapon is "gunscp127"
return "GunSCP127"
elif $normalizedWeapon is "scp1509"
return "SCP1509"
end
return "invalid"
end
$action = $action -> lower
if {VarExists $eventName}
$eventName = $eventName -> lower
end
if {VarExists $optionOne}
$optionOne = $optionOne -> lower
end
if {VarExists $optionTwo}
$optionTwo = $optionTwo -> lower
end
if $action is "list" or $action is "help"
Reply "EVENT PACK | deathmatch (dm), duel<br>Start: event start deathmatch [ffa/team] [lcz/hcz/entrance] [weapon]<br>Start: event start duel [Jailbird/SCP1509]<br>Control: event status | event stop confirm"
stop
end
if $action is "status"
if {VarExists $serPackActive} is false
Reply "EVENT PACK | No event is active."
stop
end
if $serPackActive is false
Reply "EVENT PACK | No event is active."
stop
end
Reply "EVENT PACK | Active: {$serPackName} | Phase: {$serPackPhase}"
stop
end
if $action is "stop"
if {VarExists $serPackActive} is false
Reply "EVENT PACK | No event is active."
stop
end
if $serPackActive is false
Reply "EVENT PACK | No event is active."
stop
end
if {VarExists $eventName} is false
Reply "EVENT PACK | This operation restarts the round. Use: event stop confirm"
stop
end
if $eventName isnt "confirm"
Reply "EVENT PACK | This operation restarts the round. Use: event stop confirm"
stop
end
Broadcast @all 5s "<color=#ff6b6b><b>EVENT CANCELLED</b></color><br>An administrator stopped the event. The round will restart."
SetCustomInfo @all ""
Reply "EVENT PACK | Stopping the event and restarting the round."
wait 2s
RestartRound
stop
end
if $action isnt "start"
Reply "EVENT PACK | Unknown action. Use: event list"
stop
end
if {VarExists $eventName} is false
Reply "EVENT PACK | Missing event name. Use: event list"
stop
end
if {VarExists $serPackActive}
if $serPackActive
Reply "EVENT PACK | {$serPackName} is already running (phase: {$serPackPhase})."
stop
end
end
if {RoundInfo hasStarted}
Reply "EVENT PACK | Events can only be started from the pre-round lobby."
stop
end
if {RoundInfo hasEnded}
Reply "EVENT PACK | The round is ending. Wait for the next lobby."
stop
end
@eventParticipants = Filter @all isNpc false
@eventParticipants = Filter @eventParticipants isDummy false
@eventParticipants = Except @eventParticipants @overwatchPlayers
# A player-backed administrator is the organizer by default, not a participant.
if {VarExists @sender}
@eventParticipants = Except @eventParticipants @sender
end
if {AmountOf @eventParticipants} < 2
Reply "EVENT PACK | At least two participants are required (the organizer is not included)."
stop
end
if $eventName is "deathmatch" or $eventName is "dm"
$eventMode = "ffa"
$eventZone = "hcz"
$eventWeapon = "GunAK"
if {VarExists $optionOne}
if $optionOne is "ffa"
$eventMode = "ffa"
elif $optionOne is "team" or $optionOne is "teams"
$eventMode = "team"
else
Reply "EVENT PACK | Mode must be ffa or team."
stop
end
end
if {VarExists $optionTwo}
if $optionTwo is "lcz"
$eventZone = "lcz"
elif $optionTwo is "hcz"
$eventZone = "hcz"
elif $optionTwo is "entrance" or $optionTwo is "ez"
$eventZone = "entrance"
else
Reply "EVENT PACK | Zone must be lcz, hcz, or entrance."
stop
end
end
if {VarExists $optionThree}
$eventWeapon = run $DeathmatchWeapon $optionThree
if $eventWeapon is "invalid"
Reply "EVENT PACK | Unsupported weapon. Use a full ItemType name or one of these short names: AK, E11, Crossvec, FSP9, Logicer, Shotgun, Revolver, COM15, COM18, COM45, FRMG0, A7, Particle, Micro, Jailbird, SCP127, SCP1509."
stop
end
end
global $serPackActive = true
global $serPackName = "Deathmatch"
global $serPackPhase = "Starting"
attempt
RunScript eventDeathmatch @eventParticipants $eventMode $eventZone $eventWeapon
on_error with $startError
delete $serPackActive
delete $serPackName
delete $serPackPhase
Reply "EVENT PACK | Failed to start Deathmatch: {$startError}"
stop
end
Reply "EVENT PACK | Started Deathmatch: {$eventMode}, {$eventZone}, {$eventWeapon}."
stop
end
if $eventName is "duel"
$eventWeapon = "Jailbird"
if {VarExists $optionTwo}
Reply "EVENT PACK | Duel accepts one weapon option. Use: event start duel [Jailbird/SCP1509]"
stop
end
if {VarExists $optionThree}
Reply "EVENT PACK | Duel accepts one weapon option. Use: event start duel [Jailbird/SCP1509]"
stop
end
if {VarExists $optionOne}
if $optionOne is "jailbird"
$eventWeapon = "Jailbird"
elif $optionOne is "scp1509" or $optionOne is "1509"
$eventWeapon = "SCP1509"
else
Reply "EVENT PACK | Duel weapon must be Jailbird or SCP1509."
stop
end
end
global $serPackActive = true
global $serPackName = "Duel"
global $serPackPhase = "Starting"
attempt
RunScript eventDuel @eventParticipants $eventWeapon
on_error with $startError
delete $serPackActive
delete $serPackName
delete $serPackPhase
Reply "EVENT PACK | Failed to start Duel: {$startError}"
stop
end
Reply "EVENT PACK | Started Duel with {$eventWeapon}."
stop
end
Reply "EVENT PACK | Unknown event. Use: event list"
This file is compiled during the SER build and is safe to use as a current-syntax learning example.