#1

Hi, for some reason this code doesn't work properly. All the other things work except level, admin, tester and donator. The problem is that it always says in the dialog that my level is 0 and that i'm not an admin, not a tester and not a donator. Here's the code:
Код:
			cache_get_data(rows, fields, g_iHandle);

			if (rows)
			{
			    static
			        characterinfo[256],
			        birthdate[16],
			        origin[32],
				level,
				admin,
				tester,
				donator;

				cache_get_field_content(0, "Birthdate", birthdate, g_iHandle);
				cache_get_field_content(0, "Origin", origin, g_iHandle);
				level = cache_get_field_int(0, "Level");
				admin = cache_get_field_int(0, "Admin");
				tester = cache_get_field_int(0, "Tester");
				donator = cache_get_field_int(0, "Donator");
				
				if (!strlen(birthdate)) {
				    birthdate = "Not Specified";
				}
				if (!strlen(origin)) {
				    origin = "Not Specified";
				}
				format(characterinfo, sizeof(characterinfo), "Name: %s\nBirthdate: %s\nOrigin: %s\nCreated: %s\nPlayed: %s", PlayerCharacters[extraid][PlayerData[extraid][pCharacter] - 1], birthdate, origin, GetDuration(gettime() - cache_get_field_int(0, "CreateDate")), GetDuration(gettime() - cache_get_field_int(0, "LastLogin")));
				format(characterinfo, sizeof(characterinfo), "%s\nLevel: %d\nAdmin: %s\nTester: %s\nDonator: %s", characterinfo, level, (admin) ? ("Yes") : ("No"), (tester) ? ("Yes") : ("No"), (donator) ? ("Yes") : ("No"));
				Dialog_Show(extraid, ViewCharacter, DIALOG_STYLE_MSGBOX, "View Character", characterinfo, "Spawn", "Back");
                          }
What's wrong with it?
Reply
#2

Its cache_get_field_content_int not cache_get_field_int
Rest seems fine.
See in DB if you are actually admin/donator in DB.
Reply
#3

Quote:
Originally Posted by [cS]Owain
Посмотреть сообщение
Its cache_get_field_content_int not cache_get_field_int
Rest seems fine.
See in DB if you are actually admin/donator in DB.
Nope, it's cache_get_field_int, I tried it with cache_get_field_content, I get errors when compiling. I don't need text from there, but the number.
Reply
#4

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
Nope, it's cache_get_field_int, I tried it with cache_get_field_content, I get errors when compiling. I don't need text from there, but the number.
He said cache_get_field_content_int, which is used to fetch the integer value. Which version of plugin are you using? I don't think there's such function as cache_get_field_int exist, unless either it was added in the latest version or your script has it re-defined.

Anyway, check your log and print the output of donator, admin and tester.
Reply
#5

Quote:
Originally Posted by Sjn
Посмотреть сообщение
He said cache_get_field_content_int, which is used to fetch the integer value. Which version of plugin are you using? I don't think there's such function as cache_get_field_int exist, unless either it was added in the latest version or your script has it re-defined.

Anyway, check your log and print the output of donator, admin and tester.
Oh, I didn't notice the "int". I'll try it. I use the latest one. Anyways there is just "cache_get_field_int" in the script.
Reply
#6

cache_get_content_int doesn't work as well.
Reply
#7

Well, I am not quite sure about the function you have since I'm seeing the "cache_get_field_int" for the first time. I've been using the one that the guy posted earlier.

If the code compiled fine without errors/warnings then the function is obviously what you have right now. As I said, try printing the output of those statuses and also check mysql log. I am guessing there might be an error related to the field name/rows.
Reply
#8

Quote:
Originally Posted by Sjn
Посмотреть сообщение
Well, I am not quite sure about the function you have since I'm seeing the "cache_get_field_int" for the first time. I've been using the one that the guy posted earlier.

If the code compiled fine without errors/warnings then the function is obviously what you have right now. As I said, try printing the output of those statuses and also check mysql log. I am guessing there might be an error related to the field name/rows.
How to print the output? If you meant something with printf then I printed the level, admin, tester and donator and they are all 0.

EDIT: I checked he MySQL log and it says fields "Level", "Admin", "Tester" and "Donator" are not found, but they do exist...
Reply
#9

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
cache_get_content_int doesn't work as well.
cache_get_field_content_int(row, field_name[], connectionHandle = 1)
Reply
#10

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
How to print the output? If you meant something with printf then I printed the level, admin, tester and donator and they are all 0.

EDIT: I checked he MySQL log and it says fields "Level", "Admin", "Tester" and "Donator" are not found, but they do exist...
Can you post the query that you sent to grab these results?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)