Raised This Month: $32 Target: $400
 8% 

[HELP] Auto respawn in random positions (L4D)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Beatles
Senior Member
Join Date: Feb 2014
Old 04-06-2019 , 02:54   [HELP] Auto respawn in random positions (L4D)
Reply With Quote #1

I know that here are the best ones, and that they help me with this.

I would like you to help me with a syntax.

Currently there are many "respawn" plugins, each with certain different qualities, some help respawn the survivors through the menu or a command, others have an automatic respawn, making one survivor appear next to another, and others that make the survivors respawn at the start of the game.

What I want is for a dead survivor to respawn anywhere on the map, but never close to a partner, or perhaps to make them appear in certain locations, or in the RESCUE_CLOSET zones of the NAV.

Well, what I am using now is that they appear close to their classmates, and I did it in the following way:

PHP Code:
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));

    if (
isRespawn && IsValidClient(client) && GetClientTeam(client) == 2)
    {
        
ForcePlayerSuicide(client);
        
RespawnTimer[client] = CreateTimer(GetConVarFloat(l4dm_autorespawn_timeout), Timer_Respawnclient);     
    }
}

public 
Action:Timer_Respawn(Handle:timerany:client)
{
    if (
IsValidClient(client))
    {
        
SDKCall(hRoundRespawnclient);

        
decl Float:position[3], Float:anglestarget[3];

        new 
any:target FindNewTarget(clientteleporttarget[client]);
        if (!
IsClientInGame(target)) target FindNewTarget(client1);
        if (
target == clienttarget FindNewTarget(clienttarget);

        
GetClientAbsOrigin(targetposition);
        
GetClientAbsAngles(targetanglestarget);
        
TeleportEntity(clientpositionanglestargetNULL_VECTOR);
    }


Last edited by Beatles; 04-06-2019 at 17:05. Reason: Title
Beatles is offline
Aya Supay
Member
Join Date: Nov 2015
Old 04-13-2019 , 18:21   Re: [HELP] Auto respawn in random positions (L4D)
Reply With Quote #2

Quote:
Originally Posted by Beatles View Post
I know that here are the best ones, and that they help me with this.

I would like you to help me with a syntax.

Currently there are many "respawn" plugins, each with certain different qualities, some help respawn the survivors through the menu or a command, others have an automatic respawn, making one survivor appear next to another, and others that make the survivors respawn at the start of the game.

What I want is for a dead survivor to respawn anywhere on the map, but never close to a partner, or perhaps to make them appear in certain locations, or in the RESCUE_CLOSET zones of the NAV.

Well, what I am using now is that they appear close to their classmates, and I did it in the following way:

PHP Code:
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));

    if (
isRespawn && IsValidClient(client) && GetClientTeam(client) == 2)
    {
        
ForcePlayerSuicide(client);
        
RespawnTimer[client] = CreateTimer(GetConVarFloat(l4dm_autorespawn_timeout), Timer_Respawnclient);     
    }
}

public 
Action:Timer_Respawn(Handle:timerany:client)
{
    if (
IsValidClient(client))
    {
        
SDKCall(hRoundRespawnclient);

        
decl Float:position[3], Float:anglestarget[3];

        new 
any:target FindNewTarget(clientteleporttarget[client]);
        if (!
IsClientInGame(target)) target FindNewTarget(client1);
        if (
target == clienttarget FindNewTarget(clienttarget);

        
GetClientAbsOrigin(targetposition);
        
GetClientAbsAngles(targetanglestarget);
        
TeleportEntity(clientpositionanglestargetNULL_VECTOR);
    }


example:

public Action Timer_Respawn(Handle timer, any client)
{
SDKCall(hRoundRespawn, client);
float pos[3];
pos = GetRandomRespawnPos();
if(client <= 0 || !IsValidEntity(client) || !IsClientInGame(client) || GetClientTeam(client) != 2)
{
return;
}
TeleportEntity(client, pos, NULL_VECTOR, NULL_VECTOR);
}
Attached Files
File Type: sp Get Plugin or Get Source (pos_randon_test.sp - 81 views - 2.9 KB)
Aya Supay is offline
Reply



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 06:32.


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