Raised This Month: $32 Target: $400
 8% 

[CS:GO] Custom Votes [Panorama] (v2.0 | 9 August 2021)


Post New Thread Reply   
 
Thread Tools Display Modes
KoNLiG
AlliedModders Donor
Join Date: Sep 2020
Location: Israel
Old 08-10-2021 , 16:51   Re: [CS:GO] Custom Votes [Panorama] (v1.0 | 9 August 2021)
Reply With Quote #11

Quote:
Originally Posted by kratoss1812 View Post
Really really cool Can you control to who the vote is beeing displayed or it is just for everyone?
You can choose what a team id to broadcast to, maybe in the future a 'CustomVotes_ExecuteToClient' native will be added.
__________________
For questions/plugin requests contact me:

• Discord: KoNLiG#6417
• Steam: KoNLiG
KoNLiG is offline
NanoC
Veteran Member
Join Date: Jan 2016
Location: Argentina
Old 08-10-2021 , 18:31   Re: [CS:GO] Custom Votes [Panorama] (v1.0 | 9 August 2021)
Reply With Quote #12

Quote:
Originally Posted by KoNLiG View Post
Of course, it's possible to replicate SourceMod vote commands (!customvote, !cancelcustomvote), but it's not possible to create a multiple choice vote because the game only supports Yes/No votes.
It doesn't matter. It'd be really cool.
Something like !customvote "extend the current map?", etc
__________________
NanoC is offline
Send a message via Skype™ to NanoC
Cruze
Veteran Member
Join Date: May 2017
Old 08-11-2021 , 13:11   Re: [CS:GO] Custom Votes [Panorama] (v1.0 | 9 August 2021)
Reply With Quote #13

Quote:
Originally Posted by NanoC View Post
It doesn't matter. It'd be really cool.
Something like !customvote "extend the current map?", etc
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <customvotes>

#define MAX_SIZE 256

public void OnPluginStart()
{
    
RegConsoleCmd("sm_customvote"Command_CustomVote);
}

