25.09.2011, 18:30
Okay, I've done a lot of programming in C/C++, so using Pawn now is a bit baffling. I have a few questions in about how things can be done. At the moment I just can't figure out how to 'pass a string' as part of an array for the MySQL plugin I'm using.
Here's my mysql_query code, which is part of my registration system:
I assume the problem is that inputtext is a string, so it obviously can't be passed in an array as such.
Does Pawn have support for pointers and if so, how are they made? If not, how should I pass the string?
Here's my mysql_query code, which is part of my registration system:
pawn Код:
case DIALOG_Register:
{
if(response)
{
if(isnull(inputtext))
{
return SendClientMessage(playerid, COLOUR_Mistake, MSG_RegHelp);
}
if(strlen(inputtext)<3)
{
return SendClientMessage(playerid, COLOUR_Mistake, MSG_ErrorReg1);
}
GetPlayerName(playerid, playerInfo[playerid][pName], MAX_PLAYER_NAME);
new query[256];
format(query, 40+MAX_PLAYER_NAME, "SELECT name FROM users WHERE name='%s' LIMIT 1", playerInfo[playerid][pName]);
mysql_query(query, QUERY_checkUserNotExist, {playerid, inputtext}); // <<<
return 1;
}
else
{
ShowPlayerDialog(playerid, DIALOG_ChangeNick, 1, MSG_ChangeName, MSG_NewNickDialog, "Change", "Cancel");
}
}
Код:
***.pwn(601) : error 008: must be a constant expression; assumed zero Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
Does Pawn have support for pointers and if so, how are they made? If not, how should I pass the string?