strlen text?
#1

I have this CMD:
Quote:

CMD:editgroups(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_WHITE, "You are not authorised to use this command!");
{
ShowPlayerDialog(playerid,6119,DIALOG_STYLE_LIST," Edit Groups:", "Faction Name\nFaction ID", "Select", "Ok");
}
return 1;
}

How can I convert it so when they click 'Faction Name' it will come up with a message box and you can insert a name via dialog and then it will read it and like pickup the amount of characters(above 2 under 32)?

+rep, I cannot do this whatsoever :/

I have no idea how I can create this, I have been told I need to use strlen text but I have no idea how
Reply
#2

Should be something like this, change the code so it fits your script. P.S. It's been a long time I haven't script, code could have errors.


pawn Код:
case 6119:
        {
            if(response)
            {
                if(listitem == 0) //For the listed item 0, so Faction name
                {
                    ShowPlayerDialog(playerid,New_Dialog_ID,DIALOG_STYLE_INPUT," Edit Groups:", "Enter faction name:", "Select", "Ok");
                }
            }
        }
        case New_Dialog_ID:
        {
            if(response)
            {
                if(strlen(inputtext) >= 2 && strlen(inputtext) <= 32)
                {
                    new string[128];
                    //Here add the variable of the Faction name, here is an example
                    //FactionName[PlayerInfo[playerid][pFaction]] = inputtext;
                    format(string,sizeof(string),"You've changed the faction name to %s.", inputtext);
                    SendClientMessage(playerid, -1, string);
                }
                else return ShowPlayerDialog(playerid,New_Dialog_ID,DIALOG_STYLE_INPUT," Edit Groups:", "Enter faction name:", "Select", "Ok");
            }
        }

Edit: I could be not answering back, I just had a little trip to script again. I'm not always on the forum.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)