12.02.2013, 18:36
I have become a little stumped at a bit of code I am using to attempt to spawn vehicles.
I have pulled it apart to its bare minimum to get a proper response from the code but when I start adding things back in, it stops working.
Here is my code:
This produces an INFINITE loop for some reason.
If I change:
i <= rows
to
i != rows
the looping stops at line 1!
yet, this is the strange bit. IF I then change the field name from "vid" (which is the actual field name) to "vehid" (another field name) I get 76 results! The next issue is that there should be 1777 results!!!!
Can someone give me a working example of row looping using R7's caching feature? or at least point out what I need to do to get it to work.
I have pulled it apart to its bare minimum to get a proper response from the code but when I start adding things back in, it stops working.
Here is my code:
Код:
new rows, fields; cache_get_data(rows, fields, connectionHandle); new tv[1], tvid[1], tvx[1], tvy[1], tvz[1], tvf[1], tvc1[1], tvc2[1]; // loop through all fields printf("rows: %d", rows); for(new i = 0; i <= rows; i++) { cache_get_field_content(i, "vid", tv); printf("The name of field %d is '%f'", i, strval(tv)); }
If I change:
i <= rows
to
i != rows
the looping stops at line 1!
yet, this is the strange bit. IF I then change the field name from "vid" (which is the actual field name) to "vehid" (another field name) I get 76 results! The next issue is that there should be 1777 results!!!!
Can someone give me a working example of row looping using R7's caching feature? or at least point out what I need to do to get it to work.