public 
Action Command_CustomVote(int clientint args)
{
    if (
CustomVotes_IsVoteInProgress())
    {
        return 
Plugin_Handled;
    }
    
    
char sBuffer[MAX_SIZE];
    
    
GetCmdArgString(sBufferMAX_SIZE);
    
    
ReplaceString(sBufferMAX_SIZE"\\n""<br>");
    
    
Format(sBufferMAX_SIZE"<font color='#FF5500' class='fontSize-xxxl'>%s?</font>"sBuffer);
    
    
CustomVoteSetup setup;
    
    
setup.team CS_TEAM_NONE;
    
setup.initiator client;
    
setup.issue_id VOTE_ISSUE_UNPAUSEMATCH;
    
setup.dispstr sBuffer;
    
setup.disppass "<font color='#3df218'>Vote Passed!</font>";

    
CustomVotes_Execute(setup15Handler_CustomVotePassedHandler_CustomVoteFailed);

    return 
Plugin_Handled;


public 
void Handler_CustomVotePassed(int results[MAXPLAYERS+1])
{
    
//PrintToChatAll("[SM] Vote Passed.");
}

public 
void Handler_CustomVoteFailed(int results[MAXPLAYERS+1])
{
    
//PrintToChatAll("[SM] Vote Failed.");

__________________
Taking paid private requests! Contact me
Cruze is offline
mrmiki
Junior Member
Join Date: Mar 2021
Old 08-14-2021 , 00:51   Re: [CS:GO] Custom Votes [Panorama] (v1.0 | 9 August 2021)
Reply With Quote #14

Quote:
Originally Posted by Cruze View Post
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <customvotes>

#define MAX_SIZE 256

public void OnPluginStart()
{
    
RegConsoleCmd("sm_customvote"Command_CustomVote);
}

public 
Action Command_CustomVote(int clientint args)
{
    if (
CustomVotes_IsVoteInProgress())
    {
        return 
Plugin_Handled;
    }
    
    
char sBuffer[MAX_SIZE];
    
    
GetCmdArgString(sBufferMAX_SIZE);
    
    
ReplaceString(sBufferMAX_SIZE"\\n""<br>");
    
    
Format(sBufferMAX_SIZE"<font color='#FF5500' class='fontSize-xxxl'>%s?</font>"sBuffer);
    
    
CustomVoteSetup setup;
    
    
setup.team CS_TEAM_NONE;
    
setup.initiator client;
    
setup.issue_id VOTE_ISSUE_UNPAUSEMATCH;
    
setup.dispstr sBuffer;
    
setup.disppass "<font color='#3df218'>Vote Passed!</font>";

    
CustomVotes_Execute(setup15Handler_CustomVotePassedHandler_CustomVoteFailed);

    return 
Plugin_Handled;


public 
void Handler_CustomVotePassed(int results[MAXPLAYERS+1])
{
    
//PrintToChatAll("[SM] Vote Passed. (%s)" );
}

public 
void Handler_CustomVoteFailed(int results[MAXPLAYERS+1])
{
    
//PrintToChatAll("[SM] Vote Failed.");










HTML Code:
	CustomVotes_Execute(setup, 15, Handler_CustomVotePassed, Handler_CustomVoteFailed);

    return Plugin_Handled;
} 

public void Handler_CustomVotePassed(int results[MAXPLAYERS+1])
{
	//PrintToChatAll("[SM] Vote Passed (%s) ", sBuffer);
}


hi how can i send sBuffer data to Handler_CustomVotePassed so i can print the information?


(sBuffer is just an example)
i want to use player names and ...

Last edited by mrmiki; 08-14-2021 at 00:53.
mrmiki is offline
KoNLiG
AlliedModders Donor
Join Date: Sep 2020
Location: Israel
Old 08-14-2021 , 07:37   Re: [CS:GO] Custom Votes [Panorama] (v1.0 | 9 August 2021)
Reply With Quote #15

'results[MAXPLAYERS+1]' stores the clients vote decisions by this enum (located in customvotes.inc):
Code:
/**
 * Client's custom vote decisions.
 */
enum
{
	VOTE_DECISION_NONE = -1,
	VOTE_DECISION_YES,
	VOTE_DECISION_NO
}
So for example, if you want to know what each player voted for it'd be like this:
Code:
public void Handler_CustomVotePassed(int results[MAXPLAYERS + 1])
{
	for (int current_client = 1; current_client <= MaxClients; current_client++)
	{
		// If the current client isn't in game, results[current_client] will always be 'VOTE_DECISION_NONE'.
		if (IsClientInGame(current_client))
		{
			switch (results[current_client])
			{
				// Didn't vote at all.
				case VOTE_DECISION_NONE:
				{
					
				}
				// Voted positively.
				case VOTE_DECISION_YES:
				{
					
				}
				// Voted negatively.
				case VOTE_DECISION_NO:
				{
					
				}
			}
		}
	}
}
__________________
For questions/plugin requests contact me:

• Discord: KoNLiG#6417
• Steam: KoNLiG
KoNLiG is offline
September
Senior Member
Join Date: Jul 2015
Location: Russian Federation
Old 08-18-2021 , 15:27   Re: [CS:GO] Custom Votes [Panorama] (v1.0 | 9 August 2021)
Reply With Quote #16

L 08/18/2021 - 22:25:10: [SM] Exception reported: Plugin handle 5d3b0e8f is invalid (error 1)
L 08/18/2021 - 22:25:10: [SM] Blaming: customvotes.smx
L 08/18/2021 - 22:25:10: [SM] Call stack trace:
L 08/18/2021 - 22:25:10: [SM] [0] Call_StartFunction
L 08/18/2021 - 22:25:10: [SM] [1] Line 42, C:\Users\omerb\OneDrive\Programming\KoNLiG Scripts\GitHub Repositories\My Repositories\customvotes\scripting\customvote s.sp::VoteInfo::CallResult
L 08/18/2021 - 22:25:10: [SM] [2] Line 462, C:\Users\omerb\OneDrive\Programming\KoNLiG Scripts\GitHub Repositories\My Repositories\customvotes\scripting\customvote s.sp:isplayCustomVoteResults
L 08/18/2021 - 22:25:10: [SM] [3] Line 367, C:\Users\omerb\OneDrive\Programming\KoNLiG Scripts\GitHub Repositories\My Repositories\customvotes\scripting\customvote s.sp::Timer_DisplayCustomVoteResults
September is offline
Send a message via Skype™ to September
KoNLiG
AlliedModders Donor
Join Date: Sep 2020
Location: Israel
Old 08-19-2021 , 07:30   Re: [CS:GO] Custom Votes [Panorama] (v1.0 | 9 August 2021)
Reply With Quote #17

Quote:
Originally Posted by September View Post
L 08/18/2021 - 22:25:10: [SM] Exception reported: Plugin handle 5d3b0e8f is invalid (error 1)
L 08/18/2021 - 22:25:10: [SM] Blaming: customvotes.smx
L 08/18/2021 - 22:25:10: [SM] Call stack trace:
L 08/18/2021 - 22:25:10: [SM] [0] Call_StartFunction
L 08/18/2021 - 22:25:10: [SM] [1] Line 42, C:\Users\omerb\OneDrive\Programming\KoNLiG Scripts\GitHub Repositories\My Repositories\customvotes\scripting\customvote s.sp::VoteInfo::CallResult
L 08/18/2021 - 22:25:10: [SM] [2] Line 462, C:\Users\omerb\OneDrive\Programming\KoNLiG Scripts\GitHub Repositories\My Repositories\customvotes\scripting\customvote s.sp:isplayCustomVoteResults
L 08/18/2021 - 22:25:10: [SM] [3] Line 367, C:\Users\omerb\OneDrive\Programming\KoNLiG Scripts\GitHub Repositories\My Repositories\customvotes\scripting\customvote s.sp::Timer_DisplayCustomVoteResults
Please contact me through discord (KoNLiG#0001) for further help.
__________________
For questions/plugin requests contact me:

• Discord: KoNLiG#6417
• Steam: KoNLiG
KoNLiG is offline
mrmiki
Junior Member
Join Date: Mar 2021
Old 08-19-2021 , 11:21   Re: [CS:GO] Custom Votes [Panorama] (v1.0 | 9 August 2021)
Reply With Quote #18

Quote:
Originally Posted by KoNLiG View Post
'results[MAXPLAYERS+1]' stores the clients vote decisions by this enum (located in customvotes.inc):
Code:
/**
 * Client's custom vote decisions.
 */
enum
{
	VOTE_DECISION_NONE = -1,
	VOTE_DECISION_YES,
	VOTE_DECISION_NO
}
So for example, if you want to know what each player voted for it'd be like this:
Code:
public void Handler_CustomVotePassed(int results[MAXPLAYERS + 1])
{
	for (int current_client = 1; current_client <= MaxClients; current_client++)
	{
		// If the current client isn't in game, results[current_client] will always be 'VOTE_DECISION_NONE'.
		if (IsClientInGame(current_client))
		{
			switch (results[current_client])
			{
				// Didn't vote at all.
				case VOTE_DECISION_NONE:
				{
					
				}
				// Voted positively.
				case VOTE_DECISION_YES:
				{
					
				}
				// Voted negatively.
				case VOTE_DECISION_NO:
				{
					
				}
			}
		}
	}
}




can i use this to count all yes votes?


case VOTE_DECISION_YES:
{
count++;
}
mrmiki is offline
KoNLiG
AlliedModders Donor
Join Date: Sep 2020
Location: Israel
Old 08-20-2021 , 11:02   Re: [CS:GO] Custom Votes [Panorama] (v1.0 | 9 August 2021)
Reply With Quote #19

Version 2.0 - 20/8/2021

After upgrading to this new version a recompile to all the plugin modules with the new include is required, otherwise votes will not work properly!

API Expansion:
• Native added to retrieve the vote decisions of the vote in progress. (CustomVotes_GetVoteDecisions)
• Parse data through callbacks.
• Broadcast votes to custom group of clients.

Another small thing that added, 'VOTE_DURATION_FOREVER' define to display the vote as long as possible.

PHP Code:
CustomVoteSetup setup;

setup.clients[0] = client;
setup.client_count 1;

// Not required when 'setup.clients' is specified.
// setup.team = CS_TEAM_NONE;
setup.initiator client;
setup.issue_id VOTE_ISSUE_UNPAUSEMATCH;
setup.dispstr "<font color='#FF5500' class='fontSize-xxxl'>Faceit?</font><br/><img src='https://pbs.twimg.com/profile_images/1349712390628270081/KpMEtOII.png'/>";
setup.disppass "<font color='#3df218'>Vote Passed!</font>";

CustomVotes_Execute(setupVOTE_DURATION_FOREVER); 
Enjoy
__________________
For questions/plugin requests contact me:

• Discord: KoNLiG#6417
• Steam: KoNLiG

Last edited by KoNLiG; 08-20-2021 at 11:06. Reason: Implantation example
KoNLiG is offline
trzmielu
Member
Join Date: Aug 2016
Old 12-05-2022 , 14:01   Re: [CS:GO] Custom Votes [Panorama] (v2.0 | 9 August 2021)
Reply With Quote #20

Is it possible for setup.dispstr, setup.disppass to use translations?
trzmielu 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 10:41.


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