Custom Votes [Panorama] 全景UI投票(可调用csgo游戏本身的投票界面) 游戏性拓展 通用内容 服务器管理

我不当学长 管理员组 2022-4-22 2434

插件介绍:

  • 此插件调用了csgo内部自带的投票功能以及全景UI的投票界面

LIF2gx.png

vote_panorama.smx的效果如下:

LIFfKK.png

特性:

• 自定义的投票显示内容. (HTML supported)
• 自定义的投票通过后的显示内容. (HTML supported)
• 自定义的面板图标 Customizable panel icons.
• 投票可以在任何时候被取消 Custom votes can be canceled at any time and moment.
• 玩家投票进行中完全可控 Full control over player voting.
• Ability of blocking & modifying votes.
• 向任意玩家群体显示自定义投票 Broadcast custom votes to any group of player you want.

插件依赖:

  • 依赖于customvotes.smx(它提供vote_panorama.smx需要的Native函数)
  • 编译依赖 1.10+ SourceMod

安装方法:

1. 将 'customvotes.smx' 、'vote_panorama.smx'放到 '/csgo/addons/sourcemod/plugins/'目录.
2. 运行 'sm plugins load customvotes'命令重新载入插件, 或者换图、重启服务器也可以.
3. 结束!

ConVars:

Code:
// Sound file path that will be played once a client has voted no.
// - 玩家选择“反对”时,播放的音频文件
// Default: "sound/ui/menu_invalid.wav"
custom_votes_negative_vote_sound "sound/ui/menu_invalid.wav"

// Sound file path that will be played once a client has voted yes.
// - 玩家选择“同意”时,播放的音频文件
// Default: "sound/ui/menu_accept.wav"
custom_votes_positive_vote_sound "sound/ui/menu_accept.wav


API(customvotes.sp实现,customvotes.inc头文件):

Code:
#if defined _customvotes_included
 #endinput
#endif
#define _customvotes_included

#define SERVER_OPERATOR_ID         0     /**< Console vote initiator id */
#define DEFAULT_PASS_PERCENTAGE 50.0 /**< Vote pass percenage that will be setted if 'pass_percentage' isn't setted */
#define VOTE_DURATION_FOREVER     0      /**< Vote should be broadcasted as long as possible */

/**
 * Client's custom vote decisions.
 */
enum
{
    
VOTE_DECISION_NONE = -1,
    
VOTE_DECISION_YES,
    
VOTE_DECISION_NO
}

/**
 * Vote issue. These are mapped to translation strings and pass strings by VoteStart and VotePass
 * https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/shareddefs.h#L185-L206
 */
enum
{
    
VOTE_ISSUE_UNDEFINED 1
    
VOTE_ISSUE_KICK
    
VOTE_ISSUE_CHANGELEVEL
    
VOTE_ISSUE_NEXTLEVEL
    
VOTE_ISSUE_SWAPTEAMS
    
VOTE_ISSUE_SCRAMBLE
    
VOTE_ISSUE_RESTARTGAME
    
VOTE_ISSUE_SURRENDER
    
VOTE_ISSUE_REMATCH
    
VOTE_ISSUE_CONTINUE
    
VOTE_ISSUE_PAUSEMATCH
    
VOTE_ISSUE_UNPAUSEMATCH
    
VOTE_ISSUE_LOADBACKUP
    
VOTE_ISSUE_ENDWARMUP
    
VOTE_ISSUE_STARTTIMEOUT
    
VOTE_ISSUE_ENDTIMEOUT
    
VOTE_ISSUE_READYFORMATCH
    
VOTE_ISSUE_NOTREADYFORMATCH
    
    
// Represents the highest possible index of the enum
    
VOTE_ISSUE_MAX
}

/**
 * Reasons a vote was failed.
 * https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/shareddefs.h#L142-L179
 */
