dini_Get problem.
#1

Hey, i'm having a problem with reading a string from a file.
The code looks like this:
Код:
	        new ownh[MAX_STRING];
		ownh=dini_Get("Factions/Team-CIV.txt","factioncolor");
	        SetPlayerColor(playerid,ownh);//[1337]
When compiling I get this error:
(1337) : error 035: argument type mismatch (argument 2)

Can someone help me with this, please?
Reply
#2

dini_Get returns a string, use dini_GetInt
Reply
#3

The thing is, i want it to return a string.
And if i'm right, you intended to say dini_Int instead of dini_GetInt.
(The string from "factioncolor" = COLOR_WHITE
Reply
#4

Quote:
Originally Posted by justinnater
Посмотреть сообщение
The thing is, i want it to return a string.
And if i'm right, you intended to say dini_Int instead of dini_GetInt.
(The string from "factioncolor" = COLOR_WHITE
Oh yeah, its been ages since nearly noone uses dini nowadays

So you saved the string "COLOR_WHITE" ?
Although this looks like a define (#define COLOR_WHITE 0xFFFFFFFF)
If thats the cause than, just save it as an int and load it as an int, problem solved
pawn Код:
// saving
dini_SetInt("Factions/Team-CIV.txt","factioncolor", COLOR_WHITE); // if its a define
// loading
new color = dini_Int("Factions/Team-CIV.txt","factioncolor");
Saving the string is just inefficient
Reply
#5

dini_Int reads only integers, so it won't work due the x from 0xFFFFFF
Reply
#6

Quote:
Originally Posted by justinnater
Посмотреть сообщение
dini_Int reads only integers, so it won't work due the x from 0xFFFFFF
Than you didnt understood what an integer is, an integer can be any number in any decimal format
Pawno supports hex (0x), deci (nothing) and binar (0b) formations, test that
pawn Код:
printf("They are all the same -> %d - %d - %d", 1234, 0x4D2, 0b10011010010);
Reply
#7

Oh, thats weird. I am currently using the following code:
Код:
		new color = dini_Int("Factions/Team-CIV.txt","factioncolor");
		SetPlayerColor(playerid,color);
And my color is black, while it should be white(0xFFFFFFFF). Did i missed something?


I implented SendClientMessage for a second to show the integer and as I mentioned already, it stops at the x from 0xFFFFFFFF
Код:
    	format(message,sizeof(message),"Current Integer: %d",color);
        SendClientMessage(playerid,COLOR_RED,message);
Reply
#8

You also need to save it as int not as string, check reply #4, there is the saving and the loading part
Reply
#9

Yes i saved it as a int now.
Код:
factioncolor=0xFFFFFFFF
Yet i still have the same problem.
Reply
#10

strval (which gets executed within dini_Int) only accecpts plain numbers, no hex

Also if you do
pawn Код:
dini_IntSet("Factions/Team-CIV.txt","factioncolor", COLOR_WHITE);
you get
Код:
factioncolor=-1
Which is correct since -1 = 0xFFFFFFFF
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)