Raised This Month: $ Target: $400
 0% 

Display a HUD message from a file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
redplug
Junior Member
Join Date: Jan 2009
Old 01-30-2009 , 10:50   Display a HUD message from a file
Reply With Quote #1

i want to read a sting from an file but i become the error:

Code:
Error: Number of arguments does not match definition on line 18
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>


public plugin_init() {
    
register_plugin("test""0.1""Deltachaos");
         
register_clcmd("say all","test",0,"");
}

public 
test(id)
{
    
set_hudmessage(25500, -1.00.906.012.02.02.04);
         if(
file_exists("addons/amxmodx/configs/msg.txt"))
      {
      new 
datei fopen("addons/amxmodx/configs/msg.txt""r");
      new 
msg[1024] = fgets(datei);
      
show_hudmessage(idmsg);
      }


dose anyone know why?
Code:
fgets
  Core (file.inc)  Description
  fgets - Reads a short (2 bytes) from a file handle.  Syntax
   fgets ( file )  Type
  Native  Notes
  This function is deprecated as of AMX Mod X Version 1.1.
and a 2. question - how i can send the message every 30 sec?
redplug is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-30-2009 , 11:06   Re: Display a HUD message from a file
Reply With Quote #2

fget(datei, msg, charsmax(msg))

will read 1st line

fget(datei, msg, charsmax(msg))

will read 2nd line

Then, close the file using :

fclose(datei)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
redplug
Junior Member
Join Date: Jan 2009
Old 01-30-2009 , 11:10   Re: Display a HUD message from a file
Reply With Quote #3

ok i have edit is:
get:
Code:
Error: Must be a constant expression; assumed zero on line 18
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("test", "0.1", "Deltachaos");          register_clcmd("say all","test",0,""); } public test(id) {     set_hudmessage(255, 0, 0, -1.0, 0.9, 0, 6.0, 12.0, 2.0, 2.0, 4);          if(file_exists("addons/amxmodx/configs/msg.txt"))       {       new datei = fopen("addons/amxmodx/configs/msg.txt", "r");            new themp[50];       new msg[] = fgets(datei, themp, 50);       fclose(datei);       show_hudmessage(id, "                   test");       show_hudmessage(id, msg);       } }


how can i get the string into the variable?

Last edited by redplug; 01-30-2009 at 11:54.
redplug is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-30-2009 , 12:08   Re: Display a HUD message from a file
Reply With Quote #4

new msg[64]
fgets(datei, msg, charsmax(msg))
fclose(datei)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
redplug
Junior Member
Join Date: Jan 2009
Old 01-30-2009 , 12:44   Re: Display a HUD message from a file
Reply With Quote #5

ok thx and how i can start the function every x minute?

or how can i start a command when the player is joined
event??

Last edited by redplug; 01-30-2009 at 13:25.
redplug is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-30-2009 , 13:37   Re: Display a HUD message from a file
Reply With Quote #6

What do you want to do exactly ?

You want to retrieve messages from file and showing randomly them every x minutes to a player when he arrives on the server ?
Arkshine is offline
redplug
Junior Member
Join Date: Jan 2009
Old 01-30-2009 , 13:46   Re: Display a HUD message from a file
Reply With Quote #7

Yes,
I want to show these messages to each player spaced.
Do you know the server messages of other games like:
"Do not spawnkill" or "Welcome to xy Server" and so on. Amx Mod X displays these messages too.
"This server is using Amx Mod X visit amxmodx.org"

Last edited by redplug; 01-30-2009 at 13:49.
redplug is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-30-2009 , 13:50   Re: Display a HUD message from a file
Reply With Quote #8

If you want to display imessages or scroll messages, see amxx.cfg, no need to use your plugin.
Arkshine is offline
redplug
Junior Member
Join Date: Jan 2009
Old 01-30-2009 , 15:36   Re: Display a HUD message from a file
Reply With Quote #9

how can i create an word wrap in a HUD message?

Code:
Code:
show_hudmessage(id, "No AWP Laiming!\nNo Spawnkilling!\No Rush!\nNo Bugusing!\nNo Cheating!");
redplug is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-30-2009 , 16:27   Re: Display a HUD message from a file
Reply With Quote #10

use ^n instead of \n
__________________
xPaw 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 01:42.


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