AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   StatusValue player is not looks at players. (https://forums.alliedmods.net/showthread.php?t=206455)

fl0werD 01-22-2013 14:09

StatusValue player is not looks at players.
 
As one hook call StatusValue, when the player is not looks at the players?

Test plugin:
PHP Code:

#include <amxmodx>

public plugin_init() register_event("StatusValue""EventStatsValue""be")

public 
EventStatsValue(iPlayerclient_print(iPlayerprint_chat"Data1: %d, Data 2: %d"read_data(1), read_data(2)) 

Result:
HTML Code:

Friend:

Data1: 1, Data 2: 1
Data1: 2, Data 2: 4
Data1: 3, Data 2: 100

Data1: 1, Data 2: 0
Data1: 2, Data 2: 0
Data1: 3, Data 2: 0



Enemy:

Data1: 1, Data 2: 2
Data1: 2, Data 2: 2

Data1: 1, Data 2: 0
Data1: 2, Data 2: 0


Emp` 01-22-2013 14:18

Re: StatusValue player is not looks at players.
 
When the first data (read_data(1) == 1) is sent with the value of 0 (read_data(2) == 0), then the player is not looking at a player/hostage.

Code:

register_event( "StatusValue", "EventHideStatus", "be", "1=1", "2=0" );

fl0werD 01-22-2013 14:24

Re: StatusValue player is not looks at players.
 
Quote:

Originally Posted by Emp` (Post 1878159)
When the first data (read_data(1) == 1) is sent with the value of 0 (read_data(2) == 0), then the player is not looking at a player/hostage.

Code:

register_event( "StatusValue", "EventHideStatus", "be", "1=1", "2=0" );

Yes, but call StatusValue every seconds.

PHP Code:

public EventStatsValue(iPlayer)
{
    if(
read_data(1) != || read_data(2) != 0)
        return;

    new 
szText[128];
    static 
a;

    
formatex(szTextcharsmax(szText), "Test: %d"a++)

    
message_begin(MSG_ONE_UNRELIABLEg_msgStatusText_iPlayer)
    
write_byte(0)
    
write_string(szText)
    
message_end()



Emp` 01-22-2013 16:36

Re: StatusValue player is not looks at players.
 
The StatusValue message is sent after a Traceline that happens for the client (I assume every "think").

Explain what you are trying to achieve and it will be much easier to help you with your problem.

ConnorMcLeod 01-23-2013 01:11

Re: StatusValue player is not looks at players.
 
Quote:

Originally Posted by Emp` (Post 1878275)
The StatusValue message is sent after a Traceline that happens for the client (I assume every "think").

In CBasePlayer::UpdateClientData, pdata m_flNextSBarUpdateTime is checked, if time is passed, CBasePlayer::UpdateStatusBar is called and m_flNextSBarUpdateTime is set to gametime + 0.2.
( m_flNextSBarUpdateTime is 449 on windows, +5 on linux ).

hlsdk UpdateStatusBar code for reference :
Spoiler


cs UpdateStatusBar code from ida (gonna hurt eyes !!), quite similar with HL one.
Spoiler



CS Pdatas are :
Code:

enum sbar_data
{
        SBAR_ID_TARGETCLASS = 1,
        SBAR_ID_TARGEINDEX,
        SBAR_ID_TARGETHEALTH,
        SBAR_END,
};
stock const m_izSBarState[SBAR_END] = {446,447,448}
stock const m_flNextSBarUpdateTime = 449;
stock const m_flStatusBarDisappearDelay = 450;
stock const m_SbarString0 = 1804; // 451*4  //    [SBAR_STRING_SIZE]    //    128 char // 32


fl0werD 01-23-2013 04:55

Re: StatusValue player is not looks at players.
 
Quote:

Originally Posted by Emp` (Post 1878275)
The StatusValue message is sent after a Traceline that happens for the client (I assume every "think").

Explain what you are trying to achieve and it will be much easier to help you with your problem.

Need show the player stats, if not looks at the players. For example frags.

ConnorMcLeod 01-23-2013 12:28

Re: StatusValue player is not looks at players.
 
Try something like this :

PHP Code:

#include <amxmodx>
#include <cstrike>

#define PLUGIN "StatusValue Stats"
#define VERSION "0.0.1"

new gmsgStatusText

new bool:g_bStatusTextFree[33]

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )
    
gmsgStatusText get_user_msgid("StatusText")

    
register_event("StatusValue""Event_StatusValue_Used""b""1!0")
    
register_event("StatusValue""Event_StatusValue_NotUsed""b""1=0")
    
register_event("ScoreInfo""Event_ScoreInfo""a")
}

public 
Event_ScoreInfo()
{
    new 
id read_data(1)
    if( 
g_bStatusTextFree[id] )
    {
        
UpdateStatusText(id)
    }
}

public 
Event_StatusValue_Usedid )
{
    
g_bStatusTextFree[id] = false
}

public 
Event_StatusValue_NotUsedid )
{
    
g_bStatusTextFree[id] = true
    UpdateStatusText
(id)
}

UpdateStatusText(id)
{
    new 
szMessage[128]
    
formatex(szMessagecharsmax(szMessage), "Frags %d | Deaths %d"get_user_frags(id), cs_get_user_deaths(id))

    
message_begin(MSG_ONEgmsgStatusText_id)
    
write_byte(0)
    
write_string(szMessage)
    
message_end()



fl0werD 01-23-2013 13:12

Re: StatusValue player is not looks at players.
 
Does not work.

AngeIII 01-23-2013 13:22

Re: StatusValue player is not looks at players.
 
what exactly? error logs? ..more info

fl0werD 01-23-2013 14:10

Re: StatusValue player is not looks at players.
 
Quote:

Originally Posted by AngeIII (Post 1878763)
what exactly? error logs? ..more info

Plugin.:)


All times are GMT -4. The time now is 20:31.

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