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

(L4D2) help with new complement style


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edwinvega86
Senior Member
Join Date: Feb 2016
Old 07-19-2019 , 09:06   (L4D2) help with new complement style
Reply With Quote #1

I am trying to join this voting system but it asks me for a new style, I have my plugin that uses #pragma newdecls required. someone could eliminate the actions. I do not have much knowledge of the type of style that he asks me, although it works. Excuse me for the English
PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools> 

#pragma semicolon 1
#pragma newdecls required
#include <clientprefs>

int g_iYesCount;
int g_iNoCount;
int g_iVoters;
int g_iPlayers;
bool g_bAllVoted;
bool g_bReverseVote;
Handle g_hTimout;
int seconds;

public 
void OnPluginStart()
{
    
LoadTranslations("voto.phrases");
    
g_hTimout CreateConVar("sm_timout""30.0""",FCVAR_NOTIFY);
    
RegConsoleCmd("sm_vt"sm_vt);
}
public 
Action sm_vt(int clientint args)
{
    
VoteOpen();
}
public 
void VoteOpen()
{
    
g_iYesCount 0;
    
g_iNoCount 0;
    
g_iVoters 0;
    
g_iPlayers 0;
    
g_bAllVoted false;
    
int ReverseRnd GetRandomInt(12);
    if (
ReverseRnd == 1)
    {
        
g_bReverseVote true;
    }
    else
    {
        
g_bReverseVote false;
    }
    
int i 1;
    while (
<= MaxClients)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))
        {
            
ShowVotePanel(i);
            
g_iVoters += 1;
            
g_iPlayers += 1;
        }
        
i++;
    }
    
seconds GetConVarInt(g_hTimout);
    
CreateTimer(GetConVarFloat(g_hTimout) + 1.0Timer_VoteCheckany:00);
    
CreateTimer(1.0TimerInfoany:01);
    return;
}

void ShowVotePanel(int client)
{
    
Handle panel CreatePanel(Handle:0);
    static 
char buffer[128];
    static 
char buffer1[32];
    static 
char buffer2[32];
    
Format(buffer128"%t""panel"client);
    
SetPanelTitle(panelbufferfalse);
    if (
g_bReverseVote)
    {
        
Format(buffer232"%t""Yes"client);
        
DrawPanelItem(panelbuffer20);
        
Format(buffer132"%t""No"client);
        
DrawPanelItem(panelbuffer10);
    }
    else
    {
        
Format(buffer132"%t""No"client);
        
DrawPanelItem(panelbuffer10);
        
Format(buffer232"%t""Yes"client);
        
DrawPanelItem(panelbuffer20);
    }
    
SendPanelToClient(panelclientVoteHandlerGetConVarInt(g_hTimout));
    
CloseHandle(panel);
    return;
}

public 
int VoteHandler(Handle menuMenuAction actionint client,int choice)
{
    if (
action == MenuAction:4)
    {
        
int g_iVotes g_iNoCount g_iYesCount;
        if (!
g_bAllVoted)
        {
            
EmitSoundToClient(client"ui/alert_clink.wav", -207501.0100, -1NULL_VECTORNULL_VECTORtrue0.0);
            
PrintHintText(client"%t %d/%d, %t %d sec\n%t (%d)\n%t (%d)""Votes"g_iVotesg_iPlayers"left"seconds"No"g_iNoCount"Yes"g_iYesCount);
        }
        if (
choice == 1)
        {
            if (
g_bReverseVote)
            {
                
g_iYesCount += 1;
                
g_iVoters -= 1;
            }
            else
            {
                
g_iNoCount += 1;
                
g_iVoters -= 1;
            }
        }
        if (
choice == 2)
        {
            if (
g_bReverseVote)
            {
                
g_iNoCount += 1;
                
g_iVoters -= 1;
            }
            else
            {
                
g_iYesCount += 1;
                
g_iVoters -= 1;
            }
        }
        if (
g_iVoters)
        {
        }
        else
        {
            
g_bAllVoted true;
            
seconds 0;
            
CountVotes();
        }
    }
    return;
}

public 
Action Timer_VoteCheck(Handle timer)
{
    if (!
g_bAllVoted)
    {
        
g_bAllVoted true;
        
CountVotes();
    }
    return 
Action;
}

public 
Action TimerInfo(Handle timer)
{
    
int g_iVotes g_iNoCount g_iYesCount;
    if (
<= seconds)
    {
        
int max GetMaxClients();
        
int i 1;
        while (
<= max)
        {
            if (
IsClientInGame(i) && !IsFakeClient(i))
            {
                
PrintHintText(i"%t %d/%d, %t %d sec\n%t (%d)\n%t (%d)""Votes"g_iVotesg_iPlayers"left"seconds"No"g_iNoCount"Yes"g_iYesCount);
            }
            
i++;
        }
    }
    else
    {
        if (
seconds || g_bAllVoted)
        {
            return 
Action;
        }
    }
    
seconds -= 1;
    return 
Action;
}

public 
int GetVotes(int vote_Yesint vote_No)
{
    
int votes vote_No vote_Yes;
    
int prcnt RoundToNearest(1.0 vote_Yes 100 votes);
    return 
prcnt;
}

public 
void CountVotes()
{
    
int g_iVotes g_iNoCount g_iYesCount;
    if (
GetVotes(g_iYesCountg_iNoCount) < 60)
    {
        
PrintToChatAll("%t""Players decided not. 60%% vote required (Received %d%% of %d votes)"GetVotes(g_iYesCountg_iNoCount), g_iVotes);
        
EmitSoundToAll("ui/beep_error01.wav", -207501.0100, -1NULL_VECTORNULL_VECTORtrue0.0);
        
Effecoff();
    }
    else
    {
        
PrintToChatAll("%t""Players decided yes. (Received %d%% of %d votes)"GetVotes(g_iYesCountg_iNoCount), g_iVotes);
        
EmitSoundToAll("ui/critical_event_1.wav", -207501.0100, -1NULL_VECTORNULL_VECTORtrue0.0);
        
Effecon();
    }
    return;
}
public 
void Effecon()
{
    
PrintToChatAll":3");
    return;
}
public 
void Effecoff()
{
    
PrintToChatAll":/");
    return;

Attached Files
File Type: txt voto.phrases.txt (487 Bytes, 25 views)
edwinvega86 is offline
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 07-19-2019 , 09:32   Re: (L4D2) help with new complement style
Reply With Quote #2

Why are you trying to compile decompiled code? The decompiled output is not meant to compile.
__________________
Timocop 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 22:26.


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