AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Chnanging map when players not enough (https://forums.alliedmods.net/showthread.php?t=194200)

Caldeum 08-26-2012 05:51

Chnanging map when players not enough
 
Last topic locked. I create new one. Doesn't work for me. Does anyone know why?

PHP Code:

#pragma semicolon 1
#include < amxmodx >
#include < amxmisc >
#include < color >

public plugin_init( )
{
register_plugin"Changing map""0.1""alliedmodd" );

register_logevent"endround_event"2"0=World triggered""1=Round_End" );
}

public 
endround_eventid )
{
new 
players;
players get_playersnum( );

new 
Name32 ];
get_mapnameName31 );

if ( 
equaliName"de_" ) || equaliName"cs_office" ) || equaliName"cs_italy" ) )
{
if ( 
equaliName"de_dust2_2x2" ) )
return;

if ( 
players )
{
print_colorid"[AMXX] players are less than 8. Next map will be de_dust2_2x2." );
set_task0.15"changesmallmap" );
}
}

if ( 
equaliName"fy_" ) || equaliName"awp_" ) || equaliName"cs_deagle5" ) || 
equaliName"cs_max" ) || equaliName"aim_" ) || equaliName"35hp_" ) || equaliName"de_dust2_2x2" ) )
{
if ( 
players 10 )
{
print_colorid"[AMXX] players are more than 10. Next map will be de_dust2." );
set_task0.15"changebigmap" );
}
}
}

public 
changesmallmap( )
{
server_cmd"exec mapcycle_small.txt" );
server_cmd"changelevel de_dust2_2x2" );
}

public 
changebigmap( )
{
server_cmd"exec mapcycle_big.txt" );
server_cmd"changelevel de_dust2" );


or better use ? +mapcycle...
PHP Code:

server_cmd"mapcycle mapcycle_big.txt" ); 


Napoleon_be 08-26-2012 10:08

Re: Chnanging map when players not enough
 
endround_event(id) --> endround_event(). Also, you should use get_players() since it's the easiest way to do so.

Caldeum 08-26-2012 12:19

Re: Chnanging map when players not enough
 
an you give me example with get_players() ?

matsi 08-26-2012 14:15

Re: Chnanging map when players not enough
 
Quote:

Originally Posted by Caldeum (Post 1783271)
an you give me example with get_players() ?

Or can you search for it... ? You will get your answer faster that way.

Torge 08-26-2012 14:24

Re: Chnanging map when players not enough
 
This is a fast way:

PHP Code:

new iPlayers[32], iNum;
get_players(iPlayersiNum"ae""CT");

// And so on.. 


matsi 08-26-2012 14:27

Re: Chnanging map when players not enough
 
Quote:

Originally Posted by Torge (Post 1783427)
This is a fast way:

PHP Code:

new iPlayers[32], iNum;
get_players(iPlayersiNum"ae""CT");

// And so on.. 


Are you stupid? As far as i know he never asked how to get all alive cts and you even left the looping part. Even funcwiki offers better examples than yours.

Torge 08-26-2012 14:34

Re: Chnanging map when players not enough
 
Quote:

Originally Posted by matsi (Post 1783431)
Are you stupid? As far as i know he never asked how to get all alive cts and you even left the looping part. Even funcwiki offers better examples than yours.

That's just example, I didn't said that he must use it.

nikhilgupta345 08-26-2012 15:24

Re: Chnanging map when players not enough
 
Quote:

Originally Posted by Napoleon_be (Post 1783196)
Also, you should use get_players() since it's the easiest way to do so.

What are you saying? That doesn't even make sense...
get_playersnum() is perfectly fine since he doesn't need the actual list of players.

matsi 08-26-2012 15:46

Re: Chnanging map when players not enough
 
Quote:

Originally Posted by Torge (Post 1783438)
That's just example, I didn't said that he must use it.

Taken from amxmodx.inc:
Code:

/* Sets indexes of players.
* Flags:
* "a" - don't collect dead players.
* "b" - don't collect alive players.
* "c" - skip bots.
* "d" - skip real players.
* "e" - match with team.
* "f" - match with part of name.
* "g" - ignore case sensitivity.
* "h" - skip HLTV.
* Example: Get all alive CTs: get_players(players,num,"ae","CT") */
native get_players(players[32], &num ,const flags[]="", const team[]="");

It has more info than your and he might learn something from it.

Quote:

Originally Posted by nikhilgupta345 (Post 1783489)
What are you saying? That doesn't even make sense...
get_playersnum() is perfectly fine since he doesn't need the actual list of players.

This is also true didn't pay any attention to that. You might also want to check get_playersnum() in connect/disconnect forwards.

lucas_7_94 08-26-2012 16:30

Re: Chnanging map when players not enough
 
You can cache the map name , that will not change , and Round_End doesnt have params.


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

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