Market problem [argument type mismatch]
#1

So, here I am trying to create a market. People should be able to create a market by typing a CMD, it would then insert the info into MySQL and load through MySQL. However I keep getting errors when making the test cmd to check if its working. Here's the code:


The admin test CMD to create the market:
pawn Код:
CMD:createibay(playerid, params[])
{
    static
        id = -1,
        headline[32],
        message[230];

    if (PlayerData[playerid][pAdmin] < 5 && !PlayerData[playerid][pFactionMod])
        return SendErrorMessage(playerid, "You don't have permission to use this command.");

    if (sscanf(params, "ds[32]", headline, message))
    {
        SendSyntaxMessage(playerid, "/createibay [headline] [message]");
        return 1;
    }

    id = IBay_Create(playerid, headline, message);   //Line 32927

    if (id == -1)
        return SendErrorMessage(playerid, "The server has reached the limit for IBay markets.");

    SendServerMessage(playerid, "You have successfully created IBay ID: %d.", id);
    return 1;
}
The IBay_Create
pawn Код:
IBay_Create(playerid, headline, message)
{
    {
        for (new i = 0; i != MAX_IBAY; i ++)
        {
            if (!IBayData[i][ibExists])
            {
                IBayData[i][ibExists] = true;
                IBayData[i][ibOwner] = 1;

                format(IBayData[i][ibHeadline], 32, headline);  //Line 8470
                format(IBayData[i][ibMessage], 230, message);    //Line 8471

                IBay_Save(i);
                mysql_function_query(g_iHandle, "INSERT INTO `ibay` (`ibOwner`) VALUES(1)", false, "OnIBayCreated", "d", i);
                return i;
            }
        }
    }
    return -1;
}
The errors:
pawn Код:
C:\Users\Test\Desktop\roleplay.pwn(8470) : error 035: argument type mismatch (argument 3)
C:\Users\Test\Desktop\roleplay.pwn(8471) : error 035: argument type mismatch (argument 3)
C:\Users\Test\Desktop\roleplay.pwn(8460) : warning 203: symbol is never used: "message"
C:\Users\Test\Desktop\roleplay.pwn(8460) : warning 203: symbol is never used: "headline"
C:\Users\Test\Desktop\roleplay.pwn(8460) : warning 203: symbol is never used: "playerid"
C:\Users\Test\Desktop\roleplay.pwn(32927) : error 035: argument type mismatch (argument 2)
Reply
#2

First,where is the errors line? And for warnings,add this anywhere:
Код:
#pragma unused message,headline,playerid
Reply
#3

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
First,where is the errors line? And for warnings,add this anywhere:
Код:
#pragma unused message,headline,playerid
Omg no no no no !

So, the 3th parameter of format is string.
Reply
#4

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
First,where is the errors line? And for warnings,add this anywhere:
Код:
#pragma unused message,headline,playerid
First error is on IBay_Create

The last two is under the cmd:createibay
pawn Код:
id = IBay_Create(playerid, headline, message);   //Line 32927

                format(IBayData[i][ibHeadline], 32, headline);    //Line 8470
                            format(IBayData[i][ibMessage], 230, message);  //Line 8471
Reply
#5

Hello!

Try this:

PHP код:
IBay_Create(playeridheadline[], message[])
{
    {
        for (new 
0!= MAX_IBAY++)
        {
            if (!
IBayData[i][ibExists])
            {
                
IBayData[i][ibExists] = true;
                
IBayData[i][ibOwner] = 1;
                
format(IBayData[i][ibHeadline], 32headline);  //Line 8470
                
format(IBayData[i][ibMessage], 230message);    //Line 8471
                
IBay_Save(i);
                
mysql_function_query(g_iHandle"INSERT INTO `ibay` (`ibOwner`) VALUES(1)"false"OnIBayCreated""d"i);
                return 
i;
            }
        }
    }
    return -
1;

Reply
#6

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

Try this:

PHP код:
IBay_Create(playeridheadline[], message[])
{
    {
        for (new 
0!= MAX_IBAY++)
        {
            if (!
IBayData[i][ibExists])
            {
                
IBayData[i][ibExists] = true;
                
IBayData[i][ibOwner] = 1;
                
format(IBayData[i][ibHeadline], 32headline);  //Line 8470
                
format(IBayData[i][ibMessage], 230message);    //Line 8471
                
IBay_Save(i);
                
mysql_function_query(g_iHandle"INSERT INTO `ibay` (`ibOwner`) VALUES(1)"false"OnIBayCreated""d"i);
                return 
i;
            }
        }
    }
    return -
1;

Wow, thanks bro. Works like a charm
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)