This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

auto exec depending on a number spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
whitebear
Junior Member
Join Date: Feb 2008
Old 07-07-2008 , 08:22   auto exec depending on a number spawn
Reply With Quote #1

Help me please write small plugin, which:
1. at the beginning of map gets the amount of spawn, and print amount to concole server and HUD
2. every three minutes gets playersnum
3. if playersnum < spawn - does nothing, return to point 2.
3. else playersnum > spawn - sends server_cmd "amx_rtv"

After before thanks to everybody! Sorry my English
whitebear is offline
Old 07-07-2008, 20:57
AntiBots
This message has been deleted by AntiBots. Reason: HORRIFIC
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-07-2008 , 22:28   Re: auto exec depending on a number spawn
Reply With Quote #2

That code is horrific.

PHP Code:
#include <amxmodx>

#define TASK_ID_ROCKTHEVOTE 11333377

new g_Spawned;
new 
bool:g_bFirstRound;

public 
plugin_init()
{
    
register_plugin("RockTheVote Per People""0.1""Exolent");
    
    
register_event("HLTV""eventNewRound""a""1=0""2=0");
    
register_event("TextMsg""eventRestart""a""2&#Game_w""2&#Game_C");
    
    return 
PLUGIN_CONTINUE;
}

public 
eventNewRound()
{
    if( !
g_bFirstRound )
    {
        
g_bFirstRound true;
        
        
set_task(0.2"taskGetSpawned"0""0""0);
        
set_task(180.0"taskGetPlayers"TASK_ID_ROCKTHEVOTE""0"b"0);
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
eventRestart()
{
    
g_Spawned 0;
    
g_bFirstRound false;
    
remove_task(TASK_ID_ROCKTHEVOTE0);
    
    return 
PLUGIN_CONTINUE;
}

public 
taskGetSpawned()
{
    new 
maxplayers get_maxplayers();
    
    for( new 
plr 1plr <= maxplayersplr++ )
    {
        if( 
is_user_alive(plr) )
        {
            
g_Spawned++;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
taskGetPlayers()
{
    if( 
get_playersnum(0) > g_Spawned )
    {
        
server_cmd("amx_rtv");
    }
    
    return 
PLUGIN_CONTINUE;

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
whitebear
Junior Member
Join Date: Feb 2008
Old 07-08-2008 , 09:24   Re: auto exec depending on a number spawn
Reply With Quote #3

"That code is horrific."
and not words about spawn


2 X-olent Thank you very much! I will test!
whitebear is offline
Old 07-09-2008, 02:00
whitebear
This message has been deleted by whitebear. Reason: wrongly
DaxProxy
Senior Member
Join Date: Sep 2007
Old 07-09-2008 , 11:25   Re: auto exec depending on a number spawn
Reply With Quote #4

Quote:
Originally Posted by whitebear View Post
"That code is horrific."
and not words about spawn


2 X-olent Thank you very much! I will test!
He was just trieing to help.
DaxProxy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-09-2008 , 16:47   Re: auto exec depending on a number spawn
Reply With Quote #5

It is nice that he wants to help.
But he doesn't need to help if he doesn't know how to do it.

When he registered ResetHUD as new_round, he registered an event that is called from each player's spawn, when sv_restart 1 occurs, and whenever a client starts a demo.
So, this even will be called very much and not at new round all the time.
Now when he used a random number, he was using a random index, which I don't know why he was doing this. I guess it was an attempt to find how many players? Then he did client command, even though the topic creator requested server command.
He should be learning how to create nice and sufficient codes before he starts helping people.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
whitebear
Junior Member
Join Date: Feb 2008
Old 07-10-2008 , 06:33   Re: auto exec depending on a number spawn
Reply With Quote #6

And to add "print to concole server and HUD-message "On this map can play XXX players"" will not turn out?
if difficultly - this not problem - simply say that no ))

ay?

Last edited by whitebear; 07-13-2008 at 05:31.
whitebear is offline
whitebear
Junior Member
Join Date: Feb 2008
Old 07-14-2008 , 00:34   Re: auto exec depending on a number spawn
Reply With Quote #7

put on a server - works, but not so as required ((
it is necessary: for example: map de_inferno = 20 spawn. Connected 20 players. Plugin stop. When connected yet 1 and more players, plugin send server cmd "amx_rtv".
whitebear 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 15:32.


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