Raised This Month: $143 Target: $400
 35% 

[CS:S] Dynamic/Random Spawnpoints for GGDM


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
firefist235
Member
Join Date: Jan 2020
Old 01-30-2025 , 04:56   [CS:S] Dynamic/Random Spawnpoints for GGDM
Reply With Quote #1

Hi all,
i use SM_Gungame with GGDM on my CS:S Server. Dead players respawn after death like they should, but always at default points, or those points preset in /cstrike/cfg/ggdm/spawns.
Is there a way to randomize spawn points, because i don't like to make a spawn-point file for every single map.
A few years ago i ran several css servers, on of them used Smartspawn for Mattie Eventscipts. This plugin automatically saved potential spawn points while the map was running.

Is there something similar for SM?
__________________

firefist235 is offline
101
Senior Member
Join Date: Nov 2023
Old 02-18-2025 , 03:58   Re: [CS:S] Dynamic/Random Spawnpoints for GGDM
Reply With Quote #2

what is the point of [Random SpawnPoints] ?
its not a good idea to spawn players randomly right "behind enemy lines" or nearby the enemy location , its acceptable for fun gameplay but its hard to be accepted in competitive matches .

can you describe more about this mod ?
* i can help with generation random spawn points , but I can't guarantee they will be spawned in a safe place *
101 is offline
firefist235
Member
Join Date: Jan 2020
Old 02-18-2025 , 14:10   Re: [CS:S] Dynamic/Random Spawnpoints for GGDM
Reply With Quote #3

Its meant for my Gungame Server, so it is definitely no competitive ;D
I managed to write a small script, that logs human player locations every x seconds and y meters unto a certain amount into a file that CSSM can use as spawn points.
But thank you for your offer
__________________

firefist235 is offline
101
Senior Member
Join Date: Nov 2023
Old 02-19-2025 , 15:02   Re: [CS:S] Dynamic/Random Spawnpoints for GGDM
Reply With Quote #4

its not an offer , its some kind of 'knowledge generating' .
btw . while you were able to generate random spawn points based on x seconds and y meters [which is amazing method] , then why do you need to store these points in txt file ? and why you want another plugin to use that txt file ?
I mean : In your own script , you can teleport players to a random location directly once they are spawned without using any complex trick .

PHP Code:
OnPlayerSpawn(int client)
{
    
TeleportEntityclient RandomPos NULL_VECTOR NULL_VECTOR);

so you don't need to save a txt file then asking another plugin to use that file [which is complex] .

but you have to avoid :
* saving points when the player is currently crawling under a short ceil , climbing a ladder , falling .
* teleproting more than one player at the same moment to the same location , which will lead to freeze them (collision) , so they won't be able to move .

did you manage that ?

Last edited by 101; 02-19-2025 at 15:29.
101 is offline
firefist235
Member
Join Date: Jan 2020
Old 02-21-2025 , 14:09   Re: [CS:S] Dynamic/Random Spawnpoints for GGDM
Reply With Quote #5

The script already only add spawnpoints when the player is on ground and not crouching.
I like the way CSSM works, thats why i save the spawns in a txt file CSSM can use.

EDIT: now i remember why i prefer CSSDM over Gungames built-in DM: CSSDM can handle bot quota better.
__________________


Last edited by firefist235; 02-21-2025 at 15:14.
firefist235 is offline
101
Senior Member
Join Date: Nov 2023
Old 02-23-2025 , 17:48   Re: [CS:S] Dynamic/Random Spawnpoints for GGDM
Reply With Quote #6

I can't understand the reason of your request !

- While you were able to generate random points , So I believe that you can save them in a txt file automatically without the need of hand typing!
- You can either edit the source code of 'CSSDM' by managing the part where the plugin is trying to read that txt file , then replace that function with a direct supply of your coordinates [those that was generated based on x seconds and y meters].

Anyway , If you want to dive alone and get independent of that sticky 'CSSDM' :


[ANY] Dynamic/Random Spawnpoints
PHP Code:
#include <sdktools>

#define Timer_Interval    5.0
#define POINTS_LIMIT    200
#define Cubit            50.0


Handle hTimer[MAXPLAYERS+1];
float RandomPos[POINTS_LIMIT][3];
int count;
bool safepoint[MAXPLAYERS+1];

public 
OnPluginStart(){
    
HookEvent("player_spawn"event_player_spawn EventHookMode_Post);
}

public 
event_player_spawn(Handle eventchar[] event_namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));

    if (!
IsValidHandle(hTimer[client]))
        
hTimer[client] = CreateTimer(Timer_Interval ,Timer_Scan ,clientTIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);

    if (
count){ // your array is carrying some points
        
safepoint[client] = true;    
        
int rand GetRandomInt(0,count-1);
        
TR_EnumerateEntitiesSphere(RandomPos[rand] , Cubit PARTITION_NON_STATIC_EDICTSEntities_Nearby_Enumeratorclient);

        if ( 
safepoint[client] )
            
TeleportEntityclient RandomPos[rand] , NULL_VECTOR NULL_VECTOR);
        else
            
PrintToChat(client "failed to teleport");
    }
}

public 
Action Timer_Scan(Handle timer any client){
    if (
count POINTS_LIMIT){
        if (
IsWalking(client) && !UnderCeil(client) )
            
GetClientAbsOrigin(client RandomPos[count++]);
        else
            
PrintToChat(client "failed to save point");
        return 
Plugin_Continue;
    }
    return 
Plugin_Stop;
}

public 
OnClientDisconnect(int client){
    if (
IsValidHandle(hTimer[client]))
        
KillTimer(hTimer[client]);
}

public 
OnMapEnd(){
    
char CMap[32];
    
GetCurrentMap(CMap32);
    
LogMessage("%s Valid Spawn Positions :" CMap);
    for (
int i=i<count i++)
        
LogMessage("[%f , %f , %f]" RandomPos[i][0] , RandomPos[i][1] , RandomPos[i][2]);
    
count 0;
}

bool Entities_Nearby_Enumerator(int entityint client){
    return (
safepoint[client] = entity || entity MaxClients);    // if true , the fucntion will continue enumerating the surrounded entities until it finds a valid player [so false means : stop enumerating]
}

bool UnderCeil(client){
    static 
float pos1[3],pos2[3];
    
GetClientEyePosition(client pos1);
    
pos2[0] = pos1[0];
    
pos2[1] = pos1[1];
    
pos2[2] = pos1[2] + Cubit;
    
TR_TraceRay(pos1pos2MASK_SOLID RayType_EndPoint);
    return 
TR_DidHit();
}

bool IsWalking(int client){
    return ( (
GetEntityMoveType(client) == MOVETYPE_WALK) && GetVelocity(client) > 
}

stock float GetVelocity(int client){
    static 
float vel[3];
    
GetEntPropVector(clientProp_Data"m_vecAbsVelocity"vel);
    return 
GetVectorLength(vel);

101 is offline
firefist235
Member
Join Date: Jan 2020
Old 02-24-2025 , 01:46   Re: [CS:S] Dynamic/Random Spawnpoints for GGDM
Reply With Quote #7

It seems I didn’t express myself clearly. At the time of my first post, I was looking for such a plugin, hoping that one already existed. However, I managed to write one myself, and it works quite well. I also moved away from CSSDM since it stopped working after the last update and am now using the built-in GGDM of the GunGame plugin. It works great; I just had to change the path in my plugin. So, it wasn’t necessary for you to write a plugin for me. Still, very very kind of you. I apologize if that wasn’t clear.
__________________

firefist235 is offline
Reply


Thread Tools
Display Modes

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 19:04.


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