AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Player Spawn Or Round Start? (https://forums.alliedmods.net/showthread.php?t=206679)

Blizzard_87 01-25-2013 05:20

[SOLVED] Player Spawn Or Round Start?
 
ive got a script that fades screen for CT and sets time to unfade.

and then unfreeze the CT's

but if i use the code in Player Spawn... it works as long as everyone spawns same time(round start)

but then starts bugging when people spawn at different times...

and then i use Round Start event, and nothing happens it doesnt work.

Spoiler

Bos93 01-25-2013 14:47

Re: Player Spawn Or Round Start?
 
public LogEvent_RoundStart(id)

id O_O ?

This is a global Event.

simanovich 01-25-2013 15:27

Re: Player Spawn Or Round Start?
 
WTF?!
PHP Code:

LogEvent_RoundStart(id

It's god damm fu***ng global event, it has not params.

Use this:
PHP Code:

public LogEvent_RoundStart(){
    for (new 
1<= 32i++)
    {
        if(
cs_get_user_team(i) != CS_TEAM_T)
        {
            
Freeze(i);
            
ScreenFade(i);
            
set_hudmessage(85255255, -1.00.26120.020.00.050.051)
            
show_hudmessage(i"Hiders Get 20 Secs To Hide!")
            
set_task(20.0"Released"i);
        }
    }



Bos93 01-25-2013 15:55

Re: Player Spawn Or Round Start?
 
for (new i = 1; i <= 32; i++)

-->

new g_iMaxClients;

plugin_init( ) g_iMaxClients = get_maxplayers( );

for( new i = 1; i <= g_iMaxClients; i++ )

EpicMonkey 01-25-2013 16:53

Re: Player Spawn Or Round Start?
 
Quote:

Originally Posted by simanovich (Post 1880475)
WTF?!
PHP Code:

LogEvent_RoundStart(id

It's god damm fu***ng global event, it has not params.

Use this:
PHP Code:

public LogEvent_RoundStart(){
    for (new 
1<= 32i++)
    {
        if(
cs_get_user_team(i) != CS_TEAM_T)
        {
            
Freeze(i);
            
ScreenFade(i);
            
set_hudmessage(85255255, -1.00.26120.020.00.050.051)
            
show_hudmessage(i"Hiders Get 20 Secs To Hide!")
            
set_task(20.0"Released"i);
        }
    }



PHP Code:

if(cs_get_user_team(i) != CS_TEAM_T

that will even target the spectators

Solution ==> Post #4

and dont forget to add the team check

Emp` 01-25-2013 20:18

Re: Player Spawn Or Round Start?
 
Don't forget to add a connected/alive check because cs_get_user_team will throw an error if the user is not in game yet.

Blizzard_87 01-25-2013 20:21

Re: Player Spawn Or Round Start?
 
thanks heaps guys. will edit code :-)

Blizzard_87 01-26-2013 02:28

Re: Player Spawn Or Round Start?
 
PHP Code:

public LogEvent_RoundStart()
{
    
    new 
players[32], num;
    
get_playersplayersnum);
    
    for( new 
0num ;i++ )
    {
        if( 
is_user_connected(i) && is_user_alive(i) )
        {
            if(
cs_get_user_team(i) == CS_TEAM_CT)
            {
                
Freeze(i);
                
ScreenFade(i);
            }
            
set_hudmessage(85255255, -1.00.26120.020.00.050.051)
            
show_hudmessage(i"Hiders Get 20 Secs To Hide!")
            
set_task(20.0"Released"i);
        }    
    }
    
    
/*    
    for( new i = 1; i <= g_iMaxClients; i++ )
    {
    if( is_user_connected(i) && is_user_alive(i) )
    {
        if(cs_get_user_team(i) == CS_TEAM_CT)
        {
            Freeze(i);
            ScreenFade(i);
        }
        set_hudmessage(85, 255, 255, -1.0, 0.26, 1, 20.0, 20.0, 0.05, 0.05, 1)
        show_hudmessage(i, "Hiders Get 20 Secs To Hide!")
        set_task(20.0, "Released", i);
    }
    }*/


ive used both methods and nothing in game works....
nothing happens.

EpicMonkey 01-26-2013 04:05

Re: Player Spawn Or Round Start?
 
PHP Code:

#include <amxmodx>
#include <cstrike>

#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "None"

new g_maxplayers;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("EventRoundStart"2"1=Round_Start");
    
    
g_maxplayers get_maxplayers()
}

public 
EventRoundStart()
{
    for(new 
0g_maxplayersi++)
    {
        if(
is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_CT)
        {
            
client_print(iprint_chat"[AMXX] Works!")
        }
    }


this simple test works

Blizzard_87 01-26-2013 05:01

Re: Player Spawn Or Round Start?
 
Quote:

Originally Posted by EpicMonkey (Post 1880843)
PHP Code:

#include <amxmodx>
#include <cstrike>

#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "None"

new g_maxplayers;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("EventRoundStart"2"1=Round_Start");
    
    
g_maxplayers get_maxplayers()
}

public 
EventRoundStart()
{
    for(new 
0g_maxplayersi++)
    {
        if(
is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_CT)
        {
            
client_print(iprint_chat"[AMXX] Works!")
        }
    }


this simple test works

PHP Code:

public LogEvent_RoundStart()
{

    for(new 
0g_iMaxClientsi++)
    {
    
set_hudmessage(85255255, -1.00.26120.020.00.050.051)
    
show_hudmessage(i"Hiders Get 20 Secs To Hide!")
    
set_task(20.0"Released"i);   
     
    if(
is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_CT)
         {
        
Freeze(i);
        
ScreenFade(i);
    }
    }


the HUD and Released task show and work for Terrorist but nothing happens or shows on CT still..

_____________________________________________ ______________________________________

[EDIT]

when testing with myself it doesnt do anything when i first restart server.. but once DIE and round starts again it all seems to work...

thanks.


All times are GMT -4. The time now is 20:32.

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