Code:
#include <amxmodx>
#include <amxmisc>
#include <file>
new saytext[192]
new inifile[101]
new readdata[401] // the data on the line it is reading
new col1[101] // the first bit of the line
new col2[101] // the second bit of the line
new col3[101] // the third bit of the line
new col4[101] // the third bit of the line
new linelength = 0 // how long the line is
new currline=0
public plugin_init() {
register_plugin("Speak English", "0.1a", "[DumB]SteamSucks")
register_clcmd("say", "cmd_say")
register_clcmd("say_team", "cmd_sayteam")
inifile ="words.txt"
}
public cmd_say(id)
{
new arg[192]
read_args(arg, 191)
remove_quotes(arg) // Say Message are encase in Quotes
while(read_file(inifile,currline,readdata,400,linelength) != 0){ //checks every line in inifile, stores what it finds in readdata, and what line its on in currline
parse(readdata,col1,100,col2,100,col3,100,col4,100) //reads the data on each line and stores it in col1 etc.
if( containi(arg,col1) || containi(arg,col2) || containi(arg,col3)) {
server_print("user would be getting booted now")
return PLUGIN_HANDLED
}
currline++ //goes to the next line
}
PLUGIN_HANDLED
}
the ini file is like this
Code:
testword1 testword2 testword3 testword4
testword5 testword6 testword7 testword8
the ini file is tabbed spaces
and the error i get is
Code:
L 03/03/2006 - 14:00:57: [AMXX] Displaying debug trace (plugin "SpeakEnglish.amxx")
L 03/03/2006 - 14:00:57: [AMXX] Run time error 10: native error (native "read_file")
L 03/03/2006 - 14:00:57: [AMXX] [0] SpeakEnglish.sma::cmd_say (line 32)
line 32 code is
Code:
while(read_file(inifile,currline,readdata,400,linelength) != 0){ //checks every line in inifile, stores what it finds in readdata, and what line its on in currline
any ideas guys whats going wrong and why please
regards..
__________________
If it works then i wrote it if it erros on less then 50 lines i had help with it if it breaks totally it wasnt me..