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

How to hold multiple vote


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kevinll
Junior Member
Join Date: Jun 2021
Old 08-23-2022 , 06:32   How to hold multiple vote
Reply With Quote #1

I modified pugsetup to want multiple votes before the game starts but I found that the votes are only shown once.
this is code
PHP Code:
public int UntrustedAnglesMenuHandler(Menu menuMenuAction actionint clientOrResultint selection)
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
      
int client clientOrResult;
      
char info[5];
      
menu.GetItem(selectioninfosizeof(info));
      if (
StrEqual(info"on"))
      {
        
PugSetup_MessageToAll("%T""UntrustedAnglesVoteOn"LANG_SERVERclient);
      }
      else if(
StrEqual(info"off"))
      {
        
PugSetup_MessageToAll("%T""UntrustedAnglesVoteOff"LANG_SERVERclient);
      }
        }
        case 
MenuAction_VoteEnd:
        {
      
int result clientOrResult;
      
char info[5];
      
menu.GetItem(resultinfosizeof(info));
      if (
StrEqual(info"on"))
      {
        
PugSetup_MessageToAll("%T""UntrustedAnglesOn"LANG_SERVER);
        
g_UntrustedAngles.BoolValue true;
      }
      else if(
StrEqual(info"off"))
      {
        
PugSetup_MessageToAll("%T""UntrustedAnglesOff"LANG_SERVER);
        
g_UntrustedAngles.BoolValue false;
      }

      if (
g_AutoLive) {
        
CreateCountDown();
      } else {
        
ChangeState(GameState_WaitingForStart);
        
CreateTimer(float(START_COMMAND_HINT_TIME), Timer_StartCommandHint);
        
GiveStartCommandHint();
      }
     
        }
        case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }
    }

    return 
0;
}
public 
int BodyLeanMenuHandler(Menu menuMenuAction actionint clientOrResultint selection)
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
      
int client clientOrResult;
      
char info[5];
      
menu.GetItem(selectioninfosizeof(info));
      if (
StrEqual(info"on"))
      {
        
PugSetup_MessageToAll("%T""BodyLeanVoteOn"LANG_SERVERclient);
      }
      else if(
StrEqual(info"off"))
      {
        
PugSetup_MessageToAll("%T""BodyLeanVoteOff"LANG_SERVERclient);
      }
        }
        case 
MenuAction_VoteEnd:
        {
      
int result clientOrResult;
      
char info[5];
      
menu.GetItem(resultinfosizeof(info));
      if (
StrEqual(info"on"))
      {
        
PugSetup_MessageToAll("%T""BodyLeanOn"LANG_SERVER);
        
g_BodyLean.BoolValue true;
      }
      else if(
StrEqual(info"off"))
      {
        
PugSetup_MessageToAll("%T""BodyLeanOff"LANG_SERVER);
        
g_BodyLean.BoolValue false;
      }
        }
    case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }
    }

    return 
0;
}
public 
int ExtendedAnglesMenuHandler(Menu menuMenuAction actionint clientOrResultint selection)
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
      
int client clientOrResult;
      
char info[5];
      
menu.GetItem(selectioninfosizeof(info));
      if (
StrEqual(info"on"))
      {
        
PugSetup_MessageToAll("%T""ExtendedAnglesVoteOn"LANG_SERVERclient);
      }
      else if(
StrEqual(info"off"))
      {
        
PugSetup_MessageToAll("%T""ExtendedAnglesVoteOff"LANG_SERVERclient);
      }
        }
        case 
MenuAction_VoteEnd:
        {
      
int result clientOrResult;
      
char info[5];
      
menu.GetItem(resultinfosizeof(info));
      if (
StrEqual(info"on"))
      {
        
PugSetup_MessageToAll("%T""ExtendedAnglesOn"LANG_SERVER);
        
g_ExtendedAngles.BoolValue true;
      }
      else if(
StrEqual(info"off"))
      {
        
PugSetup_MessageToAll("%T""ExtendedAnglesOff"LANG_SERVER);
        
g_ExtendedAngles.BoolValue false;
      }

      if (
g_AutoLive) {
        
CreateCountDown();
      } else {
        
ChangeState(GameState_WaitingForStart);
        
CreateTimer(float(START_COMMAND_HINT_TIME), Timer_StartCommandHint);
        
GiveStartCommandHint();
      }
     
        }
        case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }
    }

    return 
0;
}
public 
void ReadyToStart(){
  
Call_StartForward(g_hOnReadyToStart);
  
Call_Finish();
  
Menu UntrustedAnglesMenu = new Menu(UntrustedAnglesMenuHandler);
  
UntrustedAnglesMenu.SetTitle("UntrustedAngles?");
  
UntrustedAnglesMenu.AddItem("off""Disable");
  
UntrustedAnglesMenu.AddItem("on""Enable");
  
UntrustedAnglesMenu.ExitButton false;
  
UntrustedAnglesMenu.DisplayVoteToAll(10);
  
Menu BodyLeanMenu = new Menu(BodyLeanMenuHandler);
  
BodyLeanMenu.SetTitle("BodyLean(roll)?");
  
BodyLeanMenu.AddItem("off""Disable");
  
BodyLeanMenu.AddItem("on""Enable");
  
BodyLeanMenu.ExitButton false;
  
BodyLeanMenu.DisplayVoteToAll(10);
  
Menu ExtendedAnglesMenu = new Menu(ExtendedAnglesMenuHandler);
  
ExtendedAnglesMenu.SetTitle("ExtendedAnglesFix?");
  
ExtendedAnglesMenu.AddItem("off""Disable");
  
ExtendedAnglesMenu.AddItem("on""Enable");
  
ExtendedAnglesMenu.ExitButton false;
  
ExtendedAnglesMenu.DisplayVoteToAll(10);
}

static 
void GiveStartCommandHint() {
  
char startCmd[ALIAS_LENGTH];
  
FindAliasFromCommand("sm_start"startCmd);
  
PugSetup_MessageToAll("%t""WaitingForStart"PugSetup_GetLeader(), startCmd);


Last edited by Kevinll; 08-23-2022 at 06:34.
Kevinll is offline
Kevinll
Junior Member
Join Date: Jun 2021
Old 08-23-2022 , 06:43   Re: How to hold multiple vote
Reply With Quote #2

completed file
Attached Files
File Type: sp Get Plugin or Get Source (pugsetup copy.sp - 18 views - 76.4 KB)
Kevinll 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 11:24.


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