Raised This Month: $51 Target: $400
 12% 

[L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)


Post New Thread Reply   
 
Thread Tools Display Modes
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 02-27-2017 , 17:14   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #251

Does someone know if there's a way to set how many votes are needed to a Yes/No vote to pass? Or it's always unanimous?

Last edited by joao7yt; 02-27-2017 at 17:21.
joao7yt is offline
dustinandband
Senior Member
Join Date: May 2015
Old 04-30-2017 , 01:35   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #252

Hi - trying to use nativevotes to call two votes in a row in L4D2. I had Drixevel look over the code and he said it looks good so he suggested I post here. I know it must be possible since I remember there being a promod server that had a feature where after a !match vote was called, 2 additional votes poped up - one asking if users wanted to enable addons, and a second asking if they wanted to enable scripts - using the native votes style HUD.

This plugin attemps to set survivor_limit and sv_maxplayers within one command. The second vote (change server slots) works if a vote is passed or failed - but the first vote only works 50% of the time. Issue is the first vote passes when it's not suppose to.
https://youtu.be/htNfP92Ulpw first time it works fine
https://youtu.be/htNfP92Ulpw?t=2m48s Shouldn't have passed but did anyway.

It's only the first vote we're having issues with ("Change survivor limit to #?").

PHP Code:
//Pragma
#pragma semicolon 1
//#pragma newdecls required

//Sourcemod Includes
#include <sourcemod>
//#include <sourcemod-misc>
#include <nativevotes>

//ConVars
ConVar convar_Status;

//Globals
int votefor;

public 
Plugin myinfo 
{
    
name "Player Mode Vote"
    
author "unkonwn"
    
description "Vote for the player mode."
    
version "1.0"
    
url ""
};

public 
void OnPluginStart()
{
    
LoadTranslations("common.phrases");
    
    
convar_Status CreateConVar("sm_playermodevote_status""1""Status of the plugin.\n1 = on, 0 = off"FCVAR_NOTIFYtrue0.0true1.0);
    
AutoExecConfig();
    
    
RegConsoleCmd("sm_playermode"Command_PlayerModeVote);
}

public 
Action Command_PlayerModeVote(int clientint args)
{
    
//definitions
    
if (!GetConVarBool(convar_Status) || client == 0)
    {
        return 
Plugin_Handled;
    }
    
    
char sGamemode[32];
    
GetConVarString(FindConVar("mp_gamemode"), sGamemodesizeof(sGamemode));
    
    if (
StrContains(sGamemode"versus") != -|| StrContains(sGamemode"scavenge") != -|| StrContains(sGamemode"mutation12") != -|| StrContains(sGamemode"mutation15") != -|| StrContains(sGamemode"mutation18") != -|| StrContains(sGamemode"survival") != -1)
    {
        
PrintToChat(client"You cannot use this command while the gamemode '%s' is active."sGamemode);
        return 
Plugin_Handled;
    }
    
    if (
GetClientTeam(client) == 1)
    {
        
PrintToChat(client"You cannot call this vote while in spectator.");
        return 
Plugin_Handled;
    }
    
    
char sValue[12];
    
GetCmdArg(1sValuesizeof(sValue));
    
votefor StringToInt(sValue);
    
    if (
votefor || votefor 4)
    {
        
PrintToChat(client"Value must be between 1 and 4.");
        return 
Plugin_Handled;
    }
    
    
//voting
    
Handle vote NativeVotes_Create(MenuHandler_VoteMaxPlayersNativeVotesType_Custom_YesNo);
    
NativeVotes_SetInitiator(voteclient);

    
char sDetails[256];
    
FormatEx(sDetailssizeof(sDetails), "Change survivor limit to %i?"votefor);
    
NativeVotes_SetDetails(votesDetails);
    
NativeVotes_DisplayToAll(vote20);
    
    return 
Plugin_Handled;
}

