Raised This Month: $ Target: $400
 0% 

HUD Message error !?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yuku
Junior Member
Join Date: May 2010
Old 05-07-2010 , 04:29   HUD Message error !?
Reply With Quote #1

Hey,
I'm new here and have beginn scripting since 1 Months...
So I wanted to chance the code of "And the winner is..." amxmodx plugin that the message come in the center of the screen and not in the chat...
But when I want to compile 5 Errors came.

Perhaps someone can help me...

Here is the code:

Code:
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >

#define TAG "^x04[AMXX]^x01"
#define FCVARS (FCVAR_SERVER | FCVAR_PROTECTED)

static const dates[ ][ ] =
{
    "And the Winner with Most Headshot Is...",
    "1.8",
    "Luqqas' Aka lucas_7_94"
}

new const name_cvar[ ][ ] = { 
    "amx_headshots_logs", 
    "amx_headshots_saymode"
}

new const value_cvar[ ][ ] = { 
    "1", 
    "0" 
}

/* Enums */
enum 
{
    CVAR_LOGS = 0,
    CVAR_SAYMODE,
}

enum
{
    PLUGIN_NAME,
    PLUGIN_VERSION,
    PLUGIN_AUTHOR
}
/* Enums End*/

new cvars[2]

new g_mostheadshots[33]

public plugin_init() {
    register_plugin( dates[PLUGIN_NAME], dates[PLUGIN_VERSION], dates[PLUGIN_AUTHOR])
    
    register_event( "DeathMsg" , "Event_DeathMsg" , "a" , "3=1" );
    
    register_event( "30" , "event_intermission" , "a" );
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
    
    cvars[0] = register_cvar( name_cvar[CVAR_LOGS] , value_cvar[CVAR_LOGS] );
    cvars[1] = register_cvar( name_cvar[CVAR_SAYMODE], value_cvar[CVAR_SAYMODE]);

    
    register_cvar( "Best Player Headshot | SQL" , dates[PLUGIN_AUTHOR] , FCVARS );
    
    register_event( "TextMsg", "Event_GameRestart", "a", "2=#Game_will_restart_in");
    
    register_event( "TextMsg", "Event_GameRestart", "a", "2=#Game_Commencing" );
    
    gmsgHudSync = CreateHudSyncObj()
    
}

public Event_GameRestart( ) arrayset( g_mostheadshots, 0, 33 )
public client_disconnect( id ) g_mostheadshots[ id ] = 0
public event_intermission( ) set_task( 0.1, "BestHeadPlayer")

public event_round_start( )
{
    if( get_pcvar_num( cvars[1] ) )
        set_task(0.1, "BestHeadPlayer");
}
public BestHeadPlayer( ) 
{    
    new iPlayers[ 32 ], iNum
    get_players( iPlayers, iNum )
    
    if( !iNum )
    {
        return;
    }
    
    new iBestPlayerHeadshot = iPlayers[ 0 ]
    
    for(new i = 1, id; i < iNum; i++) 
    { 
        id = iPlayers[ i ] 
        
        if(g_mostheadshots[ id ] > g_mostheadshots[ iBestPlayerHeadshot ]) 
        { 
            iBestPlayerHeadshot = id 
        } 
    }
    
    new szName[ 32 ] 
    get_user_name( iBestPlayerHeadshot , szName , charsmax(szName) ) 
    if(g_mostheadshots[ iBestPlayerHeadshot ] > 0)
        set_hudmessage(200, 100, 0, -1.0, 10, 0, 3.0, 3.0, 0.15, 0.15, 10)
        ShowSyncHudMsg( 0, gmsgHudSync, "%s And The Winner is %s with %d Headshot%s" , TAG , szName , g_mostheadshots[ iBestPlayerHeadshot ] , g_mostheadshots[ iBestPlayerHeadshot ] > 1 ? "s." : "." )
    else
        Color( 0, "%s Nobody was winning on this map!", TAG )
    
    if( !cvars[1] && cvars[0] && g_mostheadshots[ iBestPlayerHeadshot ] > 0) {
        static mapname[ 32 ]
        get_mapname(mapname, sizeof mapname - 1)
        
        static Steam[ 32 ]
        get_user_authid( iBestPlayerHeadshot, Steam, charsmax(Steam))
        
        log_to_file( "best_headshot.log" , "Map %s | Best Player: %s | Headshots: %d | STEAM ID: %s" , mapname , szName , g_mostheadshots[ iBestPlayerHeadshot ], Steam)
    }
    return
}

