AlliedModders

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

187Ghost187 06-06-2009 05:33

Motd windows
 
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.

31m0_owns 06-06-2009 11:51

Re: Motd windows
 
Hi Ghost here is a plugin from EKS

http://forums.alliedmods.net/showthread.php?p=2883

187Ghost187 06-06-2009 12:45

Re: Motd windows
 
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.

fysiks 06-06-2009 16:02

Re: Motd windows
 
We would greatly appreciate if you use [php] tags around your plugin code when posting instead of using [quote]. :).

187Ghost187 06-06-2009 17:03

Re: Motd windows
 
Fixed, my apoligizes

-Acid- 06-07-2009 02:26

Re: Motd windows
 
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); 


fysiks 06-07-2009 02:43

Re: Motd windows
 
Quote:

Originally Posted by -Acid- (Post 843460)
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.

187Ghost187 06-07-2009 06:48

Re: Motd windows
 
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 06-07-2009 13:41

Re: Motd windows
 
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); 



All times are GMT -4. The time now is 13:59.

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