//maxplayers vote
public int MenuHandler_VoteMaxPlayers(Menu menuMenuAction actionint param1int param2)
{
    switch (
action)
    {
    case 
MenuAction_VoteEnd:
        {
            if (
param1 == NATIVEVOTES_VOTE_YES)
            {
                
char sDetails[256];
                
FormatEx(sDetailssizeof(sDetails), "Survivor limit changed to %i"votefor);
                
NativeVotes_DisplayPass(menusDetails);
                
                
SetConVarInt(FindConVar("survivor_limit"), votefor);
                
CreateTimer(3.5Timer_NewVote);
            }
            else
            {
                
NativeVotes_DisplayFail(menuNativeVotesFail_Loses);
            }
        }
        
    case 
MenuAction_VoteCancel:
        {
            if (
param1 == VoteCancel_NoVotes)
            {
                
NativeVotes_DisplayFail(menuNativeVotesFail_NotEnoughVotes);
            }
            else
            {
                
NativeVotes_DisplayFail(menuNativeVotesFail_Generic);
            }
        }
        
    case 
MenuAction_End:
        {
            
NativeVotes_Close(menu);
        }
    }
}

//slots vote handler
public Action:Timer_NewVote(Handle:hTimerdata:client)
{
    
Handle vote NativeVotes_Create(MenuHandler_VoteMaxSlotsNativeVotesType_Custom_YesNo);
    
NativeVotes_SetInitiator(voteclient);

    
char sDetails[256];
    
FormatEx(sDetailssizeof(sDetails), "Change server slots to %i as well?"votefor);
    
NativeVotes_SetDetails(votesDetails);
    
NativeVotes_DisplayToAll(vote20);
    
    return 
Plugin_Handled;
}

//slots vote
public int MenuHandler_VoteMaxSlots(Menu menuMenuAction actionint param1int param2)
{
    switch (
action)
    {
    case 
MenuAction_VoteEnd:
        {
            if (
param1 == NATIVEVOTES_VOTE_YES)
            {
                
char sDetails[256];
                
FormatEx(sDetailssizeof(sDetails), "Survivor limit & slots changed to %i"votefor);
                
NativeVotes_DisplayPass(menusDetails);
                
                
SetConVarInt(FindConVar("sv_maxplayers"), votefor);
                
CreateTimer(3.0Timer_MapLoad);
            }
            else
            {
                
NativeVotes_DisplayFail(menuNativeVotesFail_Loses);
                
CreateTimer(3.0Timer_MapLoad);
            }
        }
        
    case 
MenuAction_VoteCancel:
        {
            if (
param1 == VoteCancel_NoVotes)
            {
                
CreateTimer(3.0Timer_MapLoad);
                
NativeVotes_DisplayFail(menuNativeVotesFail_NotEnoughVotes);
            }
            else
            {

                
CreateTimer(3.0Timer_MapLoad);
                
NativeVotes_DisplayFail(menuNativeVotesFail_Generic);
            }
        }
        
    case 
MenuAction_End:
        {
            
NativeVotes_Close(menu);
        }
    }
}

