Raised This Month: $12 Target: $400
 3% 

[CS:GO] Detect jump action when player is dead


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
notMe2
Member
Join Date: Feb 2014
Old 07-30-2018 , 10:39   [CS:GO] Detect jump action when player is dead
Reply With Quote #1

The goal is when user press space bar it respawns. I tried both GetClientButtons and OnPlayerRunCmd but seems like when the player is dead the IN_JUMP key doesnt get triggered. Any other solution?

Thanks in advance.
notMe2 is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 07-30-2018 , 12:00   Re: [CS:GO] Detect jump action when player is dead
Reply With Quote #2

PHP Code:
#include <sourcemod>
#include <cstrike>

public OnPluginStart()
{
    
AddCommandListener(Respawn_Check"spec_mode");
}

public 
Action:Respawn_Check(client, const String:command[], argc)
{
    if(!
IsValidClient(client))
        return 
Plugin_Continue;
    
    if(
IsPlayerAlive(client))
        return 
Plugin_Continue;
    
    if(
GetClientTeam(client) != CS_TEAM_CT && GetClientTeam(client) != CS_TEAM_T)
        return 
Plugin_Continue;
    
    
CS_RespawnPlayer(client);
    
    return 
Plugin_Continue;
}

bool:IsValidClient(client)
{
    if(!(
<= client <= MaxClients) || !IsClientConnected(client) || !IsClientInGame(client) || IsFakeClient(client))
        return 
false;

    return 
true;

__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards is offline
notMe2
Member
Join Date: Feb 2014
Old 07-30-2018 , 13:11   Re: [CS:GO] Detect jump action when player is dead
Reply With Quote #3

Hi 1337norway,

Thank you for the answer, but the idea is not just spawn the player after death, but to wait him till press spacebar before doing so.
notMe2 is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 07-30-2018 , 23:10   Re: [CS:GO] Detect jump action when player is dead
Reply With Quote #4

Quote:
Originally Posted by notMe2 View Post
Hi 1337norway,

Thank you for the answer, but the idea is not just spawn the player after death, but to wait him till press spacebar before doing so.
Yes I'm well aware, that's what the code posted above will do.
__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards is offline
notMe2
Member
Join Date: Feb 2014
Old 08-01-2018 , 15:27   Re: [CS:GO] Detect jump action when player is dead
Reply With Quote #5

Thank you! Solved.
notMe2 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:25.


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