AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   [3 in 1] Fail Spawn Protector + Auto Spawn Creator + Team Limiter (https://forums.alliedmods.net/showthread.php?t=248415)

zmd94 09-17-2014 01:00

[3 in 1] Fail Spawn Protector + Auto Spawn Creator + Team Limiter
 
1 Attachment(s)
Fail Spawn Protector + Auto Spawn Creator + Team Limiter v1.2
No more meaningless death!

Status:
UP-TO-DATE
(17/6/2016)


Description:
This simple and useful plugin will protect you from dying due to bad spawn location. Now, with Auto Spawn Creator feature, you can spawn more players than existed spawn points inside map.
Plugin Tested!
This plugin is tested on special map with 32 spawnpoints at identical origin and its works nicely. Just visit this thread to read more about the testing. ;)
What can you edit?
PHP Code:

    g_iStartDistance register_cvar("fw_StartDistance""32"// First search distance for finding a free location in map
    
g_iMaxAttempts register_cvar("fw_MaxAttempts""128"// How many times to search in an area for a free space 
    
g_iTerrorMaxSpawn register_cvar("fw_TerrorMaxSpawn""0"// Maximum Terror spawn entities | If you want to disable it, just add "0" value
    
g_iCTMaxSpawn register_cvar("fw_CTMaxSpawn""0"// Maximum CT spawn entities | If you want to disable it, just add "0" value 

Auto Spawn Creator?
If you want to use this feature, just uncomment this part:
Code:

// Uncomment 'AUTO_SPAWNCREATOR' if your want to enable auto spawn creator
//#define AUTO_SPAWNCREATOR

Example?
This messages are printed in your server console:
PHP Code:

L 06/17/2016 17:09:54: -------- Mapchange to cs_assault --------
[
Fail Spawn ProtectorCreating new file
[Fail Spawn ProtectorDeleting old file
[Fail Spawn ProtectorRequired 3 less Terror spawn entities!
[
Fail Spawn ProtectorAuto reload
[Fail Spawn ProtectorRequired 3 less CT spawn entities!
[
Fail Spawn ProtectorAuto reload
[Fail Spawn ProtectorCS Spawn Entity10 || Terror Spawn Entity10
[Fail Spawn ProtectorServer is reloading
L 06
/17/2016 17:09:55: -------- Mapchange to cs_assault --------
[
Fail Spawn ProtectorCreating new file
[Fail Spawn ProtectorDeleting old file
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorCT original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorTerror original spawn is remove
[Fail Spawn ProtectorCS Spawn Entity|| Terror Spawn Entity

Note!
This plugin need at least 1 valid spawn point in the map.

New
Auto Spawn Creator
feature do not prevent connected player. It only removing or adding the spawn entity.
Rare Problem!
Sometime, if the spawn entities configure via fw_TerrorMaxSpawn cvar and fw_CTMaxSpawn cvar is less than the original spawn entity, the player still be spawned at the beginning of round. As example, original spawn point is 10. If we configured it into 1, then all 10's player will be spawned at the same spawn location.

So, to fix this rare problem, after round started, random player will died automatically until alive player is equal to new spawn entities or points.
Team Limiter?
If you want to use this feature,just follow below method:

1. Just uncomment this part:
PHP Code:

// Uncomment 'AUTO_SPAWNCREATOR' if your want to enable auto spawn creator
//#define AUTO_SPAWNCREATOR 

2. Then, edit this cvars:
PHP Code:

    g_iTerrorMaxSpawn register_cvar("fw_TerrorMaxSpawn""0"//  Maximum Terror spawn entities | If you want to disable it, just add "0"  value
    
g_iCTMaxSpawn register_cvar("fw_CTMaxSpawn""0"// Maximum CT  spawn entities | If you want to disable it, just add "0" value 

3. fw_TerrorMaxSpawn cvar is represent for Terrorist amount per team.
4. fw_CTMaxSpawn cvar is represent for CT amount per team.
Credits:
1. xPaw.
2. VEN.
3. Arkshine.
4. Phant (Testing the code in his special map).
Changelog:
Code:

(17 Sep 2014)
v1.0 - First release.
v1.1 - [FIXED] Cache problems.

v1.0- (9 Nov 2015)
- Release of new plugin.

v1.1 (6 Dis 2015)
- [FIXED] Remove unnecessary bool.
- [FIXED] Using existing defined code.
- [FIXED] Variable naming.

v1.2 - (17 Jun 2016)
- [FIXED] First safely spawn player will be killed by worldspawn.
- [ADDED] Safety check via player origin to determine whether player is idle or not.
- [ADDED] Auto-spawn creator and team limiter features.

Downloads:

v1.0 - 40
v1.0 - 99

Feel free to use it. ;)

AGoodGuy 09-17-2014 09:11

Re: Colorful Admin Message v1.0
 
Nike plugins, but i think if change command like admin_chat,

#-your text for corlor chat
$-your text for hud chat

it'll easy than this.

HamletEagle 09-17-2014 09:29

Re: Colorful Admin Message v1.0
 
Code:
for ( i = 0; i < count; i ++ )     {         if ( is_user_connected ( players [ i ] ) )         {             message_begin ( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players [ i ] )             write_byte ( players [ i ] )             write_string ( message )             message_end ( )         }     }

Cache get_user_msgid("SayText").
Don't re-index an array.

zmd94 09-17-2014 09:30

Re: Colorful Admin Message v1.0
 
Sorry AGoodGuy, I can't understand what are you trying to say?

;)

zmd94 09-17-2014 09:38

Re: Colorful Admin Message v1.0
 
Quote:

Originally Posted by HamletEagle (Post 2200137)
Cache get_user_msgid("SayText"). Don't re-index an array.

Do you mean that, it is better in this way?
PHP Code:

new g_MsgText

public plugin init()
{

    
g_MsgText get_user_msgid("SayText")
}

stock print_colored ( const index, const input [ ], const any:... )
{

    for ( 
0count++ )
    {
        if ( 
is_user_connected players ] ) )
        {
            
message_begin MSG_ONE_UNRELIABLEg_MsgText_players ] )
            
write_byte players ] )
            
write_string message )
            
message_end ( )
        }
    }



HamletEagle 09-17-2014 09:41

Re: Colorful Admin Message v1.0
 
The better way is this:
Code:
new g_MsgText public plugin init() {     g_MsgText = get_user_msgid("SayText") } stock print_colored ( const index, const input [ ], const any:... ) {     new id     for ( i = 0; i < count; i ++ )     {         id = players[ i ]         if ( is_user_connected ( id  ) )         {             message_begin ( MSG_ONE_UNRELIABLE, g_MsgText, _, id )             write_byte ( id )             write_string ( message )             message_end ( )         }     } }

zmd94 09-17-2014 09:56

Re: Colorful Admin Message v1.0
 
HamletEagle, may I know why that your way is better?

;)

HamletEagle 09-17-2014 10:17

Re: Colorful Admin Message v1.0
 
You can search by yourself:
1. It's obvious, instead of using get_user_msgid every time, you cache it's value( it won't change during run time ).
2. Search on the wiki.

zmd94 09-17-2014 10:19

Re: Colorful Admin Message v1.0
 
Quote:

Originally Posted by HamletEagle (Post 2200167)
You can search by yourself:
1. It's obvious, instead of using get_user_msgid every time, you cache it's value (it won't change during run time).
2. Search on the wiki.

Yes, my fault. Thank you for correcting me. ;)

I will update the code.

Edit:
Quote:

Originally Posted by zmd94
v1.1 - [FIXED] Cache problems.


HamletEagle 10-23-2015 14:35

Re: Colorful Admin Message v1.1
 
This is pretty useless IMO, but given that there is no other plugin that does this I will let it pass if you make this changes:

1.#define ADMIN_FLAG ADMIN_IMMUNITY make it a cvar/command instead.
2.Add cvars for colors. You could let the owner decide if he wants random color or some predefined ones(that he can set up from cvars too).
3.message should be 192 and not 64. 192 is the max.
4.Remove the "stock" keyword, stock is used for functions that may not be used, but you should use everything from your plugin, thus "stock" does not make sense.
5.In print_colored:
  • use charsmax() instead of hardcoding a string-array size, it's better for readability.
  • if (is_user_connected(id)) check is not needed, get_players give you an array of valid player.
  • if (index) -> check if it is between 1 and MaxPlayers.
6.Put any relevant informations inside source file, it's easier for the owner. This include cvars, how to use the plugin, thread link etc.

Some suggestions:
1.Allow users to use this messages too(maybe a cvar, why not ?)
2.You could include a command like amx_showcolorcodes(or sth like this) and print the shortcuts(!g, etc).
3.Allow the player to specify to which player to send the message. For example, you may want to send the message only to player X or to all players. You can add another argument inside the command for this(like 0(for all)/CT/T/X(the player name)).


All times are GMT -4. The time now is 02:19.

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