Raised This Month: $ Target: $400
 0% 

hudmessage from .txt file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Puffo
New Member
Join Date: Mar 2008
Old 03-14-2008 , 20:32   hudmessage from .txt file
Reply With Quote #1

Hello, im working on my very first AMX plugin and i need some to make a hudmessage get the text from text file so it will be easy to change.
It would be nice if somone coud give me a link to a tut ( I can't find one my selv) or even fix et for me My code is like this:

Quote:
/*
Ping Rules
By Puffo
*/
#include <amxmod>
#include <amxmisc>
public regler(id,level,cid) {
if (!cmd_access(id,level,cid,1)) {
return PLUGIN_HANDLED
}

//
new Players[32], Num, Player;
get_players(Players, Num, "bch");

for(new i = 0 ; i < Num ; i++)
{
Player = Players[i];
set_hudmessage(0, 255, 0, 0.0, 0.2, 0, 6.0, 10.0)
show_hudmessage(id, "- No cheating/usage of hacks^n- No team kill^n- No team damage^n- No team flash^n- No bug usage^n- Only speak dansih or english^n- No offensive language^n- No basecamping^n- Respect admins")
set_task(15.0,"regler")
}
//

set_task(15.0,"regler")


return PLUGIN_HANDLED
}

public plugin_init() {
register_plugin("Pingu Rules","0.1","Puffo")
register_clcmd("amx_rules","regler",ADMIN_VOT E," : prints the rules to everyone")

}

{

}
Thanks!
Puffo is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-14-2008 , 21:49   Re: hudmessage from .txt file
Reply With Quote #2

Code:
new message[1024];

public plugin_cfg()
{
    new filename[200];
    get_configsdir(filename, 199);
    add(filename, 199, "/hudmessage.txt");
    if(file_exists(filename))
    {
        new file = fopen(filename, "rt");
        if(file)
        {
            new data[128];
            new len = 0, size = sizeof(message);
            while(!feof(file) && len < size)
            {
                fgets(file, data, 127);
                if(strlen(data) > 0)
                   len += add(message, size-1, data);
            }
            fclose(file);
        }
    }
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-15-2008 , 03:11   Re: hudmessage from .txt file
Reply With Quote #3

What about puting that in amxx.cfg :

Code:
// Center typed colored messages (last parameter is a color in RRRGGGBBB format)
//
// Default values: "Welcome to %hostname%" "000255100"
//                 "This server is using AMX ModX\nVisit http://www.amxmodx.org" "000100255"
amx_imessage "Welcome to %hostname%" "000255100"
amx_imessage "This server is using AMX Mod X\nVisit http://www.amxmodx.org" "000100255"
amx_imessage "No cheating/usage of hacks" "255000000"
amx_imessage "No team kill" "255000000"
amx_imessage "No team damage" "255000000"

// Frequency in seconds of colored messages
//
// Default value: 180
amx_freq_imessage 180
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Puffo
New Member
Join Date: Mar 2008
Old 03-15-2008 , 06:45   Re: hudmessage from .txt file
Reply With Quote #4

Thanks alot X-olent...Im trying to use your code but how do i get it to print out that text from the hudmessge.txt file?
show_hudmessage(id, "/hudmessge.txt") dosent work

EDIT: Nvm i find out my self how to make it work show_hudmessage (id, s:message)

Connorr...Its not that funny to just put in there


Thanks alot both of you

Last edited by Puffo; 03-15-2008 at 13:13.
Puffo 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 21:29.


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