SA-MP Forums Archive
little dialog input text problem - 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: little dialog input text problem (/showthread.php?tid=303684)



[SOLVED]little dialog input text problem - MasterB - 14.12.2011

Hello there,

Ive been out sa-mp and pawno for a while now but since i shortly noticed there was an update (0.3d).
I was planning to restore and update my server.
But im abit struggling with this.

Код:
(582) : error 047: array sizes do not match, or destination array is too small
pawn Код:
if(dialogid == REGISTER_DIALOG_3)
    {
        if(!response)
        {
            ShowPlayerDialog(playerid,REGISTER_DIALOG_2,DIALOG_STYLE_INPUT,"Dutchtopia RP - Register","Fill in your Roleplay lastname:","Next","Back");
            return 1;
        }
        if(!strlen(inputtext) || strlen(inputtext) > 64)
        {
            SendClientMessage(playerid, COLOR_RED, ">> No email adress found or is longer then 64 characters!");
            ShowPlayerDialog(playerid,REGISTER_DIALOG_3,DIALOG_STYLE_INPUT,"Dutchtopia RP - Register","Fill in your email adress:","Finish","Back");
            return 1;
        }
        playerinfo[playerid][email] = inputtext;
       
        new Query[256], playerip[15];
        GetPlayerIp(playerid,playerip,15);
        format(Query, sizeof(Query), "INSERT INTO users (username, password, email, firstname, lastname, regsince, lastlogin, IP) VALUES ('%s', '%s', '%s', '%s', '%s', current_date(), now(), '%s')",playerinfo[playerid][name],playerinfo[playerid][pwhash],playerinfo[playerid][email],playerinfo[playerid][firstname],playerinfo[playerid][lastname],playerip);
        mysql_query(Query); //sends Query to the database
        ShowPlayerDialog(playerid,false,DIALOG_STYLE_MSGBOX,"Dutchtopia RP - Register","Succesfully registered. Enjoy your time in San Fiero!","Finish","");
        playerinfo[playerid][loggedin] = true;
    }
rule 582:
pawn Код:
playerinfo[playerid][email] = inputtext;
playerinfo[playerid][email] is created here:
pawn Код:
enum pinfo
{
    name[MAX_PLAYER_NAME],pwhash[34],money,jailed,loggedin,pm,pfuel,timer1,music,admin,mod,bounty,mysqlid,transfer,
    lastlogin[64],email[128],firstname[64],lastname[64],regsince[64],job,xp,duty,checkpoint,jobdim,IP[16]
};
new playerinfo[MAX_PLAYERS][pinfo];
please can anyone help me out?


Re: little dialog input text problem - iTorran - 14.12.2011

Try

pawn Код:
format(playerinfo[playerid][email], 128, "%s", inputtext);
Might be some better way


Re: little dialog input text problem - SVRP - 14.12.2011

Quote:
Originally Posted by iTorran
Посмотреть сообщение
Try

pawn Код:
format(playerinfo[playerid][email], 128, "%s", inputtext);
Might be some better way
Why would you make it longer when you can simply do:

pawn Код:
format(playerinfo[playerid][email], 128, inputtext);



Re: little dialog input text problem - MasterB - 14.12.2011

Thanks! that did the trick

pawn Код:
format(playerinfo[playerid][email], 128, inputtext);
Didnt know you could use format that way :P


Re: little dialog input text problem - iTorran - 14.12.2011

Quote:
Originally Posted by SVRP
Посмотреть сообщение
Why would you make it longer when you can simply do:

pawn Код:
format(playerinfo[playerid][email], 128, inputtext);
Because i have always done it that way and no one (until now) told me any other way


Re: little dialog input text problem - MasterB - 14.12.2011

Quote:
Originally Posted by iTorran
Посмотреть сообщение
Because i have always done it that way and no one (until now) told me any other way
Well thanks anyways
this helps allot im currently updating and optimizing very old coding and this helps in multiple places.


Re: little dialog input text problem - FireCat - 14.12.2011

Quote:
Originally Posted by MasterB
Посмотреть сообщение
Well thanks anyways
this helps allot im currently updating and optimizing very old coding and this helps in multiple places.
You could use strmid
pawn Код:
strmid(playerinfo[playerid][email], inputtext, 0, strlen(inputtext));
Much more effecient ^^)