AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   warmod pause script (https://forums.alliedmods.net/showthread.php?t=333601)

Star0 07-24-2021 15:46

warmod pause script
 
Hello guys

anyone can fix this script : https://forums.alliedmods.net/showpo...7&postcount=19

PHP Code:

/* Pause and Unpause */
new bool:g_pause_freezetime false;
new 
bool:g_pause_offered_t false;
new 
bool:g_pause_offered_ct false;
new 
bool:g_paused false;

new 
Handle:sv_pausable;
new 
Handle:g_h_auto_unpause INVALID_HANDLE;
new 
Handle:g_h_auto_unpause_delay INVALID_HANDLE;
//new Handle:g_h_pause_freezetime = INVALID_HANDLE;
new Handle:g_h_pause_comfirm INVALID_HANDLE;
new 
Handle:g_h_pause_limit INVALID_HANDLE;
new 
g_t_pause_count 0;
new 
g_ct_pause_count 0;
new 
Handle:g_h_stored_timer INVALID_HANDLE;

public 
OnPluginStart()
{
    
// Pause and Unpause stuff
    
sv_pausable FindConVar ("sv_pausable");
    
g_h_pause_comfirm CreateConVar("wm_pause_comfirm""1""Wait for other team to comfirm pause: 0 = off, 1 = on"FCVAR_NOTIFY);
    
g_h_auto_unpause CreateConVar("wm_auto_unpause""1""Sets auto unpause: 0 = off, 1 = on"FCVAR_NOTIFY);
//    g_h_pause_freezetime = CreateConVar("wm_pause_freezetime", "1", "Wait for freeze time to pause: 0 = off, 1 = on", FCVAR_NOTIFY);
    
g_h_auto_unpause_delay CreateConVar("wm_auto_unpause_delay""180""Sets the seconds to wait before auto unpause"FCVAR_NOTIFYtrue0.0);
    
g_h_pause_limit CreateConVar("wm_pause_limit""1""Sets max pause count per team per half"FCVAR_NOTIFY);
}

public 
Action:SayChat(clientargs)
{
    if (!
IsActive(0true) || args 1)
    {
        
// warmod is disabled or no arguments
        
return Plugin_Continue;
    }
    
    new 
String:type[64];
    
GetCmdArg(0typesizeof(type));
    
    new 
bool:teamOnly false;
    new 
bool:silence false;
    
    if (
StrEqual(type"say_team"false))
    {
        
// true if not console, as console is always global
        
teamOnly = !! client;
    }
    
    new 
String:message[192];
    
GetCmdArgString(messagesizeof(message));
    
StripQuotes(message);
    
    if (
message[0] == '!' || message[0] == '.' || message[0] == '/')
    {
        if (
StrEqual(command"pause"false) || StrEqual(command"pauses"false) || StrEqual(command"p"false))
        {
            
Pause(clientargs);
        }
        else if (
StrEqual(command"unpause"false) || StrEqual(command"unpauses"false) || StrEqual(command"up"false))
        {
            
Unpause(clientargs);
        }
    }
}

public 
Event_Round_Start(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (!
IsActive(0true))
    {
        return;
    }
    
    
//Pause command fire on round end May change to on round start
    
if (g_pause_freezetime == true)
    {
        
g_pause_freezetime false;
        
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Unpause Notice"LANG_SERVER);
        if(
GetConVarBool(g_h_auto_unpause))
        {
            
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T"CHAT_PREFIXGetConVarInt(g_h_auto_unpause_delay), "Unpause Timer"LANG_SERVER);
            
g_h_stored_timer CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
        }
        
g_paused true;
        
//ServerCommand("mp_pause_match 1");
    
}
}


//Pause and Unpause Commands + timers
public Action:Pause(clientargs)
{
    if (
GetConVarBool(sv_pausable) && g_live)
    {
        if (
GetConVarBool(g_h_pause_comfirm))
        {
            if (
GetClientTeam(client) == && g_pause_offered_ct == true)
            {
                if(
g_h_stored_timer != INVALID_HANDLE)
                {
                    
KillTimer(g_h_stored_timer);
                    
g_h_stored_timer INVALID_HANDLE;
                }
                
                
g_pause_offered_ct false;
                
g_ct_pause_count++;
                
                
//if (GetConVarBool(g_h_pause_freezetime))
                //{
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Freeze Time"LANG_SERVER);
                
g_pause_freezetime true;
                
/*}
                else
                {
                    PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER);
                    if (GetConVarBool(g_h_auto_unpause))
                    {
                        PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(g_h_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
                        g_h_stored_timer = CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
                    }*/
                
g_paused true;
                
ServerCommand("mp_pause_match 1");
                return;
                
//}
            
}
            else if (
GetClientTeam(client) == && g_pause_offered_t == true)
            {
                if(
g_h_stored_timer != INVALID_HANDLE)
                {
                    
KillTimer(g_h_stored_timer);
                    
g_h_stored_timer INVALID_HANDLE;
                }
                
g_pause_offered_t false;
                
g_t_pause_count++;
                
                
//if (GetConVarBool(g_h_pause_freezetime))
                //{
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Round End"LANG_SERVER);
                
g_pause_freezetime true;
                
/*}
                else
                {
                    PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER);
                    if (GetConVarBool(g_h_auto_unpause))
                    {
                        PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(g_h_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
                        g_h_stored_timer = CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
                    }*/
                
g_paused true;
                
ServerCommand("mp_pause_match 1");
                return;
                
//}
            
}
            else if (
GetClientTeam(client) == && g_t_pause_count == GetConVarInt(g_h_pause_limit))
            {
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Limit"LANG_SERVER);
            }
            else if (
GetClientTeam(client) == && g_ct_pause_count == GetConVarInt(g_h_pause_limit))
            {
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Limit"LANG_SERVER);
            }
            else if (
GetClientTeam(client) < )
            {
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Non-player"LANG_SERVER);
            }
            else if (
GetClientTeam(client) == && g_ct_pause_count != GetConVarInt(g_h_pause_limit) && g_pause_offered_ct == false)
            {
                
g_pause_offered_ct true;
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_ct_name"Pause Offer"LANG_SERVER);
                
g_h_stored_timer CreateTimer(30.0PauseTimeout);
            }
            else if (
GetClientTeam(client) == && g_t_pause_count != GetConVarInt(g_h_pause_limit) && g_pause_offered_t == false)
            {
                
g_pause_offered_t true;
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_t_name"Pause Offer"LANG_SERVER);
                
g_h_stored_timer CreateTimer(30.0PauseTimeout);
            }
        }
        else if (
GetClientTeam(client) == && g_ct_pause_count != GetConVarInt(g_h_pause_limit) && !GetConVarBool(g_h_pause_comfirm))
        {
            
g_ct_pause_count++;
            
//if (GetConVarBool(g_h_pause_freezetime))
            //{
            
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Freeze Time"LANG_SERVER);
            
g_pause_freezetime true;
            
/*}
            else
            {
                PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER);
                if(GetConVarBool(g_h_auto_unpause))
                {
                    PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(g_h_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
                    g_h_stored_timer = CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
                }*/
            
g_paused true;
            
ServerCommand("mp_pause_match 1");
            return;
            
//}
        
}
        else if (
GetClientTeam(client) == &&  g_t_pause_count != GetConVarInt(g_h_pause_limit) && GetConVarBool(g_h_pause_comfirm) == false)
        {
            
g_t_pause_count++;
            
//if (GetConVarBool(g_h_pause_freezetime))
            //{
            
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Freeze Time"LANG_SERVER);
            
g_pause_freezetime true;
            
/*}
            else
            {
                PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER);
                if(GetConVarBool(g_h_auto_unpause))
                {
                    PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(g_h_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
                    g_h_stored_timer = CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
                }*/
            
g_paused true;
            
ServerCommand("mp_pause_match 1");
            return;
            
//}
        
}
        else if (
GetClientTeam(client) == && g_t_pause_count == GetConVarInt(g_h_pause_limit))
        {
            
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Limit"LANG_SERVER);
        }
        else if (
GetClientTeam(client) == && g_ct_pause_count == GetConVarInt(g_h_pause_limit))
        {
            
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Limit"LANG_SERVER);
        }
        else if (
GetClientTeam(client) < 2)
        {
        
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Non-player"LANG_SERVER);
        }
    }
    else if (!
g_live)
    {
        
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Match Not In Progress"LANG_SERVER);
    }
    else
    {
        
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Not Enabled"LANG_SERVER);
    }
}

