View Single Post
Plugin Info:     Modification:          Category:          Approver:   HamletEagle (33)
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 09-17-2014 , 01:00   [3 in 1] Fail Spawn Protector + Auto Spawn Creator + Team Limiter
Reply With Quote #1

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. ;)
Attached Files
File Type: sma Get Plugin or Get Source (fail_spawn_protector.sma - 1129 views - 11.9 KB)
__________________
Problem with ZP?
ZP Helper!

Last edited by zmd94; 06-20-2016 at 14:05.
zmd94 is offline