public Event_DeathMsg( ) 
{
    new iAttack = read_data( 1 )
    
    if ( read_data( 2 ) != iAttack  )
        g_mostheadshots[ iAttack ]++
    
    return PLUGIN_HANDLED
}

stock Color( const id , const input[ ] , any:... )
{
    new count = 1, players[ 32 ]
    static msg[ 191 ]
    vformat( msg , 190 , input , 3 )
    
    replace_all( msg , 190 , "^x04" , "^4") // Green Color
    replace_all( msg, 190 , "^x01" , "^1") // Default Color
    replace_all( msg, 190 , "!team" , "^3") // Team Color
    replace_all( msg, 190 , "!team2" , "^0") // Team2 Color
    
    if ( id ) players[ 0 ] = id; else get_players( players , count , "ch" )
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected( players[ i ] ))
            {
                message_begin( MSG_ONE_UNRELIABLE , get_user_msgid("SayText") , _ , players[ i ] )
                write_byte( players[ i ] );
                write_string( msg );
                message_end( );
            }
        }
    }
}
All red code are new!
yuku is offline
Old 05-07-2010, 05:10
epic .
This message has been deleted by epic .. Reason: ...
yuku
Junior Member
Join Date: May 2010
Old 05-07-2010 , 05:30   Re: HUD Message error !?
Reply With Quote #3

Now there are only 3 errors:

warning: 213: tag mismatch

error 035: argument type mismacht (argument 2)

error 029: invalid expressionm, assumed zero

and for all errors are number:

99, 100, 101

Last edited by yuku; 05-07-2010 at 05:33.
yuku is offline
epic .
Senior Member
Join Date: Oct 2009
Location: China
Old 05-07-2010 , 05:42   Re: HUD Message error !?
Reply With Quote #4

