Raised This Month: $ Target: $400
 0% 

read_file again...


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Br41n
Junior Member
Join Date: Apr 2006
Location: Magdeburg, Germany
Old 12-14-2006 , 15:51   read_file again...
Reply With Quote #1

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(idkeyparsedkeysparsedcommand)
{
    
//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(idprint_chat"KEY: ^"%s^" COMMAND: ^"%s^" "parsedkeysparsedcommand)


    } else if (
key == 1) { // if player pressed No
         
client_print(idprint_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
__________________

Last edited by Br41n; 12-14-2006 at 15:53.
Br41n is offline
 



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 06:48.


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