Raised This Month: $ Target: $400
 0% 

Motd windows


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
187Ghost187
Junior Member
Join Date: May 2009
Old 06-06-2009 , 05:33   Motd windows
Reply With Quote #1

I have recently just started learning to code and thanks to the xp mod TUT's and alittle help from EMP I have got my first project, a custom rank. Working, but atm it's using ShowHud to display the stats, I'm looking to change that to a MOTD window. I've looked at a couple different codes, get the general idea but I'm unsure of how to do what I am wanting. I want to (in short) use the standard /rank options (acc, eff, kill's, deaths) without it showing the ranking "1/150, 25/150, etc." and use my custom rank positions for that.

Quote:
EXAMPLE
Ranking: n00b
XP:0/0
Kills:0
Deaths:0
ACC:
EFF:
etc.
so could anyone show me how I'd bring the 2 together or make a quick TUT for MOTD style windows, Thanks in advanced.
__________________
187Ghost187 is offline
31m0_owns
Member
Join Date: May 2008
Location: SLH, New Jersey-- U.S.A
Old 06-06-2009 , 11:51   Re: Motd windows
Reply With Quote #2

Hi Ghost here is a plugin from EKS

http://forums.alliedmods.net/showthread.php?p=2883
__________________
Project(s):
Prop-Hunt: 5%
Killcam: NEVER GOING TO HAPPEN!!!
31m0_owns is offline
187Ghost187
Junior Member
Join Date: May 2009
Old 06-06-2009 , 12:45   Re: Motd windows
Reply With Quote #3

No, no. I'm making an motd window INSIDE of my plugin, here I've done it now, it's functioning but not complete and I've used the code from Alka's new_style_rank to get it together

PHP Code:
public cmdShowRank(id)
{    
    static 
stats[8], stats2[4]
    
    
get_user_stats2(idstats2);
    
    static 
host_name[32];
    
get_cvar_string("hostname"host_name31);
    
    static 
motd[1501], len;
    
    
len format(motd1500,"<body bgcolor=#000000><font color=#87cefa><pre>");
    
//len += format(motd[len], 1500-len,"<center><img src=^"http://YourURLHere.com^"></center></img>");
    
len += format(motd[len], 1500-len,"<center><h4><font color=^"blue^"> Your statistics in '%s' </font></h4></center>"host_name);
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Rank :</B> <font color=^"white^">%s </color></left>^n"RankNames[PlayerLevel[id]-2]);
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Kills :</B> <font color=^"white^"> %d</color></left>^n"stats[0]);
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Deaths :</B> <font color=^"white^"> %d</color></left>^n"stats[1]);
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Head Shots :</B> <font color=^"white^"> %d</color></left>^n"stats[2]);
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Damage :</B> <font color=^"white^"> %d</color></left>^n"stats[6]);
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Shots :</B> <font color=^"white^"> %d</color></left>^n"stats[4]);
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Hits ;</B> <font color=^"white^"> %d</color></left>^n"stats[5]);
    
len += format(motd[len], 1500-len,"<left><font color=^"blue^">----------------------------------</color></left>^n");
    
len += format(motd[len], 1500-len,"<left><font color=^"red^">Eff : <font color=^"white^"> %3.0f%%</color></left>^n"effec(stats));
    
len += format(motd[len], 1500-len,"<left><font color=^"red^">Acc : <font color=^"white^"> %3.0f%%</color></left>^n"accuracy(stats));
    
len += format(motd[len], 1500-len,"<left><font color=^"blue^">----------------------------------</color></left>^n^n");
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Defused Bombs :</B> <font color=^"white^">%d </color></left>^n"stats2[1]);
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Planted Bombs :</B> <font color=^"white^">%d </color></left>^n"stats2[2]);
    
len += format(motd[len], 1500-len,"<left><font color=^"red^"><B>Exploded Bombs :</B> <font color=^"white^">%d </color></left>^n^n"stats2[3]);
    
    
show_motd(idmotd"Your Rank");
    
    return 
0;
}

stock Float:accuracy(stats[8])
{
    if(!
stats[4])
        return ( 
0.0 );
    new 
Float:result
    result 
100.0 floatstats[5] ) / floatstats[4] );
    return (
result 100.0) ? 100.0 result
}
stock Float:effec(stats[8])
{
    if(!
stats[0])
        return ( 
0.0 );
    new 
Float:result
    result 
100.0 floatstats[0] ) / floatstats[0] + stats[1] );
    return (
result 100.0) ? 100.0 result

It shows my ranking fine, but it shows all others as 0, I've removed the lines
Quote:
new rank_pos = get_user_stats(id, stats, body);
new max_rank = get_statsnum();
because I don't want to show those ranks. I know I need the get_user_stats but I'm not sure how I add it back from this point.
__________________

Last edited by 187Ghost187; 06-06-2009 at 17:04. Reason: Indentation
187Ghost187 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-06-2009 , 16:02   Re: Motd windows
Reply With Quote #4

We would greatly appreciate if you use [php] tags around your plugin code when posting instead of using [quote]. .
__________________
fysiks is offline
187Ghost187
Junior Member
Join Date: May 2009
Old 06-06-2009 , 17:03   Re: Motd windows
Reply With Quote #5

Fixed, my apoligizes
__________________
187Ghost187 is offline
-Acid-
Senior Member
Join Date: Feb 2009
Old 06-07-2009 , 02:26   Re: Motd windows
Reply With Quote #6

Idk am just guessing.
PHP Code:
static Player_Name[32];
        
get_user_name(KillerPlayer_Name,31)
        
set_task1.0"Rank Motd"0,Player_Name,31get_user_stats2(idstats2); 
__________________
-Acid- is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-07-2009 , 02:43   Re: Motd windows
Reply With Quote #7

Quote:
Originally Posted by -Acid- View Post
Idk am just guessing.
PHP Code:
static Player_Name[32];
        
get_user_name(KillerPlayer_Name,31)
        
set_task1.0"Rank Motd"0,Player_Name,31get_user_stats2(idstats2); 
wow, that's just . . . wow lol . No.
__________________
fysiks is offline
187Ghost187
Junior Member
Join Date: May 2009
Old 06-07-2009 , 06:48   Re: Motd windows
Reply With Quote #8

That's definately not right, I already have PlayerName[32] in the code earlier on, and get_user_stats2 works fine, it's the normal get_user_stats I'm unsure of, Kills/Deaths, ACC, EFF all show as 0, bomb info is showing correctly, aswell as my ranking mod. I just need to incorperate the 2
__________________
187Ghost187 is offline
187Ghost187
Junior Member
Join Date: May 2009
Old 06-07-2009 , 13:41   Re: Motd windows
Reply With Quote #9

Problem is [Solved]. Was my noobie mistake when adding the line back in, I was forgetting to add the body[8] in the static and just to show what I mean
PHP Code:
{    
    static 
stats[8], stats2[4], body[8]
    
    
get_user_stats(idstatsbody);
    
get_user_stats2(idstats2);
    
    static 
host_name[32];
    
get_cvar_string("hostname"host_name31); 
__________________
187Ghost187 is offline
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 13:59.


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