Raised This Month: $ Target: $400
 0% 

Why is this not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sibox
Member
Join Date: Apr 2009
Location: Bulgaria
Old 01-02-2011 , 03:18   Why is this not working
Reply With Quote #1

Code:
public ReadKey(szLine[]) {     new szBuffer[32];     new b = 0;     if(szBuffer[0] == '/' && szBuffer[1] == '/') { str_to_num(szLine) + 1; }     read_file(g_Buttons, str_to_num(szLine), szBuffer, 31, b) } stock keys_func(i) {     new fsize = file_size(filename, 1)     for(new z = 0; z < fsize;z++)     switch(i) {             case 2:buttons         = "ReadKey(z)"             case 3:buttons        = "ReadKey(z)"             case 4:buttons         = "ReadKey(z)"             case 5:buttons         = "ReadKey(z)"             case 6:buttons         = "ReadKey(z)"             case 7:buttons        = "ReadKey(z)"             case 8:buttons         = "ReadKey(z)"             case 9:buttons         = "ReadKey(z)"             case 10:buttons     = "ReadKey(z)"             case 11:buttons     = "ReadKey(z)"             case 12:buttons     = "ReadKey(z)"             case 13:buttons     = "ReadKey(z)"         }     return buttons }
sibox is offline
Send a message via Skype™ to sibox
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-02-2011 , 03:28   Re: Why is this not working
Reply With Quote #2

What in the world is it supposed to do?
__________________
fysiks is offline
sibox
Member
Join Date: Apr 2009
Location: Bulgaria
Old 01-02-2011 , 03:44   Re: Why is this not working
Reply With Quote #3

read name of the keys from file but "ReadKey(z)" is not working.. how can i fix it
sibox is offline
Send a message via Skype™ to sibox
sibox
Member
Join Date: Apr 2009
Location: Bulgaria
Old 01-02-2011 , 05:53   Re: Why is this not working
Reply With Quote #4

I think there is problem in cases but i'm not sure thats why i post it here to the pros :p
sibox is offline
Send a message via Skype™ to sibox
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 01-02-2011 , 07:30   Re: Why is this not working
Reply With Quote #5

Post da whole code, and stop double posting !
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 01-02-2011 , 07:39   Re: Why is this not working
Reply With Quote #6

That's a string => "ReadKey(z)"
That's a function call with a parameter z => ReadKey(z)
Anyway, doing the same thing in every switch case seems redundant.
__________________
ehha is offline
Old 01-02-2011, 07:41
sibox
This message has been deleted by sibox.
sibox
Member
Join Date: Apr 2009
Location: Bulgaria
Old 01-02-2011 , 07:47   Re: Why is this not working
Reply With Quote #7

Code:
#define KEYS 13 new buttons[32]; new filename[256]; new const command[] = "cheatkey"; new g_Buttons[32]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("cheatkey", "warning")     get_configsdir(filename,255)     format(filename,255,"%s/cheatkeys.cfg",filename)    } public ReadKey(szLine[]) {     new szBuffer[32];     new b = 0;     if(szBuffer[0] == '/' && szBuffer[1] == '/') { str_to_num(szLine) + 1; }     read_file(g_Buttons, str_to_num(szLine), szBuffer, 31, b) } stock keys_func(i) {     new fsize = file_size(filename, 1)     new number[32];     for(new z = 0; z < fsize;z++) {         num_to_str(z, number, 31)         switch(i) {                 case 2: ReadKey(number)                 case 3: ReadKey(number)                 case 4: ReadKey(number)                 case 5: ReadKey(number)                 case 6: ReadKey(number)                 case 7: ReadKey(number)                 case 8: ReadKey(number)                 case 9: ReadKey(number)                 case 10: ReadKey(number)                 case 11: ReadKey(number)                 case 12: ReadKey(number)                 case 13: ReadKey(number)             }     }     return buttons } public warning(id) {     for(new i=1;i<=KEYS;i++) {         new name[32]         get_user_name(id,name,31)         client_print(0,print_chat,"%s was forced to quit because he pushed the wrong button! Be careful!",name)         client_print(0, print_chat, "He push: %s", keys_func(i))     } }
sibox is offline
Send a message via Skype™ to sibox
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 12:40.


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