Raised This Month: $ Target: $400
 0% 

Solved [INS] Respawn code help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raghava
Junior Member
Join Date: Jun 2016
Old 09-03-2017 , 20:15   [INS] Respawn code help
Reply With Quote #1

For Insurency 2014 : created a respawn plugin based on "Jared Ballou's Respawn plugin". Whenever player dies after 5 seconds respawn to happen, code is passing thru defined functions but player is not spawning.

Code:
new Handle:g_hPlayerRespawn;
Handle B2LTimers[MAXPLAYERS+1];

public OnPluginStart() 
{
	HookEvent("player_death", DeathEvent);	
	g_hPlayerRespawn = EndPrepSDKCall();
}

public Action:DeathEvent(Handle:event,const String:name[],bool:dontBroadcast)
{	
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	B2LTimers[client] = CreateTimer(5.0, MakeAlive, client);	
}

public Action MakeAlive(Handle timer, any client)
{
	decl String:game[40];
	GetGameFolderName(game, sizeof(game));
	if(IsClientInGame(client) && (!IsFakeClient(client)))
	{	
		SDKCall(g_hPlayerRespawn, client);
	}
	B2LTimers[client] = null;
}

public void OnClientDisconnect(int client)
{
	if (B2LTimers[client] != null)
	{
		KillTimer(B2LTimers[client]);
		B2LTimers[client] = null;
	}
}
Any help why player not re-spawning.

Last edited by raghava; 09-05-2017 at 07:52. Reason: Issue Solved
raghava is offline
root88
Senior Member
Join Date: May 2016
Old 09-04-2017 , 03:19   Re: [INS] Respawn code help
Reply With Quote #2

PHP Code:
#include <cstrike>
public OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeathEventHookMode_Post);
}

public 
Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
CreateTimer(5.0QuickRespawnclient);
}

public 
Action:QuickRespawn(Handle:timerany:client)
{
    if(
IsClientInGame(client) && !IsPlayerAlive(client) && GetClientTeam(client) > 1)
    {
        
CS_RespawnPlayer(client);
    }

Check it out, however you didn't say in which game you want it to work. The above code will work in CSGO/CSS.
__________________

Last edited by root88; 09-04-2017 at 03:20.
root88 is offline
raghava
Junior Member
Join Date: Jun 2016
Old 09-04-2017 , 09:23   Re: [INS] Respawn code help
Reply With Quote #3

Quote:
Originally Posted by root88 View Post
PHP Code:
#include <cstrike>
public OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeathEventHookMode_Post);
}

public 
Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
CreateTimer(5.0QuickRespawnclient);
}

public 
Action:QuickRespawn(Handle:timerany:client)
{
    if(
IsClientInGame(client) && !IsPlayerAlive(client) && GetClientTeam(client) > 1)
    {
        
CS_RespawnPlayer(client);
    }

Check it out, however you didn't say in which game you want it to work. The above code will work in CSGO/CSS.
I am using for Insurgency 2014
raghava is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 09-04-2017 , 12:49   Re: [INS] Respawn code help
Reply With Quote #4

Tried this ?
https://forums.alliedmods.net/showthread.php?p=984087
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
raghava
Junior Member
Join Date: Jun 2016
Old 09-05-2017 , 07:52   Re: [INS] Respawn code help
Reply With Quote #5

Quote:
Originally Posted by andi67 View Post
Tried but didn't worked, however I managed Jared Ballou's Respawn plugin to work. Issue solved. Mods can close this thread
raghava 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 00:49.


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