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

CS:GO HUD player death PROBLEM !!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sky162csgo
Junior Member
Join Date: Dec 2017
Old 12-10-2017 , 04:58   CS:GO HUD player death PROBLEM !!!
Reply With Quote #1

Hello ! I have problem with this plugin.When i killed some people I didn't see HUDTEXT but when I was death and i took BOT then I saw HUDTEXT ... I need help with this because i need plugin which will write hud text when i will kill any player.


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


Handle hudtext;                                                                    

public 
Plugin:myinfo 
{
    
name "Kill message",
}

public 
OnPluginStart()
{
    
hudtext CreateHudSynchronizer();
    
HookEvent("player_death"Event_PlayerDeath);
}

public 
Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    
    
float x3,y3;
    
x3=-1.00;
    
y3=0.50;

    
char _tmp3[64];
    
char _buffer3[256];
            
    
    
int client GetClientOfUserId(GetEventInt(event"attacker"));
    if(
IsValidPlayer(client))
    {

            
Format(_tmp3sizeof(_tmp3), "YOU KILLED ENEMY !");
            
StrCat(_buffer3sizeof(_buffer3), _tmp3);
            
            
            
SetHudTextParams(x3y39999.0100025571);
            
ShowSyncHudText(clienthudtext,_tmp3);
    }
}


stock bool IsValidPlayer(client)
{
    if(
client >= && client <= MaxClients && IsClientConnected(client) && !IsFakeClient(client) && IsClientInGame(client) )
    return 
true;

    return 
false;


Last edited by sky162csgo; 12-10-2017 at 06:25.
sky162csgo is offline
Walgrim
AlliedModders Donor
Join Date: Dec 2015
Location: France
Old 12-10-2017 , 05:41   Re: CS:GO HUD player death PROBLEM !!!
Reply With Quote #2

PHP Code:
ShowSyncHudText(attackerhudtext,_tmp3); 
replace it by
PHP Code:
ShowSyncHudText(clienthudtext,_tmp3); 
__________________
Walgrim is offline
sky162csgo
Junior Member
Join Date: Dec 2017
Old 12-10-2017 , 06:28   Re: CS:GO HUD player death PROBLEM !!!
Reply With Quote #3

Quote:
Originally Posted by Walgrim View Post
PHP Code:
ShowSyncHudText(attackerhudtext,_tmp3); 
replace it by
PHP Code:
ShowSyncHudText(clienthudtext,_tmp3); 
Sorry i bad defined "Client".I edited my post.But problem it is same.
sky162csgo is offline
Walgrim
AlliedModders Donor
Join Date: Dec 2015
Location: France
Old 12-10-2017 , 07:03   Re: CS:GO HUD player death PROBLEM !!!
Reply With Quote #4

Try this:
PHP Code:
#include <sourcemod>

static Handle HudText null;

public 
void OnPluginStart() {
  
HudText CreateHudSynchronizer();
  
HookEvent("player_death"OnPlayerDeathEventHookMode_Pre);
}

public 
Action OnPlayerDeath(Handle hEvent, const char[] namebool dontBroadcast) {
  
char text[64];
  
int attacker GetClientOfUserId(GetEventInt(hEvent"attacker"));
  if (
IsValidClient(attacker)) {
    
Format(textsizeof(text), "You killed an ennemy!");
    
SetHudTextParams(1.00.59999.0100025571);
    
ShowSyncHudText(attackerHudTexttext);  
  }
}

stock bool IsValidClient(int client) {
    if (
client <= || client MaxClients || !IsClientInGame(client)) {
        return 
false;
    }
    return 
true;

(Not sure why you want to hold the text during 9999.0 seconds).
__________________
Walgrim is offline
sky162csgo
Junior Member
Join Date: Dec 2017
Old 12-10-2017 , 07:23   Re: CS:GO HUD player death PROBLEM !!!
Reply With Quote #5

Quote:
Originally Posted by Walgrim View Post
Try this:
PHP Code:
#include <sourcemod>

static Handle HudText null;

public 
void OnPluginStart() {
  
HudText CreateHudSynchronizer();
  
HookEvent("player_death"OnPlayerDeathEventHookMode_Pre);
}

public 
Action OnPlayerDeath(Handle hEvent, const char[] namebool dontBroadcast) {
  
char text[64];
  
int attacker GetClientOfUserId(GetEventInt(hEvent"attacker"));
  if (
IsValidClient(attacker)) {
    
Format(textsizeof(text), "You killed an ennemy!");
    
SetHudTextParams(1.00.59999.0100025571);
    
ShowSyncHudText(attackerHudTexttext);  
  }
}

stock bool IsValidClient(int client) {
    if (
client <= || client MaxClients || !IsClientInGame(client)) {
        return 
false;
    }
    return 
true;

(Not sure why you want to hold the text during 9999.0 seconds).



Problem it is same not working HUD but when i add into the code PrintToChat ... this option working ... but i need see HUD when i kill any player.


PHP Code:
#include <sourcemod>

static Handle HudText null;

public 
void OnPluginStart() {
  
HudText CreateHudSynchronizer();
  
HookEvent("player_death"OnPlayerDeathEventHookMode_Pre);
}

public 
Action OnPlayerDeath(Handle hEvent, const char[] namebool dontBroadcast) {
  
char text[64];
  
int attacker GetClientOfUserId(GetEventInt(hEvent"attacker"));
  if (
IsValidClient(attacker)) {
    
Format(textsizeof(text), "You killed an ennemy!");
    
SetHudTextParams(1.00.59999.0100025571);
    
ShowSyncHudText(attackerHudTexttext);  

// PRINT IN CHAT

    
PrintToChat(attacker,text);

// PRINT IN CHAT
  
}
}

stock bool IsValidClient(int client) {
    if (
client <= || client MaxClients || !IsClientInGame(client)) {
        return 
false;
    }
    return 
true;


Last edited by sky162csgo; 12-10-2017 at 07:24.
sky162csgo is offline
Walgrim
AlliedModders Donor
Join Date: Dec 2015
Location: France
Old 12-10-2017 , 07:33   Re: CS:GO HUD player death PROBLEM !!!
Reply With Quote #6

Works great for me, tell me if you see it in the middle, replace
PHP Code:
SetHudTextParams(1.00.59999.0100025571); 
by
PHP Code:
SetHudTextParams(-1.0, -1.09999.0100025571); 
__________________
Walgrim is offline
sky162csgo
Junior Member
Join Date: Dec 2017
Old 12-15-2017 , 18:33   Re: CS:GO HUD player death PROBLEM !!!
Reply With Quote #7

Quote:
Originally Posted by Walgrim View Post
Works great for me, tell me if you see it in the middle, replace
PHP Code:
SetHudTextParams(1.00.59999.0100025571); 
by
PHP Code:
SetHudTextParams(-1.0, -1.09999.0100025571); 
Thank's ! Problem fixed with my server
sky162csgo 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 13:41.


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