enum
{
    
VOTE_FAILED_GENERIC 0
    
VOTE_FAILED_TRANSITIONING_PLAYERS
    
VOTE_FAILED_RATE_EXCEEDED,  // "time" is used
    
VOTE_FAILED_YES_MUST_EXCEED_NO
    
VOTE_FAILED_QUORUM_FAILURE
    
VOTE_FAILED_ISSUE_DISABLED
    
VOTE_FAILED_MAP_NOT_FOUND
    
VOTE_FAILED_MAP_NAME_REQUIRED
    
VOTE_FAILED_FAILED_RECENTLY,  // "time" is used
    
VOTE_FAILED_FAILED_RECENT_KICK,  // "time" is used
    
VOTE_FAILED_FAILED_RECENT_CHANGEMAP,  // "time" is used
    
VOTE_FAILED_FAILED_RECENT_SWAPTEAMS,  // "time" is used
    
VOTE_FAILED_FAILED_RECENT_SCRAMBLETEAMS,  // "time" is used
    
VOTE_FAILED_FAILED_RECENT_RESTART,  // "time" is used
    
VOTE_FAILED_TEAM_CANT_CALL
    
VOTE_FAILED_WAITINGFORPLAYERS
    
VOTE_FAILED_PLAYERNOTFOUND,  // Deprecated, same as generic failure
    
VOTE_FAILED_CANNOT_KICK_ADMIN
    
VOTE_FAILED_SCRAMBLE_IN_PROGRESS
    
VOTE_FAILED_SWAP_IN_PROGRESS
    
VOTE_FAILED_SPECTATOR
    
VOTE_FAILED_DISABLED
    
VOTE_FAILED_NEXTLEVEL_SET
    
VOTE_FAILED_REMATCH
    
VOTE_FAILED_TOO_EARLY_SURRENDER
    
VOTE_FAILED_CONTINUE
    
VOTE_FAILED_MATCH_PAUSED
    
VOTE_FAILED_MATCH_NOT_PAUSED
    
VOTE_FAILED_NOT_IN_WARMUP
    
VOTE_FAILED_NOT_10_PLAYERS
    
VOTE_FAILED_TIMEOUT_ACTIVE
    
VOTE_FAILED_TIMEOUT_INACTIVE,  // Deprecated, same as generic failure
    
VOTE_FAILED_TIMEOUT_EXHAUSTED
    
VOTE_FAILED_CANT_ROUND_END
    
    
// Represents the highest possible index of the enum
    
VOTE_FAILED_MAX
}

enum struct CustomVoteSetup
{
    
// Team id to broadcast the custom vote.
    // 
    // Note: This is ignored if 'clients' array is specified.
    //
    // CS_TEAM_NONE (0)          To everyone
    // CS_TEAM_SPECTATOR (1)   To spectators only
    // CS_TEAM_T (2)            To terrorists only
    // CS_TEAM_CT (3)          To counter-terrorists only
    
int team;
    
    
int clients[MAXPLAYERS]; // Array containing player indexes to broadcast to.
    
int client_count;         // Number of players in the array.
    
    // Custom vote initiator client index (who executed the vote), or SERVER_OPERATOR_ID for console. 
    
int initiator;
    
    
// Custom vote issue id to use, see the enum above.
    
int issue_id;
    
    
// The required percenage of players who voted positively for the custom vote to pass.
    // Leaving the variable value as 0.0 will automatically set it to 'DEFAULT_PASS_PERCENTAGE'.
    
float pass_percentage;
    
    
// Disposition string to display on the custom vote panel once the vote has executed. (HTML based text)
    
char dispstr[512];
    
    
// Disposition string to display on the custom vote panel once the vote has passed. (HTML based text)
    
char disppass[512];
    
    
// Optional data to parse through vote callbacks.
    
any data;
    
    
// Resets back everything to default values.
    
void Reset()
    {
        
this.team 0;
        
        for (
int current_indexcurrent_index MAXPLAYERScurrent_index++)
        {
            
this.clients[current_index] = 0;
        }
        
        
this.client_count 0;
        
this.initiator 0;
        
this.issue_id 0;
        
this.pass_percentage 0.0;
        
this.dispstr[0] = '\0';
        
this.disppass[0] = '\0';
        
this.data 0;
    }
}

/**
 * Any of the following prototypes will work as a custom vote callback.
 */
typeset CustomVote_Callback
{
    
/**
     * Called when a custom vote result is available.
     *
     * @param results        Array that contains the decisions of the voters.
     * @param data          Data passed to CustomVotes_Execute() when vote was executed.
     */
    
function void (int results[MAXPLAYERS 1], any data);
    
    
/**
     * Called when a custom vote result is available.
     *
     * @param results        Array that contains the decisions of the voters.
     */
    
function void (int results[MAXPLAYERS 1]);
};

