Hi,
i'm working on a plugin like autobind, but the difference is, that the player can decide, if the player wants to bind the keys automatically or not..
For it i want to read a config.ini file with the key and the command for the key in it.. The file should look like this:
Code:
; Syntax: "<key>" "<command>"
"o" "say hello"
I tried to realize that part, but it doesn't work...
My Code:
PHP Code:
public autobind(id, key, parsedkeys, parsedcommand)
{
//key will start at zero
if (key == 0) //if player pressed Yes
{
new readdata[128],parsedkeys[32],parsedcommand[32],txtlen
new line = 0
while(!read_file(filename,line++,readdata,127,txtlen))
{
parse(readdata,parsedkeys,32,parsedcommand,32)
}
client_cmd(id, "say test")
client_print(id, print_chat, "KEY: ^"%s^" COMMAND: ^"%s^" ", parsedkeys, parsedcommand)
} else if (key == 1) { // if player pressed No
client_print(id, print_chat, "OK, no binding was changed. Type /help to see a list of available say commands.")
}
}
I just tried a client_print to check, that read_file part works.. I want, when a player pressed 1 (Yes), the client_print tells this: "KEY: o COMMAND: say hello".. It's he first time, that I use read_file, so could anyone explain how to realize this?
Thanks
Br41n
__________________