SA-MP Forums Archive
Dialog errors.. 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 errors.. help (/showthread.php?tid=561662)



Dialog errors.. help - aCloudy - 04.02.2015

Hi, I got two errors in scripted a dialog.
This dialog is "input", And the typed word in the input dialog will be the "passwordET", passwordET is a password for a gate.
The problem is in (new password[50] = ...) and that (passwordET = password) , Please someone help.

MY QUESTION: HOW TO REPLACE A STRING WITH ANOTHER STRING ?
HTML Code:
C:\Program Files\lvcnrr\gamemodes\SFCNR1.pwn(13257) : error 008: must be a constant expression; assumed zero
C:\Program Files\lvcnrr\gamemodes\SFCNR1.pwn(13267) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
PHP Code:
if(dialogid == DIALOG_ETPW)
    {
        new 
string[128];
        if(
response == 1)
        {
            new 
password[50] =strval(inputtext); // This is well, But go down to "passwordET = password" and see..
            
if(!strlen(inputtext))
            {
                
ShowPlayerDialog(playerid,DIALOG_ETPW,DIALOG_STYLE_INPUT,"{FFFFFF}ET Gate Password","{FFFFFF}Please enter a new password.","Ok","Cancel");
                return 
1;
            }
            
format(string,sizeof(string),""COL_ADMIN"[ADMIN] {FFFFFF}You have changed {AFAFAF}[ET]{FFFFFF} gate password to %s!",password);
            
SCM(playerid,COLOR_WHITE,string);
            
format(string,sizeof(string),"%s(%d) has changed [ET] gate password.",PlayerName(playerid),playerid);
            
SendALogMessage(string);
            
passwordET password// HERE IS THE PROBLEM, I want to set a string to string.
            
return 1;
        }
    } 



Re: Dialog errors.. help - denNorske - 04.02.2015

pawn Code:
if(dialogid == DIALOG_ETPW)
    {
        new string[128];
        if(response == 1)
        {
            new password[50];
             format(password, sizeof(password), "%s, inputtext); //change this aswell
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid,DIALOG_ETPW,DIALOG_STYLE_INPUT,"
{FFFFFF}ET Gate Password","{FFFFFF}Please enter a new password.","Ok","Cancel");
                return 1;
            }
            format(string,sizeof(string),"
"COL_ADMIN"[ADMIN] {FFFFFF}You have changed {AFAFAF}[ET]{FFFFFF} gate password to %s!",password);
            SCM(playerid,COLOR_WHITE,string);
            format(string,sizeof(string),"
%s(%d) has changed [ET] gate password.",PlayerName(playerid),playerid);
            SendALogMessage(string);
            //passwordET = password; // HERE IS THE PROBLEM, I want to set a string to string.
            format(passwordET, sizeof(passwordET) , "
%s", password); //use this to set one string as another.
            return 1;
        }
    }

Use "format" to format other text-strings. Read more here:

https://sampwiki.blast.hk/wiki/Format


Re : Dialog errors.. help - Dutheil - 04.02.2015

pawn Code:
new password[50] =strval(inputtext);
https://sampwiki.blast.hk/wiki/Strval


Re: Re : Dialog errors.. help - denNorske - 04.02.2015

Quote:
Originally Posted by Dutheil
View Post
pawn Code:
new password[50] =strval(inputtext);
https://sampwiki.blast.hk/wiki/Strval
Read the wiki yourself:
Quote:

...The string you want to convert to an integer.

As he is not trying to do here

Edit; i did understand your post now. Sorry about my comment

As for the Thread starter; read about "strval" and what it does. It converts a string into a number, and that is not what you should do here.

Read my post above and try to understand the changes i've made.