Block Button ID
I made a plugin to block using block with button ID. But It's not working. I guess it doesn't get file or something like that. Could you fix my mistake? Thanks for helping :)
Example file is "configs/block_buttons/mapname.ini" There are IDs in the file. Like; Code:
213PHP Code:
|
Re: Block Button ID
What are those variable names xD
Anyway when reading from a file in a loop you shouldn't use read_file, read more about it here. ( Not saying that is the issue tho ) Did you see if your values actually get read, so I know what to look for, because i can hardly find my way with your variable names hahaha ? EDIT: but here is your issue Code:
|
Re: Block Button ID
I think its better to use fopen feof fread fclose natives instead of read_line
|
Re: Block Button ID
I don't know about fopen or any commands like them. So, I am sorry for variable names. I forgot to change their names from Turkish to English. You don't have to have a fun with them as a idiot :S (My bad)
|
Re: Block Button ID
It's ok, try fixing what we told you
Also heres an example how to read from a text file properly PHP Code:
|
Re: Block Button ID
It still does not work. I guess I cannot do it how get IDs from file.
Spoiler
|
Re: Block Button ID
You just read sData, and counted it, you didn't place the result anywhere, sData is a local variable ( Outside of the function, it doesn't exist ).
You are using the var ButtonsID wrong. Try doing something like: PHP Code:
|
Re: Block Button ID
You mean this? I tried to make it correctly. Can I use g_iButtons[g_iButtonCounter] to find that is equal to ent (Button I use).
Spoiler
|
Re: Block Button ID
I hope you understand what we are doing and not just copy pasting tho :D
Now, You read the file correctly, you wan't to check if a player pushed a button from your array right ? You can't use g_iButtons[ButtonIDs], because ButtonIDs is just a counter ( You should change its name tho ), so if ButtonIDs == 3, You would just be getting iButtons[3], but in our example it would cause an index out of bounds error anyway. So what you need to use is loop through all g_iButtons and check if any of them match. |
Re: Block Button ID
Can you give a example to me? I cannot understand how I should do. (So I understand what we have done) :)
What I should use? PHP Code:
|
| All times are GMT -4. The time now is 04:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.