AlliedModders

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

Sliver 08-31-2004 17:02

quick question.....
 
im pretty new to making plugins but not to coding but i was wondering how i would go about reading a text file and displaying it in an MOTD or the console (whatever is easier)

pretty basic plugin just want some tips and natives to get me going



thx

Votorx 08-31-2004 17:28

Lol, you don't need to be good at scripting to figure this out. Check out the include files.

Sliver 08-31-2004 17:36

ok ok here is what i got so far
Code:

#include <amxmodx>
#include <amxmisc>


public showlastmaps(id)
{
        new header[80]
        new myversion[32]
        new lastmaps[64]
        get_configsdir(lastmaps, 63)
        format(lastmaps,63,"%s/map_manage/lastmapsplayed.txt", lastmaps)
        get_cvar_string("Deags_Map_Manage",myversion,31)
        format ( header , 79 ,"Displaying Last Maps Played",myversion )

        show_motd(id,lastmaps,header)
        return PLUGIN_CONTINUE
}

public plugin_init()
{
        register_plugin("Lastmaps","0.1","Sliver")
        register_clcmd("say /lastmaps","showlastmaps")
        return PLUGIN_CONTINUE
}

everything works as i wanted it to but here is what my lastmaps.txt looks like:
de_nuke
de_dust2
de_torn
de_dust2
de_aztec
//Generated by map_nominate plugin,
//these are most recent maps played

and that is what pops up in the MOTD, would there be any way to get rid of those comments? (the generated by map_nominate)

KRoT@L 08-31-2004 17:36

/* Shows text in MOTD window. When there is no header, the MOTD title
* will be the name of server. If message is filename, then a contents
* of this file will be displayed as MOTD. */
native show_motd(player,const message[],const header[]="");

ex : show_motd(player, "/addons/amxx/your_motd.txt", "Motd title" )

Sliver 08-31-2004 19:38

ok...got it......is there a way to adjust the font/color of the MOTD? i know it is all in HTML but how owuld i make the backround black and the text red and bold, but still displaying the txt file, is that possible?

KRoT@L 08-31-2004 23:53

Taken from the takeadookie plugin :

Code:
public do_help(id){     new len = 1300     new buffer[1301]     new n = 0     n += copy( buffer[n],len-n,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><body><pre>")     n += copy( buffer[n],len-n,"To take a dookie on dead bodies you have to bind a key to: takeadookie^n^n")     n += copy( buffer[n],len-n,"In order to bind a key you must open your console and use the bind command: ^n^n")     n += copy( buffer[n],len-n,"bind ^"key^" ^"command^" ^n^n")     n += copy( buffer[n],len-n,"ex:^n^n")     n += copy( buffer[n],len-n,"    bind f takeadookie      bind MOUSE3 takeadookie^n^n")     n += copy( buffer[n],len-n,"Now you can step over any dead body and press your dookie key^n^n")     n += copy( buffer[n],len-n,"For every 2 headshots you make your dookie is turned into a superdookie^n")     n += copy( buffer[n],len-n,"which just adds more effects for grossness^n")     n += copy( buffer[n],len-n,"</pre></body></html>")     show_motd(id,buffer,"Dookie Help")     return PLUGIN_CONTINUE }


All times are GMT -4. The time now is 17:12.

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