AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   lol (https://forums.alliedmods.net/showthread.php?t=164000)

BodyBuilder 08-06-2011 04:07

lol
 
lol

Exolent[jNr] 08-06-2011 04:10

Re: not showing weapon name !
 
That's wrong.

PHP Code:

register_event("StatusValue","ShowSPlayerName","be","2=2","2!0"

Where did you get that line?

Exolent[jNr] 08-06-2011 04:16

Re: not showing weapon name !
 
http://wiki.amxmodx.org/Half-Life_1_Game_Events
It says HL1 game events, not CS game events.
Even though there are specific events in there for CS.

BodyBuilder 08-06-2011 04:23

Re: not showing weapon name !
 
not showing !

Exolent[jNr] 08-06-2011 05:01

Re: not showing weapon name !
 
Quote:

Originally Posted by BodyBuilder (Post 1526805)
not showing !

I got that when you said it wasn't showing in your first post...
Is the event even hooking?
Did you try adding some testing messages to make sure functions and such are being called proeprly?

ConnorMcLeod 08-06-2011 05:01

Re: not showing weapon name !
 
Code:

enum sbar_data
{
        SBAR_ID_TARGETNAME = 1,
        SBAR_ID_TARGETHEALTH,
        SBAR_ID_TARGETARMOR,
        SBAR_END,
};

void CBasePlayer :: UpdateClientData( void )
{
    /* [ ... ] */


        // Update Status Bar
        if ( m_flNextSBarUpdateTime < gpGlobals->time )
        {
                UpdateStatusBar();
                m_flNextSBarUpdateTime = gpGlobals->time + 0.2;
        }
}

void CBasePlayer::UpdateStatusBar()
{
        int newSBarState[ SBAR_END ];
        char sbuf0[ SBAR_STRING_SIZE ];
        char sbuf1[ SBAR_STRING_SIZE ];

        memset( newSBarState, 0, sizeof(newSBarState) );
        strcpy( sbuf0, m_SbarString0 );
        strcpy( sbuf1, m_SbarString1 );

        // Find an ID Target
        TraceResult tr;
        UTIL_MakeVectors( pev->v_angle + pev->punchangle );
        Vector vecSrc = EyePosition();
        Vector vecEnd = vecSrc + (gpGlobals->v_forward * MAX_ID_RANGE);
        UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, edict(), &tr);

        if (tr.flFraction != 1.0)
        {
                if ( !FNullEnt( tr.pHit ) )
                {
                        CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );

                        if (pEntity->Classify() == CLASS_PLAYER )
                        {
                                newSBarState[ SBAR_ID_TARGETNAME ] = ENTINDEX( pEntity->edict() );
                                strcpy( sbuf1, "1 %p1\n2 Health: %i2%%\n3 Armor: %i3%%" );

                                // allies and medics get to see the targets health
                                if ( g_pGameRules->PlayerRelationship( this, pEntity ) == GR_TEAMMATE )
                                {
                                        newSBarState[ SBAR_ID_TARGETHEALTH ] = 100 * (pEntity->pev->health / pEntity->pev->max_health);
                                        newSBarState[ SBAR_ID_TARGETARMOR ] = pEntity->pev->armorvalue; //No need to get it % based since 100 it's the max.
                                }

                                m_flStatusBarDisappearDelay = gpGlobals->time + 1.0;
                        }
                }
                else if ( m_flStatusBarDisappearDelay > gpGlobals->time )
                {
                        // hold the values for a short amount of time after viewing the object
                        newSBarState[ SBAR_ID_TARGETNAME ] = m_izSBarState[ SBAR_ID_TARGETNAME ];
                        newSBarState[ SBAR_ID_TARGETHEALTH ] = m_izSBarState[ SBAR_ID_TARGETHEALTH ];
                        newSBarState[ SBAR_ID_TARGETARMOR ] = m_izSBarState[ SBAR_ID_TARGETARMOR ];
                }
        }

        BOOL bForceResend = FALSE;

        if ( strcmp( sbuf0, m_SbarString0 ) )
        {
                MESSAGE_BEGIN( MSG_ONE, gmsgStatusText, NULL, pev );
                        WRITE_BYTE( 0 );
                        WRITE_STRING( sbuf0 );
                MESSAGE_END();

                strcpy( m_SbarString0, sbuf0 );

                // make sure everything's resent
                bForceResend = TRUE;
        }

        if ( strcmp( sbuf1, m_SbarString1 ) )
        {
                MESSAGE_BEGIN( MSG_ONE, gmsgStatusText, NULL, pev );
                        WRITE_BYTE( 1 );
                        WRITE_STRING( sbuf1 );
                MESSAGE_END();

                strcpy( m_SbarString1, sbuf1 );

                // make sure everything's resent
                bForceResend = TRUE;
        }

        // Check values and send if they don't match
        for (int i = 1; i < SBAR_END; i++)
        {
                if ( newSBarState[i] != m_izSBarState[i] || bForceResend )
                {
                        MESSAGE_BEGIN( MSG_ONE, gmsgStatusValue, NULL, pev );
                                WRITE_BYTE( i );
                                WRITE_SHORT( newSBarState[i] );
                        MESSAGE_END();

                        m_izSBarState[i] = newSBarState[i];
                }
        }
}


