SA-MP Forums Archive
Dialog help - 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)
+--- Thread: Dialog help (/showthread.php?tid=461779)



Dialog help - Don_Cage - 03.09.2013

If I put the code like this.
pawn Код:
if(dialogid == 1)
        {
            if(response)
            {
                new namestring[50];
                namestring = strval(inputtext); // Error Line
                format(string, sizeof(string), "LARP/Users/%s.ini", namestring);
                if(!dini_Exists(string))
                {
                    SetPlayerName(playerid, namestring);
                    format(string, sizeof(string),"You choosed %s as your undercover name. (( To get your normal name back simply type /offduty ))",namestring);
                    SendClientMessage(playerid,COLOR_RLRPGBLUE,string);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "You can't take a name that is allready in use.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RLRPGBLUE, "It would be safer with an undercover name. But ok, you decide.");
                return 1;
            }
        }
I get this error
Код:
error 033: array must be indexed (variable "namestring")
But if I put the code like this.
pawn Код:
if(dialogid == 1)
        {
            if(response)
            {
                new namestring[50] = strval(inputtext);//Error Line
                format(string, sizeof(string), "LARP/Users/%s.ini", namestring);
                if(!dini_Exists(string))
                {
                    SetPlayerName(playerid, namestring);
                    format(string, sizeof(string),"You choosed %s as your undercover name. (( To get your normal name back simply type /offduty ))",namestring);
                    SendClientMessage(playerid,COLOR_RLRPGBLUE,string);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "You can't take a name that is allready in use.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RLRPGBLUE, "It would be safer with an undercover name. But ok, you decide.");
                return 1;
            }
        }
I get this error..
Код:
must be a constant expression; assumed zero
How do I fix it?


Re: Dialog help - Konstantinos - 03.09.2013

If a player inputs a name there, then it's stored to inputtext.
pawn Код:
if(response)
{
    format(string, sizeof(string), "LARP/Users/%s.ini", inputtext);
    // blabla..



Re: Dialog help - Don_Cage - 03.09.2013

Ah, Thank you. If it means something you earned a +rep