AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Display a HUD message from a file (https://forums.alliedmods.net/showthread.php?t=84690)

redplug 01-30-2009 10:50

Display a HUD message from a file
 
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?

ConnorMcLeod 01-30-2009 11:06

Re: Display a HUD message from a file
 
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)

redplug 01-30-2009 11:10

Re: Display a HUD message from a file
 
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?

ConnorMcLeod 01-30-2009 12:08

Re: Display a HUD message from a file
 
new msg[64]
fgets(datei, msg, charsmax(msg))
fclose(datei)

redplug 01-30-2009 12:44

Re: Display a HUD message from a file
 
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??

Arkshine 01-30-2009 13:37

Re: Display a HUD message from a file
 
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 ?

redplug 01-30-2009 13:46

Re: Display a HUD message from a file
 
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"

Arkshine 01-30-2009 13:50

Re: Display a HUD message from a file
 
If you want to display imessages or scroll messages, see amxx.cfg, no need to use your plugin.

redplug 01-30-2009 15:36

Re: Display a HUD message from a file
 
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!");

xPaw 01-30-2009 16:27

Re: Display a HUD message from a file
 
use ^n instead of \n


All times are GMT -4. The time now is 01:42.

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