Code:
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#define TAG "^x04[AMXX]^x01"
#define FCVARS (FCVAR_SERVER | FCVAR_PROTECTED)
static const dates[ ][ ] =
{
    "And the Winner with Most Headshot Is...",
    "1.8",
    "Luqqas' Aka lucas_7_94"
}
new const name_cvar[ ][ ] = { 
    "amx_headshots_logs", 
    "amx_headshots_saymode"
}
new const value_cvar[ ][ ] = { 
    "1", 
    "0" 
}
/* Enums */
enum 
{
    CVAR_LOGS = 0,
    CVAR_SAYMODE,
}
enum
{
    PLUGIN_NAME,
    PLUGIN_VERSION,
    PLUGIN_AUTHOR
}
/* Enums End*/
new cvars[2]
new g_mostheadshots[33]
public plugin_init() {
    register_plugin( dates[PLUGIN_NAME], dates[PLUGIN_VERSION], dates[PLUGIN_AUTHOR])
    
    register_event( "DeathMsg" , "Event_DeathMsg" , "a" , "3=1" );
    
    register_event( "30" , "event_intermission" , "a" );
    
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
    
    cvars[0] = register_cvar( name_cvar[CVAR_LOGS] , value_cvar[CVAR_LOGS] );
    cvars[1] = register_cvar( name_cvar[CVAR_SAYMODE], value_cvar[CVAR_SAYMODE]);
    
    register_cvar( "Best Player Headshot | SQL" , dates[PLUGIN_AUTHOR] , FCVARS );
    
    register_event( "TextMsg", "Event_GameRestart", "a", "2=#Game_will_restart_in");
    
    register_event( "TextMsg", "Event_GameRestart", "a", "2=#Game_Commencing" );
    
}
public Event_GameRestart( ) arrayset( g_mostheadshots, 0, 33 )
public client_disconnect( id ) g_mostheadshots[ id ] = 0
public event_intermission( ) set_task( 0.1, "BestHeadPlayer")
public event_round_start( )
{
    if( get_pcvar_num( cvars[1] ) )
        set_task(0.1, "BestHeadPlayer");
}
public BestHeadPlayer( ) 
{    
    new iPlayers[ 32 ], iNum
    get_players( iPlayers, iNum )
    
    if( !iNum )
    {
        return;
    }
    
    new iBestPlayerHeadshot = iPlayers[ 0 ]
    
    for(new i = 1, id; i < iNum; i++) 
    { 
        id = iPlayers[ i ] 
        
        if(g_mostheadshots[ id ] > g_mostheadshots[ iBestPlayerHeadshot ]) 
        { 
            iBestPlayerHeadshot = id 
        } 
    }
    
    new szName[ 32 ] 
    get_user_name( iBestPlayerHeadshot , szName , charsmax(szName) ) 
    if(g_mostheadshots[ iBestPlayerHeadshot ] > 0)
    {
        set_hudmessage(178, 14, 41, -1.0, 0.4, 1, 0.5, 6.7, 0.2, 0.2, 4);
        show_hudmessage( 0, "%s And The Winner is %s with %d Headshot%s" , TAG , szName , g_mostheadshots[ iBestPlayerHeadshot ] , (g_mostheadshots[ iBestPlayerHeadshot ] > 1 ? "s." : ".") )
    }
    else
        Color( 0, "%s Nobody was winning on this map!", TAG )
    
    if( !cvars[1] && cvars[0] && g_mostheadshots[ iBestPlayerHeadshot ] > 0) {
        static mapname[ 32 ]
        get_mapname(mapname, sizeof mapname - 1)
        
        static Steam[ 32 ]
        get_user_authid( iBestPlayerHeadshot, Steam, charsmax(Steam))
        
        log_to_file( "best_headshot.log" , "Map %s | Best Player: %s | Headshots: %d | STEAM ID: %s" , mapname , szName , g_mostheadshots[ iBestPlayerHeadshot ], Steam)
    }
    return
}
public Event_DeathMsg( ) 
{
    new iAttack = read_data( 1 )
    
    if ( read_data( 2 ) != iAttack  )
        g_mostheadshots[ iAttack ]++
    
    return PLUGIN_HANDLED
}
stock Color( const id , const input[ ] , any:... )
{
    new count = 1, players[ 32 ]
    static msg[ 191 ]
    vformat( msg , 190 , input , 3 )
    
    replace_all( msg , 190 , "^x04" , "^4") // Green Color
    replace_all( msg, 190 , "^x01" , "^1") // Default Color
    replace_all( msg, 190 , "!team" , "^3") // Team Color
    replace_all( msg, 190 , "!team2" , "^0") // Team2 Color
    
    if ( id ) players[ 0 ] = id; else get_players( players , count , "ch" )
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected( players[ i ] ))
            {
                message_begin( MSG_ONE_UNRELIABLE , get_user_msgid("SayText") , _ , players[ i ] )
                write_byte( players[ i ] );
                write_string( msg );
                message_end( );
            }
        }
    }
}
This time is OK. sorry for my careless
__________________
Quote:
Destinies in my AWP sight are all alike;
Destinies out of my AWP sight in its own way.
epic . is offline
Send a message via ICQ to epic .
yuku
Junior Member
Join Date: May 2010
Old 05-07-2010 , 05:47   Re: HUD Message error !?
Reply With Quote #5

Oh thanks now it works!
yuku is offline
yuku
Junior Member
Join Date: May 2010
Old 05-07-2010 , 05:53   Re: HUD Message error !?
Reply With Quote #6

I have another question... how can I chance the color of the message?
yuku is offline
epic .
Senior Member
Join Date: Oct 2009
Location: China
Old 05-07-2010 , 06:00   Re: HUD Message error !?
Reply With Quote #7

Change this
178, 14, 41
to other number
__________________
Quote:
Destinies in my AWP sight are all alike;
Destinies out of my AWP sight in its own way.
epic . is offline
Send a message via ICQ to epic .
yuku
Junior Member
Join Date: May 2010
Old 05-07-2010 , 06:01   Re: HUD Message error !?
Reply With Quote #8

okey thanks
yuku is offline
yuku
Junior Member
Join Date: May 2010
Old 05-07-2010 , 06:16   Re: HUD Message error !?
Reply With Quote #9

ähhmm.... problem:

If someone give an headshot it wont display it in the next round.

Every round it come Nobody was winning n this map!

And when i compile the code two warnings come:

on line 93: loose indentation

on line 95: loose indentation


Please help

Last edited by yuku; 05-07-2010 at 06:43.
yuku is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-07-2010 , 07:04   Re: HUD Message error !?
Reply With Quote #10

Code:
 replace_all( msg, 190 , "!team2" , "^0") // Team2 Color
please delete this line !
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
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 03:37.


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