SA-MP Forums Archive
inputtext or something... - 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: inputtext or something... (/showthread.php?tid=542292)



inputtext or something... - finelaq - 18.10.2014

Hi sa-mp forum!

I have problem with inputtext or something!

I don't know how to explain this...

pawn Код:
AccountData[playerid][szEmail] == inputtext;
Код:
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\freeroam.pwn(237) : error 033: array must be indexed (variable "inputtext")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
And then i want
pawn Код:
format(szQuery, sizeof(szQuery), "INSERT INTO `accounts` (email) VALUES ('%s')", AccountData[playerid][szEmail]);
mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
How to get this work?


Re: inputtext or something... - Ox1gEN - 18.10.2014

AccountData[playerid][szEmail][STRING-SIZE-FOR-THIS] = inputtext[SAME-STRING-SIZE];


Re: inputtext or something... - zaibaslr2 - 18.10.2014

You can use
variable = something;
for integers and floats, for strings you have to use format:

format(AccountData[playerid][szEmail],sizeof(AccountData[playerid][szEmail]),"%s",inputtext);


Re: inputtext or something... - finelaq - 19.10.2014

Quote:
Originally Posted by zaibaslr2
Посмотреть сообщение
You can use
variable = something;
for integers and floats, for strings you have to use format:

format(AccountData[playerid][szEmail],sizeof(AccountData[playerid][szEmail]),"%s",inputtext);
I get errors:
Код:
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : error 001: expected token: "]", but found "-identifier-"
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : warning 215: expression has no effect
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : error 001: expected token: ";", but found "]"
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : error 029: invalid expression, assumed zero
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
I don't understand how i can save email in to database...

I can do like this if i want and it works:
pawn Код:
format(szQuery, sizeof(szQuery), "INSERT INTO `accounts` (email) VALUES ('%s')", inputtext);
mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
But i don't want that.


Re: inputtext or something... - zaibaslr2 - 19.10.2014

Quote:
Originally Posted by finelaq
Посмотреть сообщение
I get errors:
Код:
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : error 001: expected token: "]", but found "-identifier-"
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : warning 215: expression has no effect
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : error 001: expected token: ";", but found "]"
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : error 029: invalid expression, assumed zero
C:\Users\Monster\Desktop\samp03z_svr_R1_win32\gamemodes\efs.pwn(237) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
I don't understand how i can save email in to database...

I can do like this if i want and it works:
pawn Код:
format(szQuery, sizeof(szQuery), "INSERT INTO `accounts` (email) VALUES ('%s')", inputtext);
mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
But i don't want that.
Please try

Код:
format(AccountData[playerid][szEmail],100,"%s",inputtext);



Re: inputtext or something... - 0x41726d79 - 19.10.2014

AccountData[playerid][szEmail] == inputtext;

== is for check.
= is to set.

pawn Код:
format ( AccountData[playerid][szEmail], sizeof ( AccountData[playerid][szEmail] ), "%s", inputtext);