Text & Files
I want to check a line from a file to see if the map name matches it and return the string from it. This current code has been crashing me. Can you spot the problem?
Code:
|
I don't think you can return a string. Actually, you don't need to return it anyway since that particular variable was passed by reference. Whatever changes to it you make in your function will be available to the calling function.
|
You can return a bool, you can return a float.. Why not a string?
Code:
Edit: Hmmm, a global variable. Ahh a workaround! Thanks. |
You know how you grab the map name by doing something like this:
Code:
Oh, you can't return a string because it's composed of multiple cells whereas everything else you mentioned is only a single cell. |
Quote:
when you make a function with a string it will change it. Example: Code:
And then in the main function szString will be "Testing String" and len will be the string length of it. |
In PAWN, you can return arrays (and thus strings, as strings in PAWN are ^0 delimited arrays) through some process, but I forget it.
|
Heres what I have right now but still it crashes my cs.
Code:
The function that calls it Code:
What I have in the cfg file Code:
de_dust test_ |
Okay. I just need info on this:
Crashes my listen server Code:
This doesn't Code:
|
The first one will continually read the same line over and over again, because the read_file function returns the next line (or 0 if end of file), but you never fetch its return value.
|
Code:
Also With your code Code:
it should be Code:
|
| All times are GMT -4. The time now is 16:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.