Raised This Month: $ Target: $400
 0% 

amxx plugin read from file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 06-16-2011 , 09:51   Re: amxx plugin read from file
Reply With Quote #1

if you want to display in chat you have to use sockets, if you want to use in motd:
Quote:
<html>
<head>
<title>Motd</title>
</head>
<body bgcolor="#000000" scroll="no">
<meta http-equiv="Refresh" content="0;url=http://www.cite.com/text.txt ">
</body>
</html>
jimaway is offline
florin123
Junior Member
Join Date: Jun 2011
Old 06-16-2011 , 10:11   Re: amxx plugin read from file
Reply With Quote #2

i only want chat. So the fact is i have a radio station and everytime the song changes it uploads the name to music.txt from amxmodx/configs.

And when i write on chat /song i want a plugin that reads from music.txt and display on chat current song. But till now it only shows me the same song even if music.txt changes. In game it updates only at changemap
florin123 is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-16-2011 , 10:28   Re: amxx plugin read from file
Reply With Quote #3

Code:
#include < amxmodx > new const UrlFile[ ] = "http://www.cite.com/text.txt" public plugin_init( ) {      register_clcmd( "say /readfile" , "ClientCommand_ReadFile" ) } public ClientCommand_ReadFile( id ) {      show_motd( id , UrlFile ) }

You can try this, but replace the url of your site in the constant. (line 3)
__________________
You can do anything you set your mind to, man.

Devil259 is offline
florin123
Junior Member
Join Date: Jun 2011
Old 06-16-2011 , 10:47   Re: amxx plugin read from file
Reply With Quote #4

thank you! it works, but can you make it write on chat not motd?
florin123 is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-16-2011 , 10:54   Re: amxx plugin read from file
Reply With Quote #5

Use client_print( ) or show_hudmessage( ).
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-16-2011 , 11:13   Re: amxx plugin read from file
Reply With Quote #6

You would have to download the file to your server using sockets module, then read the text from the file and display it in the message.
Putting the URL in the client_print() or show_hudmessage() would only display the URL.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-16-2011 , 11:17   Re: amxx plugin read from file
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
Putting the URL in the client_print() or show_hudmessage() would only display the URL.
I would say he can copy the text in the print or hudmessage.
__________________
You can do anything you set your mind to, man.

Devil259 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 23:33.


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