Code:
register_event("StatusValue","ShowSPlayerName","be","2=2","2!0")

->

Code:
register_event("StatusValue", "ShowSPlayerName", "be", "1=1")

2reason2kill 08-06-2011 06:31

Re: not showing weapon name !
 
Quote:

Originally Posted by BodyBuilder (Post 1526852)
how update showing if end ?
PHP Code:

#include amxmodx
#include geoip

new 
Show_Cvars[5],
HudMessage[1024]

public 
plugin_init() 
{
    
register_event("StatusValue","ShowSPlayerName","be","1=1")
    
Show_Cvars[0] = register_cvar("hldm_show_name","1")
    
Show_Cvars[1] = register_cvar("hldm_show_ip","0")
    
Show_Cvars[2] = register_cvar("hldm_show_health","1")
    
Show_Cvars[3] = register_cvar("hldm_show_armor","1")
}

public 
ShowSPlayerName(id
{
    if(!
is_user_bot(id) && is_user_connected(id)) 
{
    static 
name[32], ip[32], WeaponName[32], SHOWvictim

    victim 
read_data(2)

    
get_user_name(victim,name,31)

    
get_user_ip(victim,ip,31,1)

    if(
get_pcvar_num(Show_Cvars[0]))
    
SHOW += format(HudMessage[SHOW],sizeof HudMessage SHOW,"%s^n^n",name)
        
    if(
get_pcvar_num(Show_Cvars[1]))
    
SHOW += format(HudMessage[SHOW],sizeof HudMessage SHOW,"IP: %s",ip)
        
    if(
get_pcvar_num(Show_Cvars[2]))
    
SHOW += format(HudMessage[SHOW],sizeof HudMessage SHOW,"^nHealth: %d",get_user_health(victim))
        
    if(
get_pcvar_num(Show_Cvars[3]))
    
SHOW += format(HudMessage[SHOW],sizeof HudMessage SHOW,"^n%Armor: %d",get_user_armor(victim))

    
set_hudmessage(255,255,0,-1.0,0.60,1,0.01,2.0,0.01,0.01,4
    
ShowSyncHudMsg(id,CreateHudSyncObj(),"%s",HudMessage)

    
SHOW 0

    HudMessage
[0] = 0
}
    return 
PLUGIN_HANDLED 



Its as far iknow
PHP Code:

#include <amxmodx>
#include <geoip> 


abdul-rehman 08-06-2011 06:35

Re: not showing weapon name !
 
Quote:

Originally Posted by BodyBuilder (Post 1526852)
how update showing if end ?
PHP Code:

#include amxmodx
#include geoip

new 
Show_Cvars[5],
HudMessage[1024]

public 
plugin_init() 
{
    
register_event("StatusValue","ShowSPlayerName","be","1=1")
    
Show_Cvars[0] = register_cvar("hldm_show_name","1")
    
Show_Cvars[1] = register_cvar("hldm_show_ip","0")
    
Show_Cvars[2] = register_cvar("hldm_show_health","1")
    
Show_Cvars[3] = register_cvar("hldm_show_armor","1")
}

public 
ShowSPlayerName(id
{
    if(!
is_user_bot(id) && is_user_connected(id)) 
{
    static 
name[32], ip[32], WeaponName[32], SHOWvictim

    victim 
read_data(2)

    
get_user_name(victim,name,31)

    
get_user_ip(victim,ip,31,1)

    if(
get_pcvar_num(Show_Cvars[0]))
    
SHOW += format(HudMessage[SHOW],sizeof HudMessage SHOW,"%s^n^n",name)
        
    if(
get_pcvar_num(Show_Cvars[1]))
    
SHOW += format(HudMessage[SHOW],sizeof HudMessage SHOW,"IP: %s",ip)
        
    if(
get_pcvar_num(Show_Cvars[2]))
    
SHOW += format(HudMessage[SHOW],sizeof HudMessage SHOW,"^nHealth: %d",get_user_health(victim))
        
    if(
get_pcvar_num(Show_Cvars[3]))
    
SHOW += format(HudMessage[SHOW],sizeof HudMessage SHOW,"^n%Armor: %d",get_user_armor(victim))

    
set_hudmessage(255,255,0,-1.0,0.60,1,0.01,2.0,0.01,0.01,4
    
ShowSyncHudMsg(id,CreateHudSyncObj(),"%s",HudMessage)

    
SHOW 0

    HudMessage
[0] = 0
}
    return 
PLUGIN_HANDLED 



Re-state what you mean, BTW Why isnt your code indented ?!, Which Software are u using for making plugins !!

BodyBuilder 08-06-2011 06:51

Re: not showing weapon name !
 
LOL !

I ask you how update showing if end ?

abdul-rehman 08-06-2011 07:05

Re: not showing weapon name !
 
Quote:

Originally Posted by BodyBuilder (Post 1526877)

how update showing if end ?

Improve your english, i cant understand a thing.!


All times are GMT -4. The time now is 03:25.

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