strlen text help!
#1

I have this Dialog Response:
Quote:

if(dialogid == 6121)
{
if(response)
{
if(strlen(inputtext) >= 2 && strlen(inputtext) <= 32)
{
new string[128], iFac;
format(string, sizeof(string), "You have renamed faction ID %i and named it %s!", arrFaction[iFac][g_FactionID] = 0, strlen(inputtext));
SendClientMessageEx(playerid, COLOR_WHITE, string);
CreateDynamicFaction(strlen(inputtext));
SaveDynamicFaction();
}
else return ShowPlayerDialog(playerid,6123,DIALOG_STYLE_INPUT, " Edit Groups:", "To enable radio access, input: 1 | To disable radio access, input 2\n\n(To reset the radio access, enter 255).", "Select", "Ok");
}
}

It creates the .ini file like it is a post to do on CreateDynamicFaction but it doesnt put the name there, it usually does it: 'FacNameHere_IDhere' but whenever I do it in a dialog it just goes blank like : ' _IDHere' it worked with sscanf on a normal cmd but i cant get it to work on dialogs!

Also its a post to say 'You have renamed blah blah blah and named it NAMEHERE!' but it just goes blank so I think the strlen text is messing up

Orginal dialog then going onto creating if you get me lol
Quote:

if(dialogid == 6783)
{
if(response)
{
new string[128], iFac;
if(listitem == 0) //ID 0 Faction Name
{
format(string, 6121, "Enter the faction name you wish to name this faction with.\n(TIP: The name cannot be more than 32 characters.)", arrFaction[iFac][g_szFactionName], arrFaction[iFac][g_FactionID] = 0, arrFaction[iFac][g_iRadioAccess]);
ShowPlayerDialog(playerid, 6121, DIALOG_STYLE_INPUT, "Edit Faction: Faction Name", string, "Select", "Close");
}
if(listitem == 1) //ID 0 Radio Access
{
format(string, 6123, "To enable radio access, input: 1 | To disable radio access, input 2\n\n(TIP: To reset the radio access, enter 255).", arrFaction[iFac][g_szFactionName], arrFaction[iFac][g_FactionID] = 1, arrFaction[iFac][g_iRadioAccess]);
ShowPlayerDialog(playerid, 6123, DIALOG_STYLE_INPUT, "Edit Faction: Radio Access", string, "Select", "Close");
}
}
}

Ignore the radio access

thanks, +rep
Reply
#2

Replace:

pawn Код:
CreateDynamicFaction(strlen(inputtext));
With:

pawn Код:
CreateDynamicFaction(inputtext);
Because I don't know how the system works, but that would mean like inputting a number into the parameters, it can almost be like.

pawn Код:
CreateDynamicFaction(345343);
I think that is what the problem is anyway.
Reply
#3

Why didn't you take the codes like I posted you last time?

pawn Код:
format(string, sizeof(string), "You have renamed faction ID %i and named it %s!", arrFaction[iFac][g_FactionID] = 0, strlen(inputtext));
To

pawn Код:
format(string, sizeof(string), "You have renamed faction ID %i and named it %s!", arrFaction[iFac][g_FactionID] = 0, inputtext);
I've wrote:
pawn Код:
format(string,sizeof(string),"You've changed the faction name to %s.", inputtext);//with inputtext, not strlen(inputext)

I'll explain you something.

inputtext: the text you entered in the dialog.
strlen: string lenght
strlen(inputtext): the size of the string of the text you wrote
Reply
#4

I have an error now:

Quote:

(5273) : error 035: argument type mismatch (argument 1)

Its on this line:
Quote:

CreateDynamicFaction(inputtext);

Reply
#5

Maybe try this?

pawn Код:
CreateDynamicFaction (inputtext);
If didn't work show the whole line...
Reply
#6

That is the whole line, lol..

and it didnt work
Reply
#7

bump :/
Reply
#8

Make the DIALOG id lowers there's a certain DIALOG Limit I'do recommend hold it udner 3000
Reply
#9

Quote:

CreateDynamicFaction(iFac)
{
new Filename[64], line[256];
format(Filename, sizeof(Filename), FACTION_SYSTEM_File_PATH "%s_%d.ini", arrFaction[iFac][g_szFactionName], iFac);
new File:handle = fopen(Filename, io_write);

format(line, sizeof(line), "Faction Name=%s\r\n", arrFaction[iFac][g_szFactionName]); fwrite(handle, line);
format(line, sizeof(line), "Faction ID=%i\r\n", arrFaction[iFac][g_FactionID] = iFac); fwrite(handle, line);
format(line, sizeof(line), "Locker VW=%d\r\n", arrFaction[iFac][g_iLockerVW]); fwrite(handle, line);
format(line, sizeof(line), "Faction Type=%d\r\n", arrFaction[iFac][g_iFactionType]); fwrite(handle, line);
format(line, sizeof(line), "Locker Guns=%i\r\n", arrFaction[iFac][g_iLockerGuns]); fwrite(handle, line);
format(line, sizeof(line), "Locker Costing=%i\r\n", arrFaction[iFac][g_iLockerCost]); fwrite(handle, line);
format(line, sizeof(line), "Allegiance=%d\r\n", arrFaction[iFac][g_iAllegiance]); fwrite(handle, line);
format(line, sizeof(line), "Radio Access=%d\r\n", arrFaction[iFac][g_iRadioAccess]); fwrite(handle, line);
format(line, sizeof(line), "Locker Stock=%i\r\n", arrFaction[iFac][g_iLockerStock]);
fwrite(handle, line);
fclose(handle);
}

There you go, thanks for all the help so far guys
Reply
#10

right...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)