Dialog help
#1

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?
Reply
#2

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..
Reply
#3

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


Forum Jump:


Users browsing this thread: 2 Guest(s)