Tiny C
#1

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:
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.
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?
Reply


Messages In This Thread
Tiny C - by Deji - 25.09.2011, 18:30
Re: Tiny C - by Deji - 25.09.2011, 18:44
Re: Tiny C - by Deji - 25.09.2011, 19:13
Re: Tiny C - by dice7 - 25.09.2011, 19:48
Re: Tiny C - by Deji - 25.09.2011, 19:53
Re: Tiny C - by GrimR - 25.09.2011, 19:55
Re: Tiny C - by Deji - 25.09.2011, 20:01
Re: Tiny C - by Deji - 27.09.2011, 21:19
Re: Tiny C - by GrimR - 27.09.2011, 22:54
Re: Tiny C - by GrimR - 28.09.2011, 08:26

Forum Jump:


Users browsing this thread: 2 Guest(s)