AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   is_matchstart ? (https://forums.alliedmods.net/showthread.php?t=193001)

vamppa 08-15-2012 15:38

is_matchstart ?
 
how would I check when a clanmatch has started?
For our game half-life deathmatch: adrenaline gamer a clanmatch has started when the global event 'Countdown' has passed.
so this should be fairly easy but I cant get it working.

PHP Code:

#include <amxmodx> 
#include <fakemeta> 


new g_Matchstart[33];

public 
plugin_init() 

    
register_plugin("clanmatchstart","1.2","test")  
    
register_event"Countdown""StartMatch""a""1=9"
    
register_clcmd("say /matchstart""hasmatchstarted");

public 
StartMatch(id
{   
  
g_Matchstart[id] = true
}
bool:is_matchstart(id)
  return 
g_Matchstart[id];

public 
hasmatchstarted(id
{
    
client_print(idprint_chat"* clan match has %s started."is_matchstart(id) ? "" " not");
    return 
PLUGIN_HANDLED;


I know within global events u cant use (id) so this was a failed attempt.
with my next attempt I am thinking off replacing the g_Matchstart with a new server cvar.
but this must be possible to achieve on a more efficient way, not?

Exolent[jNr] 08-15-2012 15:42

Re: is_matchstart ?
 
I don't see a reason for the variable to be per-player.

PHP Code:

#include <amxmodx> 

new bool:g_Matchstart;

public 
plugin_init() 

    
register_plugin("clanmatchstart","1.2","test")  
    
register_event"Countdown""StartMatch""a""1=9"
    
register_clcmd("say /matchstart""hasmatchstarted");

public 
StartMatch() 
{   
  
g_Matchstart true
}

public 
hasmatchstarted(id
{
    
client_print(idprint_chat"* clan match has %s started."g_Matchstart "" " not");
    return 
PLUGIN_HANDLED;



vamppa 08-15-2012 16:06

Re: is_matchstart ?
 
thanks Ill give that a shot, using bool does not require fakemeta?

Exolent[jNr] 08-15-2012 16:08

Re: is_matchstart ?
 
No, bool is a generic Pawn tag. No include is required to use it.

vamppa 08-15-2012 17:26

Re: is_matchstart ?
 
nice learned something again.
btw it works! :D there is a reason I would like to use this for (id) I didn't state.
I thought this would be impossible because of the global event but I only need the global event to determan wether or not a clanmatch has started.
is there a way to do something on per player (id) when the clanmatch has started?

for example:

this
PHP Code:

gDeaths[id] = 
check_netgraph
(id); 

which comes from
PHP Code:

#define SCREENSHOT_PER_DEATHS 5 

public check_netgraph(id
{
   
query_client_cvarid "net_graph" "get_netgraph" );
   return 
PLUGIN_CONTINUE;
}
public 
get_netgraphid , const cvar[], const snetValue[])
{
  
client_cmd(id"net_graph 3"); 
  
client_cmd(id"status;wait;wait;wait;wait;wait;snapshot"
  
client_cmd(id"net_graph %s" snetValue );
}
public 
Event_DeathMsg() 

    new 
id read_data(2
    if ( ! (++
gDeaths[id] % SCREENSHOT_PER_DEATHS) ) 
    { 
        
check_netgraph(id);
    } 



Exolent[jNr] 08-15-2012 17:29

Re: is_matchstart ?
 
In the global event, just loop through all players.

vamppa 08-17-2012 14:09

Re: is_matchstart ?
 
PHP Code:

public globalevent () 
{
   new 
players[32], numplayersid;
   
get_players playersnumplayers );
   for ( new 
i=0i<numplayersi++ ) {
   
id=players[i];
   
//code ........
  
}


ok thanks!!!
this is a break through and makes a lot possible for the things I wanted to do.

vamppa 10-23-2012 15:09

Re: is_matchstart ?
 
ok theres a problem looping through the players mixes up info retrieved from each player.
player index number gets moved or something.

Example: http://rghost.net/41114478.view
the steamid in the HUD is not correct one nor is the Ip.
would there be a way to solve this?


All times are GMT -4. The time now is 05:53.

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