Skip to content

Commit

Permalink
feat: add NSCreateChoiceOnAllPlayers util function
Browse files Browse the repository at this point in the history
  • Loading branch information
Alystrasz committed Aug 5, 2024
1 parent 6787f28 commit e19cb6c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Northstar.Custom/mod/scripts/vscripts/sh_message_utils.gnut
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ global function MessageUtils_ServerInit

global function NSCreatePollOnPlayer
global function NSGetPlayerResponse
global function NSCreateChoiceOnAllPlayers
global function NSCreateChoiceOnPlayer
global function NSGetPlayerChoiceResponse

Expand Down Expand Up @@ -201,6 +202,18 @@ int function NSGetPlayerResponse( entity player )
return server.playerPollResponses[ player ] - 1
}

string function NSCreateChoiceOnAllPlayers( string option1, string option2, float duration )
{
string key = UniqueString()
foreach( player in GetPlayerArray() )
{
if ( !IsValid( player ) )
continue
NSCreateChoiceOnPlayer( player, option1, option2, duration, key )
}
return key
}

string function NSCreateChoiceOnPlayer( entity player, string option1, string option2, float duration, string key = "" )
{
string id = key != "" ? key : UniqueString()
Expand Down

0 comments on commit e19cb6c

Please sign in to comment.