public 
Action:Unpause(clientargs)
{
    if (
g_paused)
    {
        if (
GetConVarBool(g_h_pause_comfirm))
        {
            if (
GetClientTeam(client) == && g_pause_offered_ct == false && g_pause_offered_t == false)
            {
                
g_pause_offered_ct true;
                
PrintToConsoleAll("<WarMod_BFG> CT have asked to unpause the game. Please type /unpause to unpause the match.");
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_ct_name"Unpause Offer"LANG_SERVER);
            }
            else if (
GetClientTeam(client) == && g_pause_offered_t == false && g_pause_offered_ct == false)
            {
                
g_pause_offered_t true;
                
PrintToConsoleAll("<WarMod_BFG> T have asked to unpause the game. Please type /unpause to unpause the match.");
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_t_name"Unpause Offer"LANG_SERVER);
            }
            else if (
GetClientTeam(client) == && g_pause_offered_ct == true)
            {
                
g_pause_offered_ct false;
                
g_paused false;
                
ServerCommand("mp_unpause_match 1");
            }
            else if (
GetClientTeam(client) == && g_pause_offered_t == true)
            {
                
g_pause_offered_t false;
                
g_paused false;
                
ServerCommand("mp_unpause_match 1");
            }
            else if (
GetClientTeam(client) < )
            {
                
PrintToConsole(client"<WarMod_BFG> You must be on T or CT to enable /unpause");
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Unpause Non-player"LANG_SERVER);
            }
        }
        else
        {
            if (
GetClientTeam(client) == 2)
            {
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_t_name"Unpaused Match"LANG_SERVER);
                
g_paused false;
                
ServerCommand("mp_unpause_match 1");
            }
            else if (
GetClientTeam(client) == 3)
            {
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_ct_name"Unpaused Match"LANG_SERVER);
                