//restart map so maxplayers can change
public Action:Timer_MapLoad(Handle:hTimer)
{
    new 
String:sMap[64];
    
GetCurrentMap(sMapsizeof(sMap));
    
ForceChangeLevel(sMap"Reloading map...");

dustinandband is offline
Electr000999
Senior Member
Join Date: Aug 2011
Old 12-16-2017 , 07:38   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #253

found bug with call NativeVotes_DisplayPassEx:

L 12/16/2017 - 17:13:01: [SM] Exception reported: Client index -1 is invalid
L 12/16/2017 - 17:13:01: [SM] Blaming: _Vote\nativevotes.smx
L 12/16/2017 - 17:13:01: [SM] Call stack trace:
L 12/16/2017 - 17:13:01: [SM] [0] StartMessage
L 12/16/2017 - 17:13:01: [SM] [1] Line 256, F:\servers\l4d2_dev\left4dead2\addons\sourcem od\scripting_sm1.8\include\usermessages.inc:: StartMessageOne
L 12/16/2017 - 17:13:01: [SM] [2] Line 2052, nativevotes/game.sp::L4D2_VotePass
L 12/16/2017 - 17:13:01: [SM] [3] Line 733, nativevotes/game.sp::Game_DisplayRawVotePass
L 12/16/2017 - 17:13:01: [SM] [4] Line 696, nativevotes/game.sp::Game_DisplayVotePassEx
L 12/16/2017 - 17:13:01: [SM] [5] Line 2197, nativevotes.sp::Native_DisplayPassEx
L 12/16/2017 - 17:13:01: [SM] [7] NativeVotes_DisplayPassEx

this issued if use game types of vote pass for example NativeVotesPass_ChgLevel, NativeVotesPass_ChgCampaign, NativeVotesPass_Kick

BECAUSE: in nativevotes/game.sp: at 733 arguments in call L4D2_VotePass messed up, line see screnshot and you see what
team and client arguments messed up in call L4D2_VotePass function.
Attached Thumbnails
Click image for larger version

Name:	77333.PNG
Views:	511
Size:	20.9 KB
ID:	167217  

Last edited by Electr000999; 12-16-2017 at 07:49.
Electr000999 is offline
Send a message via Skype™ to Electr000999
Degeso
New Member
Join Date: Jan 2018
Location: Germany
Old 07-06-2018 , 18:01   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #254

unsure if this plugin can be considered dead, but may csgo be revisited since panorama there released now?
I don't know if that actually changes the behaviour of the voting system, but you never know...

Would obviously be great to see this working in csgo again.
Degeso is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 07-06-2018 , 19:37   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #255

Quote:
Originally Posted by Degeso View Post
unsure if this plugin can be considered dead, but may csgo be revisited since panorama there released now?
I don't know if that actually changes the behaviour of the voting system, but you never know...

Would obviously be great to see this working in csgo again.
I agree, it's broken now in cs go if you join the game with "-panorama" parameter
joao7yt is offline
foon
Member
Join Date: Dec 2018
Old 10-11-2019 , 07:49   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #256

I am getting constant server crashes for TF2 on Linux (on windows, everything works fine). It only happens when you RTV. You know its going to crash the server when you rtv and it doesn't make the normal vote jingle sound.

Crashdump: https://crash.limetech.org/zdh2en5pgeo4

Every time its: sourcemod.logic.so!CForward::Execute [ForwardSys.cpp:255 + 0x0]

And here is votediagnostics if its needed.

Code:
L 10/11/2019 - 06:29:37: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:29:37: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:30:24: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:30:24: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:30:26: [votediagnostics.smx] Vote Cast event: vote_option: 3, team: 0, client: foon
L 10/11/2019 - 06:30:26: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_fifthcurve_b6, voteType: 0
L 10/11/2019 - 06:30:58: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:35:05: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:35:49: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:35:49: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:35:57: [votediagnostics.smx] Vote Cast event: vote_option: 2, team: 0, client: foon
L 10/11/2019 - 06:35:57: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_goldrush, voteType: 0
L 10/11/2019 - 06:36:30: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:37:08: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:37:52: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:37:52: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:37:57: [votediagnostics.smx] Vote Cast event: vote_option: 1, team: 0, client: foon
L 10/11/2019 - 06:37:57: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_clifftop_b3, voteType: 0
L 10/11/2019 - 06:38:30: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:39:58: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:39:58: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:40:06: [votediagnostics.smx] Vote Cast event: vote_option: 4, team: 0, client: foon
L 10/11/2019 - 06:40:06: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_hoodoo_final, voteType: 0
L 10/11/2019 - 06:40:06: [votediagnostics.smx] foon used vote command: vote option5
L 10/11/2019 - 06:40:06: [votediagnostics.smx] foon used vote command: vote option5
L 10/11/2019 - 06:40:51: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:40:51: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:40:53: [votediagnostics.smx] Vote Cast event: vote_option: 3, team: 0, client: foon
L 10/11/2019 - 06:40:53: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_badwater_pro_v12, voteType: 0
L 10/11/2019 - 06:41:18: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:42:15: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:42:15: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:42:19: [votediagnostics.smx] Vote Cast event: vote_option: 2, team: 0, client: foon
L 10/11/2019 - 06:42:19: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_boundary_final1, voteType: 0
L 10/11/2019 - 06:42:19: [votediagnostics.smx] foon used vote command: vote option3
L 10/11/2019 - 06:42:19: [votediagnostics.smx] foon used vote command: vote option3
L 10/11/2019 - 06:43:09: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:43:09: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:43:15: [votediagnostics.smx] Vote Cast event: vote_option: 4, team: 0, client: foon
L 10/11/2019 - 06:43:15: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_goldrush, voteType: 0
L 10/11/2019 - 06:43:41: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:44:13: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:44:56: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:44:56: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:44:59: [votediagnostics.smx] Vote Cast event: vote_option: 2, team: 0, client: foon
L 10/11/2019 - 06:44:59: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_borneo, voteType: 0
L 10/11/2019 - 06:44:59: [votediagnostics.smx] foon used vote command: vote option3
L 10/11/2019 - 06:44:59: [votediagnostics.smx] foon used vote command: vote option3
L 10/11/2019 - 06:45:50: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:45:50: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:45:52: [votediagnostics.smx] Vote Cast event: vote_option: 0, team: 0, client: foon
L 10/11/2019 - 06:45:52: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_clifftop_b3, voteType: 0
L 10/11/2019 - 06:46:14: [votediagnostics.smx] Game: tf
L 10/11/2019 - 06:47:14: [votediagnostics.smx] VoteStart Usermessage: team: 0, initiator: 99, issue: #TF_vote_nextlevel_choices, otherTeamIssue: , param1: , multipleChoice: 0, player count: 1, voteType: 0
L 10/11/2019 - 06:47:14: [votediagnostics.smx] Active Index for issue #TF_vote_nextlevel_choices: 0
L 10/11/2019 - 06:47:23: [votediagnostics.smx] Vote Cast event: vote_option: 2, team: 0, client: foon
L 10/11/2019 - 06:47:23: [votediagnostics.smx] VotePass Usermessage: team: 0, issue: #TF_vote_passed_nextlevel, param1: pl_sludgepit_final, voteType: 0
L 10/11/2019 - 06:47:47: [votediagnostics.smx] Game: tf

Last edited by foon; 10-11-2019 at 07:53.
foon is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 10-11-2019 , 16:30   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #257

Quote:
Originally Posted by foon View Post
I am getting constant server crashes for TF2 on Linux (on windows, everything works fine). It only happens when you RTV. You know its going to crash the server when you rtv and it doesn't make the normal vote jingle sound.
You're probably running into this issue.
There's a patch for NativeVotes, and an issue has been filed to try and get a fix sorted out in SM.

The below attachment corresponds to the hotfix that was PR'd, built against SM 1.9.
Attached Files
File Type: smx nativevotes.smx (51.6 KB, 246 views)
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 08-04-2020 at 01:43. Reason: Add prebuilt plugin
nosoop is offline
foon
Member
Join Date: Dec 2018
Old 10-12-2019 , 05:39   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #258

That worked, thanks!
foon is offline
greeneyo
New Member
Join Date: Apr 2020
Old 04-19-2020 , 09:31   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #259

Hello, i'm new here and I wanted to know if there were any fixes for the error shown when compiling this file?
Attached Thumbnails
Click image for larger version

Name:	nativevotes issue.PNG
Views:	305
Size:	6.4 KB
ID:	180893  
greeneyo is offline
doroemon
Senior Member
Join Date: Dec 2009
Location: TF2 AFK Server
Old 04-20-2020 , 11:49   Re: [L4D,L4D2,TF2,CSGO] NativeVotes (v0.8.3, 2014-10-16)
Reply With Quote #260

Quote:
Originally Posted by greeneyo View Post
Hello, i'm new here and I wanted to know if there were any fixes for the error shown when compiling this file?
Try this :
https://github.com/Silenci0/UMC/blob...ativevotes.inc
__________________
I'm just a guy who's a server operator for fun.
https://steamcommunity.com/groups/cfmsg
doroemon is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode