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 02: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 10: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 10: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 10:30

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

;)

zmd94 09-17-2014 10: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 10: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 10:56

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

;)

HamletEagle 09-17-2014 11: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 11: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 15: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)).

zmd94 10-23-2015 20:57

Re: Colorful Admin Message v1.1
 
I will update this plugin with something more useful.

OciXCrom 10-24-2015 09:03

Re: Colorful Admin Message v1.1
 
There's already something more useful waiting to be reviewed - https://forums.alliedmods.net/showthread.php?t=272418 . Every option from your plugin is available in that one, so I don't think that updating this one is necessary.

HamletEagle 10-24-2015 10:27

Re: Colorful Admin Message v1.1
 
Quote:

Originally Posted by OciXCrom (Post 2356140)
There's already something more useful waiting to be reviewed - https://forums.alliedmods.net/showthread.php?t=272418 . Every option from your plugin is available in that one, so I don't think that updating this one is necessary.

Then wait for an approver to review your plugin and don't spam threads randomly.

@zmd, no need to think too much, just complete what I have said and it should be okay.

zmd94 10-24-2015 13:31

Re: Colorful Admin Message v1.1
 
Oci, I know that your plugin can do more things. So, I will fully rewritten this code into something more useful and unique.

zmd94 11-09-2015 06:00

Re: Fail Spawn Protector v1.0
 
Fail Spawn Protector v1.0
No more meaningless death!

Status:
UP-TO-DATE (9/11/2015)

Feel free to use it.

Note: I have tested almost same plugin by xPaw, yet it is not working is my server. So, I come out with this plugin. ;)

This plugin is using new ways or method to find free locations in the map.

JusTGo 11-09-2015 14:04

Re: Fail Spawn Protector v1.0
 
nice plugin, me too xpaw plugin didn't fix the bug hope this one works from what i undrestand it will teleport the player when he spawns before he die with worldspawn to another location but i don't undrestand why check 128 times for a freespace btw you can look at the code of this https://forums.alliedmods.net/showthread.php?p=441576 to see how it teleport players.

HamletEagle 11-09-2015 15:31

Re: Fail Spawn Protector v1.0
 
Lol, don't do that. Don't remove your old plugin + thread and put another one here. You will just confuse people, please open a new thread and put back the old one here.

zmd94 11-09-2015 23:45

Re: Fail Spawn Protector v1.0
 
JustGo, no need to change that values if you are not sure.

Sorry, HamletEagle. I'm not longer supported that old plugin.


HamletEagle 11-10-2015 00:56

Re: Fail Spawn Protector v1.0
 
Then ask an approver to unapprove it and make a new thread.

zmd94 11-10-2015 05:22

Re: Fail Spawn Protector v1.0
 
I don't think people will be confused as this thread only reached 2 pages. Next, the main post and also the main title of this thread is clearly written what this thread is about.

If they still not clear, they can ask about it.

HamletEagle 12-05-2015 09:29

Re: Fail Spawn Protector v1.0
 
What is the difference between yours and https://forums.alliedmods.net/showthread.php?t=114857 ? Also tell me where is your code ? I only see code from xpaw, VEN and Arkshine.

JusTGo 12-05-2015 11:38

Re: Fail Spawn Protector v1.0
 
Quote:

Originally Posted by HamletEagle (Post 2368974)
What is the difference between yours and https://forums.alliedmods.net/showthread.php?t=114857 ? Also tell me where is your code ? I only see code from xpaw, VEN and Arkshine.

i have tested xpaw plugin and people get stuck in each other when they spawn.

HamletEagle 12-05-2015 11:49

Re: Fail Spawn Protector v1.0
 
Quote:

Originally Posted by JusTGo (Post 2369005)
i have tested xpaw plugin and people get stuck in each other when they spawn.

Can you confirm that this one is working correctly ?

Phant 12-05-2015 13:28

Re: Fail Spawn Protector v1.0
 
Awesome plugin, not seen it before.
Just tested right now on special map with 32 spawnpoints at identical origin:
http://5.firepic.org/5/images/2015-1...2p08m039hr.png
And its works. Works better than Bad Spawns Preventer by xPaw.

Current plugin:
http://6.firepic.org/6/thumbs/2015-1...zey72q7knj.jpghttp://6.firepic.org/6/thumbs/2015-1...cim5usymqt.jpg

Bad Spawns Preventer:
http://6.firepic.org/6/thumbs/2015-1...s8m63wqgh3.jpghttp://6.firepic.org/6/thumbs/2015-1...386m9fqjhw.jpg
Notice on shadow in center. There is many alive bots at same origin (stucked).

PS:
Both plugins can't spawn more players than existed spawnpoints inside map (if map have 1 CT and 1 T spawnpoints, then game can spawn only 1 CT and 1 T Players). So, would be nice to "crack" (bypass) this limit (optional cvar).

JusTGo 12-05-2015 13:43

Re: Fail Spawn Protector v1.0
 
Quote:

Originally Posted by HamletEagle (Post 2369008)
Can you confirm that this one is working correctly ?

yes you can check phant proove players get stuck on each other in expaw plugin will test this soon

Quote:

Originally Posted by Phant (Post 2369030)
Awesome plugin, not seen it before.
Just tested right now on special map with 32 spawnpoints at identical origin:
http://5.firepic.org/5/images/2015-1...2p08m039hr.png
And its works. Works better than Bad Spawns Preventer by xPaw.

Current plugin:
http://6.firepic.org/6/thumbs/2015-1...zey72q7knj.jpghttp://6.firepic.org/6/thumbs/2015-1...cim5usymqt.jpg

Bad Spawns Preventer:
http://6.firepic.org/6/thumbs/2015-1...s8m63wqgh3.jpghttp://6.firepic.org/6/thumbs/2015-1...386m9fqjhw.jpg
Notice on shadow in center. There is many alive bots at same origin (stucked).

PS:
Both plugins can't spawn more players than existed spawnpoints inside map (if map have 1 CT and 1 T spawnpoints, then game can spawn only 1 CT and 1 T Players). So, would be nice to "crack" (bypass) this limit (optional cvar).

phant no one get stuck with zmd version right ?

Phant 12-05-2015 23:04

Re: Fail Spawn Protector v1.0
 
Quote:

phant no one get stuck with zmd version right ?
Right.

zmd94 12-05-2015 23:12

Re: Fail Spawn Protector v1.0
 
You are right, Phant. Thank you for testing the code.

HamletEagle, my code is the whole code that consist of xPaw, VEN and Arkshine codes. I combine all of their code into one working and better code.

HamletEagle 12-06-2015 05:54

Re: Fail Spawn Protector v1.0
 
1.I would like you to be consistent while coding(keep the same naming technique). For example, on some variables you use HN(g_,i,f, etc) and at some you don't(originF).
2.I also don't think g_bHamHookEnabled is really needed, you can simply Enable the hook at SpawnPre and Disable it in SpawnPost.
3.Also try to understand what you are taking from others. In is_player_trap you do:
PHP Code:

engfunc(EngFunc_TraceHulloriginForiginF0, (pev(idpev_flags) & FL_DUCKING) ? HULL_HEAD HULL_HUMANid0

But you have a PlayerHullSize define, so use it.

Apart of that, code looks ok. I'll wait for you to fix at least 2 and 3, then I'll approve it.

Phant 12-06-2015 06:27

Re: Fail Spawn Protector v1.0
 
Quote:

PS:
Both plugins can't spawn more players than existed spawnpoints inside map (if map have 1 CT and 1 T spawnpoints, then game can spawn only 1 CT and 1 T Players). So, would be nice to "crack" (bypass) this limit (optional cvar).
Alternative solution:
Count info_player_start entities in plugin_precache() and if total count < 16, then copy last (or randomly founded) info_player_start entity at same position X times (up to 16). Ofcourse same for info_player_deathmatch.
With this all players can play on ANY map without spawnpoints editing :).

What do you think? Make it optional (fs_extra_spawns 1/0).

zmd94 12-06-2015 06:53

Re: Fail Spawn Protector v1.1
 
New Update!
Code:

v1.1
- [FIXED] Remove unnecessary bool.
- [FIXED] Using existing defined code.
- [FIXED] Variable naming.

Phant, nice idea. Will fiqure out the correct and best way to do it. ;)

HamletEagle 12-06-2015 07:07

Re: Fail Spawn Protector v1.1
 
Looks ok for me.
Approved.

zmd94 12-06-2015 07:16

Re: Fail Spawn Protector v1.1
 
Really appreciate it, HamletEagle.

Phant, I find this code. So, what your opinion?

https://forums.alliedmods.net/showpo...31&postcount=7

HamletEagle 12-06-2015 07:37

Re: Fail Spawn Protector v1.1
 
Precache is too early for this, try something like that:
Spoiler


I am not sure if this is the best way, I have to check something, but I don't have time right now. Based on his ideea, see what you can do with this. It will create entities until they number is 32, only if the default number is < 16.

zmd94 12-06-2015 07:41

Re: Fail Spawn Protector v1.1
 
Alright, HamletEagle. Will test it.

JusTGo 12-06-2015 08:19

Re: Fail Spawn Protector v1.1
 
also some custome maps have like 26T spawn 6 CT spawn it will be greate if we can choose how many max spawn points for each team.

Phant 12-06-2015 08:39

Re: Fail Spawn Protector v1.1
 
I think if you create spawnpoints later than plugin_precache(), then these spawnpoints will NOT work.
You should create spawnpoints inside plugin_precache(), but we need coordinates of exist spawnpoints, plugin_precache() too early for this :). Interesting situation.

zmd94 12-06-2015 11:09

Re: Fail Spawn Protector v1.1
 
Now, it will become more complicated.

\o/

Will release the beta version soon.

JusTGo 12-06-2015 12:10

Re: Fail Spawn Protector v1.1
 
Quote:

Originally Posted by Phant (Post 2369308)
I think if you create spawnpoints later than plugin_precache(), then these spawnpoints will NOT work.
You should create spawnpoints inside plugin_precache(), but we need coordinates of exist spawnpoints, plugin_precache() too early for this :). Interesting situation.

idk mayby creating the spawn point at random origin in plugin_precahse() then after that get spawn point origine and edit the oigin of new spawn points ?

zmd94 12-07-2015 06:27

Re: Fail Spawn Protector v1.1
 
Alright.

KliPPy 12-14-2015 18:16

Re: Fail Spawn Protector v1.1
 
If plugin_precache() is too early, and plugin_init() is too late, try hooking "info_player_deathmatch" and "info_player_start" Spawn, and do stuff in there. That's probably the best moment for doing it.

By the way, great job.


All times are GMT -4. The time now is 18:42.

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