fgets, format (general messup)
Hey,
This should have been an easy plugin to make but incoporating a file to retrieve data from has been the hardest thing I've come across yet. What its suppose to do is: get mapname, open mapfile associated with mapname, read all the lines in the mapfile, remove all the entities listed in the mapfile What it does: Compiles fine :p Crashes on server start Im guessing the crash is caused by the malformed find_ent_by_model/remove ent because fgets is not supplying the right data I wanted. I have yet to find a decent tutorial on file reading, so if you could provide while helping me fix my code. Code:
#include <amxmodx> |
Re: fgets, format (general messup)
WeaponEnt contains a string. That string happens to be the text that makes up a function. This "function" will never get executed because it is just a string of characters.
Basically: WeaponEnt[0] = "f" Also, I don't think fgets returns a value. Here is what I use to take in two parameters (mapname and number): PHP Code:
|
Re: fgets, format (general messup)
Is what I thought aswell, I can't think right now because some guy was just talking to me and has completely confused me so I have yet to come to a solution if you could give me a hint please :p
|
Re: fgets, format (general messup)
Quote:
fgets stores data into the second parameter and returns 0 on error EDIT: OR DOES IT :p EDIT2: NO IT DOESNT >.< |
Re: fgets, format (general messup)
Quote:
|
Re: fgets, format (general messup)
Code:
static cell AMX_NATIVE_CALL amx_fgets(AMX *amx, cell *params) |
Re: fgets, format (general messup)
Quote:
|
Re: fgets, format (general messup)
Quote:
|
Re: fgets, format (general messup)
Now that I think of it, that's why it will work as the condition for the while loop :oops:
|
Re: fgets, format (general messup)
Sorry guys, im still very new to scripting and I appreciate the help you have give me but I can't think of a way to fix this.
This, im guessing, is the main problem: WeaponEnt[0] = "f" Another problem is the data im reading from the file: needs trim() for /n/r Another problem I have just seen is that im using a static size for the weapon model name, variable weapon, which should be dynamic because not all the names are 18 chars. Please could I have some more help? Thanks |
| All times are GMT -4. The time now is 02:15. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.