SA-MP Forums Archive
Reading string from Dini... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Reading string from Dini... (/showthread.php?tid=193770)



Reading string from Dini... - Alex_Valde - 27.11.2010

How can I read string from dini?

I have something like:
pawn Код:
dini_Set(file, "MobileType", "Nokia");
    PlayersMob = dini_Int(file, "MobileType");
Where PlayersMob is:
pawn Код:
Player[playerid][MobileType] = PlayersMob;
So this is called when player has got NO phone and he buys it...

And this is called when player already has a phone:
pawn Код:
format(string, sizeof(string),"You already have a phone. Your have %s and your number is %d.", PlayersMob,Player[playerid][PhoneNumber]);
    SendClientMessage(playerid, COLOR_LIGHTRED, string);
But when I'm in game and I try to buy a phone (When I already have one) I get something like:
"You already have a phone. Your have [blank] and your number is 999999."

How can I read that I have Nokia phone?


Re: Reading string from Dini... - Zh3r0 - 27.11.2010

Use dini_Get.


Re: Reading string from Dini... - Blatnoi - 27.11.2010

that's because you use dini_int
you need dini_get
pawn Код:
PlayersMob = dini_get(file, "MobileType");
and don't forget to add [255] in new on Mobiletype
pawn Код:
new MobileType[255];



Re: Reading string from Dini... - Alex_Valde - 27.11.2010

OMFG!
Thanks guys.
And I just couldn't think of what am I doing wrong.
Anyways, Thanks!