g_paused false;
                
ServerCommand("mp_unpause_match 1");
            }
            else if (
GetClientTeam(client) < )
            {
                
PrintToConsole(client"<WarMod_BFG> You must be on T or CT to enable /unpause");
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Unpause Non-player"LANG_SERVER);
            }
        }
    }
    else
    {
        
PrintToChat(client,"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Paused Via Rcon"LANG_SERVER);
        
PrintToConsole(client,"<WarMod_BFG> Server is not paused or was paused via rcon");
    }
}

public 
Action:PauseTimeout(Handle:timer)
{
    
g_h_stored_timer INVALID_HANDLE;
    
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Offer Not Confirmed"LANG_SERVER);
    
g_pause_offered_ct false;
    
g_pause_offered_t false;
}

public 
Action:UnPauseTimer(Handle:timer)
{
    
g_h_stored_timer INVALID_HANDLE;
    
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Unpause Auto"LANG_SERVER);
    
ServerCommand("mp_unpause_match 1");
    
g_pause_offered_ct false;
    
g_pause_offered_t false;


sourcemod 1.7+ comilper's error i got
PHP Code:

SourcePawn Compiler 1.10
Copyright 
(c1997-2006 ITB CompuPhase
Copyright 
(c2004-2018 AlliedModders LLC

plugin
.sp(30) : error 017undefined symbol "IsActive"
plugin.sp(54) : error 017undefined symbol "command"
plugin.sp(58) : error 017undefined symbol "command"
plugin.sp(40) : warning 204symbol is assigned a value that is never used"silence"
plugin.sp(45) : warning 204symbol is assigned a value that is never used"teamOnly"
plugin.sp(63) : warning 209: function "SayChat" should return a value
plugin
.sp(67) : error 017undefined symbol "IsActive"
plugin.sp(76) : error 017undefined symbol "chat_prefix"
plugin.sp(79) : error 017undefined symbol "chat_prefix"
plugin.sp(91) : error 017undefined symbol "g_live"
plugin.sp(108) : error 017undefined symbol "chat_prefix"
plugin.sp(136) : error 017undefined symbol "chat_prefix"
plugin.sp(154) : error 017undefined symbol "chat_prefix"
plugin.sp(158) : error 017undefined symbol "chat_prefix"
plugin.sp(162) : error 017undefined symbol "chat_prefix"
plugin.sp(167) : error 017undefined symbol "chat_prefix"
plugin.sp(173) : error 017undefined symbol "chat_prefix"
plugin.sp(182) : error 017undefined symbol "chat_prefix"
plugin.sp(203) : error 017undefined symbol "chat_prefix"
plugin.sp(221) : error 017undefined symbol "chat_prefix"
plugin.sp(225) : error 017undefined symbol "chat_prefix"
plugin.sp(229) : error 017undefined symbol "chat_prefix"
plugin.sp(232) : error 017undefined symbol "g_live"
plugin.sp(234) : error 017undefined symbol "chat_prefix"
plugin.sp(238) : error 017undefined symbol "chat_prefix"
plugin.sp(252) : error 017undefined symbol "chat_prefix"
plugin.sp(258) : error 017undefined symbol "chat_prefix"
plugin.sp(275) : error 017undefined symbol "chat_prefix"
plugin.sp(282) : error 017undefined symbol "chat_prefix"

Compilation aborted.
26 Errors

AND I FIX chat_prefix error by adding char chat_prefix[64]; and change char CHAT_PREFIX to char chat_prefix

put still i can't compile it
PHP Code:

SourcePawn Compiler 1.10
Copyright 
(c1997-2006 ITB CompuPhase
Copyright 
(c2004-2018 AlliedModders LLC

plugin
.sp(33) : error 017undefined symbol "IsActive"
plugin.sp(57) : error 017undefined symbol "command"
plugin.sp(61) : error 017undefined symbol "command"
plugin.sp(43) : warning 204symbol is assigned a value that is never used"silence"
plugin.sp(48) : warning 204symbol is assigned a value that is never used"teamOnly"
plugin.sp(66) : warning 209: function "SayChat" should return a value
plugin
.sp(70) : error 017undefined symbol "IsActive"
plugin.sp(94) : error 017undefined symbol "g_live"
plugin.sp(170) : error 017undefined symbol "g_ct_name"
plugin.sp(176) : error 017undefined symbol "g_t_name"
plugin.sp(235) : error 017undefined symbol "g_live"
plugin.sp(255) : error 017undefined symbol "g_ct_name"
plugin.sp(261) : error 017undefined symbol "g_t_name"
plugin.sp(285) : error 017undefined symbol "g_t_name"
plugin.sp(291) : error 017undefined symbol "g_ct_name"

12 Errors

one more last thing if anyone can add this to the script that will be greate but not necessary
PHP Code:

wm_unpause_confirm CreateConVar("wm_unpause_confirm""0""Wait for other team to confirm unpause: 0 = off, 1 = on"FCVAR_NOTIFYtrue0.0true1.0); 

THANKS :)


All times are GMT -4. The time now is 16:52.

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