How to save listitem as a string? -
baba1234 - 01.06.2015
So I have dialog with list items and the dialog is about where player lives example: Europa,America etc. and I want
when player clicks certein list item yini will save his country or state in string not the integer. Or is it better to save it as a integer? If u want some code tell me I will post but I think u dont need the code to explain this.
AW: How to save listitem as a string? -
Kaliber - 01.06.2015
Just do it like this:
Код:
new INI:ACCOUNT = INI_Open(file);
INI_WriteString(ACCOUNT, "Country", inputtext);
In the inputtext, is the Name of the Country (the player clicked) saved
Re: How to save listitem as a string? -
baba1234 - 01.06.2015
yea but I have something like this I have This
Код:
if(dialogid == DIALOG_ORIGIN)
{
if(response)
{
if(listitem == 0) //
{
}
if(listitem == 1) //
{
PlayerInfo[playerid][pOrigin] = 2;
new INI:File = INI_Open(Path(playerid));
new Origin = PlayerInfo[playerid][pOrigin];
INI_WriteInt(File,"Origin", Origin);
INI_Close(File);
}
if(listitem == 2) //
{
PlayerInfo[playerid][pOrigin] = 3;
new INI:File = INI_Open(Path(playerid));
new Origin = PlayerInfo[playerid][pOrigin];
INI_WriteInt(File,"Origin", Origin);
INI_Close(File);
}
if(listitem == 3) //
{
PlayerInfo[playerid][pOrigin] = 4;
new INI:File = INI_Open(Path(playerid));
new Origin = PlayerInfo[playerid][pOrigin];
INI_WriteInt(File,"Origin", Origin);
INI_Close(File);
}
}
return 1;
}
AW: How to save listitem as a string? -
Kaliber - 01.06.2015
Then what is your problem?
You save already the origion...if you want it as String, save the inputtext...
Re: How to save listitem as a string? -
baba1234 - 01.06.2015
But it is not input dialog it is listitem? I save origin in the integers I didnt save it as a text like it should be Origin: America not Origin: 1
Re: How to save listitem as a string? -
Konstantinos - 01.06.2015
Quote:
Originally Posted by baba1234
But it is not input dialog it is listitem? I save origin in the integers I didnt save it as a text like it should be Origin: America not Origin: 1
|
"inputtext" holds the text of the line (listitem) you selected.
AW: Re: How to save listitem as a string? -
Kaliber - 01.06.2015
Quote:
Originally Posted by baba1234
But it is not input dialog it is listitem?
|
Thats doesn't matter...in inputtext is the value he clicked.
So if he clicked on America...the inputtext = America...
Then use this function:
Код:
INI_WriteString(File,"Origin", inputtext);
But...you should save just the integer and you can make a function who parse the integers into strings, for e.g. stats:
Код:
stock GetCountry(id)
{
new string[32];
switch(id) {
case 1: string = "America"; //For example
}
return string;
}
Greekz