/**
 *    Executes a custom CS:GO panel vote.
 *    
 *    @param setup                A fully configurated custom    vote setup data struct.
 *  @param timeout_duration        Time in seconds for the custom vote to display until timeout, 
 *                                or 'VOTE_DURATION_FOREVER' to last it as long as possible.
 *  @param passed_callback      Callback function to call once the vote has passed.
 *  @param failed_callback      Callback function to call once the vote has failed.
 *  @param data                   Optional data value to pass to the callback(s).
 *
 *  @error                         Another custom vote is currently in progress.
 */
native void CustomVotes_Execute(any[] setupint timeout_durationCustomVote_Callback passed_callback INVALID_FUNCTIONCustomVote_Callback failed_callback INVALID_FUNCTIONany data 0);

/**
 * Returns whether a custom vote is in progress.
 *
 * @return                      True if a custom vote is in progress, false otherwise.
 */
native bool CustomVotes_IsVoteInProgress();

/**
 * Returns the configurated custom vote setup data struct of the current vote in progress.
 * 
 * @param buffer                Buffer to store the setup data.
 * @error                        No custom vote is currently in progress.
 */
native void CustomVotes_GetSetup(any[] buffer);

/**
 * Cancels the current vote in progress.
 * 
 * @param force                 If set to true, this forces the custom vote to be cancelled, even if it's not being executed from the called plugin.
 * @error                        No custom vote is currently in progress.
 */
native void CustomVotes_Cancel(bool force false);

/**
 * Retrieves all the players decisions related to the current custom vote.
 * 
 * @param results                 Buffer to store the vote decision results. (See the enum above)
 * @error                        No custom vote is currently in progress.
 */
native void CustomVotes_GetVoteDecisions(int results[MAXPLAYERS 1]);

/**
 * Called when a custom vote is receiving from a client.
 * 
 * @param client                 Client index.
 * @param voteDecision              Client's vote decision. See the enum above.
 * @return                           An Action value. Returning Plugin_Handled bypasses the game function call.
 *                                Returning Plugin_Stop bypasses the post hook as well as the game function.
 */
forward Action CustomVotes_OnVoteReceive(int clientint &voteDecision);

#if !defined REQUIRE_PLUGIN
public void __pl_customvotes_SetNTVOptional()
{
    
MarkNativeAsOptional("CustomVotes_Execute");
    
MarkNativeAsOptional("CustomVotes_IsVoteInProgress");
    
MarkNativeAsOptional("CustomVotes_GetSetup");
    
MarkNativeAsOptional("CustomVotes_Cancel");
    
MarkNativeAsOptional("CustomVotes_GetVoteDecisions");
}
#endif

public SharedPlugin __pl_customvotes 
{
    
name "customvotes"
    
file "customvotes.smx"
#if defined REQUIRE_PLUGIN
    
required 1
#else
    
required 0
#endif
}; 


使用方法:

!zanting //调用暂停投票(这里并没有真的实现暂停功能,需要自己实现)
!huifu //调用恢复比赛投票(这里并没有真的实现恢复比赛功能,需要自己实现)

*注意:

本插件的依赖插件名字叫做customvotes.smx,和论坛里的另外一个自定义投票插件重名了,用的时候要注意,别起冲突!

下载地址:

链接: https://pan.baidu.com/s/1vwDorx4CnWMEj2WqsWvy5Q?pwd=1vwe 提取码: 1vwe 复制这段内容后打开百度网盘手机App,操作更方便哦 
--来自百度网盘超级会员v4的分享

参考:

上传的附件:

CSGO插件分享-申明 1、本网站名称:CSGO插件分享-中文站  网址:https://bbs.csgocn.net
2、本站的宗旨在于为CSGO玩家提供一个插件分享的中文资源平台,多数插件来源于SourceMod论坛,并配以中文介绍和安装教程。
3、欢迎有能力的朋友共享有趣的CSGO插件资源。
4、本站资源大多为百度网盘,如发现链接失效,可以点: 这里进行反馈,我们会第一时间更新。
最新回复 (0)
返回