AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   [DM] Frags, HS, Rank (https://forums.alliedmods.net/showthread.php?t=259966)

Malli Bojan 03-16-2015 17:43

[DM] Frags, HS, Rank
 
1 Attachment(s)
[DM] Frags, HS, Rank

v1.1
by Malli Bojan

http://i.imgur.com/T7V4sft.png

DeathMatch plugin that shows:

FRAGS
HEADSHOTS
RANK


Code:

v1.1 - Score Hud
In the middle of the screen shows SCORE

[CT] Team || || [T] Team

http://i.pics.rs/84WHq

[CVARS]

*** COLOR ***

hud_red 0 // By defaultu 0
hud_green 255 // By defaultu 255
hud_blue 0 // By defaultu 0

*** POSITION ***

hud_x 0.02 // By defaultu 0.02
hud_y -1.0 // By defaultu -1.0

PHP Code:

#include                    <   amxmodx   > 
#include                    <   csstats   > 
#include                    < dhudmessage > 

#define IME              "[DM] Frags, HS, Rank" 
#define VERZIJA                  "1.1" 
#define AUTOR              "Malli Bojan" 

new                                g_MsgSync
new                            
g_iMsgScreenFade
new                           
FRAGS[33], HS[33]; 
new                        
CT_SCORETERRORIST_SCORE;  
new              
cvar_redcvar_greencvar_bluecvar_xcvar_y

public 
plugin_init( )
{
    
register_plugin         IMEVERZIJAAUTOR );
    
    
register_event      "DeathMsg""fw_PlayerDeath""a" );
    
register_event      "TeamScore""skor""a" ); 
    
register_event      "DeathMsg""EventDeath""a""1>0""3=1" );
    
    
g_MsgSync =                CreateHudSyncObj ( );
    
    
g_iMsgScreenFade =       get_user_msgid"ScreenFade" );
    
    
cvar_red =          register_cvar "hud_red""0" );
    
cvar_green =           register_cvar "hud_green""255" );
    
cvar_blue =            register_cvar "hud_blue""255" );
    
cvar_x =          register_cvar "hud_x""0.02" );
    
cvar_y =          register_cvar "hud_y""-1.0" );    
}

public 
client_connect id )
{
    
FRAGS[id] = 0;
    
HS[id] = 0;
    
    
set_task 1.0"fw_ShowHud"id__"b" );
}

public 
skor() 

    new 
team[32]; 
    
read_data(1,team,31); 
    if (
equal(team,"CT")) 
    { 
        
CT_SCORE read_data(2); 
    } 
    else if (
equal(team,"TERRORIST")) 
    { 
        
TERRORIST_SCORE read_data(2); 
    } 


public 
fw_PlayerDeath ()
{
    new 
killer read_data(1);
    new 
victim read_data(2);
    new 
headshot read_data(3);
    
    if ( 
killer == victim || get_user_team killer ) == get_user_team victim ) )
        return 
PLUGIN_HANDLED;
    
    if ( 
headshot 
    { 
    
HS[killer]++

    
FRAGS[killer]++
    
    
FRAGS[victim] = 0;
    
HS[victim] = 0;
    
    return 
PLUGIN_HANDLED;
}

public 
fw_ShowHud id )
{
    new 
stats[8], bodyhits[8];
    new 
RANK get_user_stats idstatsbodyhits );
    
    
set_hudmessage get_pcvar_num cvar_red ), get_pcvar_num cvar_green ), get_pcvar_num cvar_blue ), get_pcvar_float cvar_x ), get_pcvar_float cvar_y ) );
    
ShowSyncHudMsg(idg_MsgSync"%i KILL ( %i HS )^nRank: %i/%i"FRAGS[id], HS[id], RANKget_statsnum ( ) );
    
    
set_dhudmessage(070200, -1.00.0300.52.00.082.0true)
    
show_dhudmessage 0,"[CT] Team %d     |  |"CT_SCORE ); 
     
    
set_dhudmessage(20000, -1.00.0300.52.00.082.0true)
    
show_dhudmessage 0,"                                          |  |     %d [T] Team"TERRORIST_SCORE ); 
}  

public 
EventDeath( )
{
    
message_beginMSG_ONE_UNRELIABLEg_iMsgScreenFade_read_data) );
    
write_short<< 10 );
    
write_short<< 10 );
    
write_short0x0000 );
    
write_byte);
    
write_byte);
    
write_byte255 );
    
write_byte255 );
    
message_end( );


VERSION / BUGS

Code:

v1.1
* - Inserted SCORE SCREEN HUD and FADE
-------------------------------------------------- -----
Changed the hud way.
Inserted DHUD MESSAGE to Score Hud


joshknifer 03-17-2015 13:00

Re: [DM] Frags, HS, Rank
 
Too many similar plugins have been made like this already.

HamletEagle 03-17-2015 13:32

Re: [DM] Frags, HS, Rank
 
Quote:

Originally Posted by joshknifer (Post 2274895)
Too many similar plugins have been made like this already.

+

1. Your coding style is horrible, too many spaces.
2. new FRAGS[32], HS[32]; it should be 33.
3.

PHP Code:

  if ( headshot )
    {
        
HS[killer]++;
        
FRAGS[killer]++;
    }
    else
    {
        
FRAGS[killer]++;
    } 

You can short it to:
PHP Code:

  if ( headshot )
    {
        
HS[killer]++;
}
FRAGS[killer]++; 

4. In fw_ShowHud vars should be static.

Arkshine 03-17-2015 14:25

Re: [DM] Frags, HS, Rank
 
Very redundant, too simple, and it looks like you are beginner. Please don't release this kind of plugin. Take your time to learn and to release quality plugins.

Unapproved.

Malli Bojan 03-17-2015 16:17

Re: [DM] Frags, HS, Rank
 
PLUGIN Update to version 1.1

Code:

v1.1
 - Inserted SCORE HUD and SCREEN FADE
---------------------------------------------
Changed the hud way.
Inserted DHUD MESSAGE to Score Hud.



All times are GMT -4. The time now is 10:56.

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