An issue with #define
#1

Recently i found one of my old defines that allowed the script (or via command) to work out a percent age,
but its giving me an error (not sure why).

Error: C:\Users\----\Documents\-----\----\---\script.pwn(1525) : warning 236: unknown parameter in substitution (incorrect #define pattern)


pawn Код:
COMMAND:percentage(playerid, params[], amount, percentage)
{
    if(IsPlayerConnected(playerid))
    {
        if(HasCharacterSpawned[playerid])
        {  
            if(AccountInfo[playerid][AccountStaffRank] > 0)
            {
                new tmpstr[1000];
                new value;
                value = WorkOutPercentage(amount, percentage);

            }
        } else CreateErrorMessage(playerid, "You must be spawned as one of your characters to use this command.");
    }
    return true;
}
Reply
#2

Don't use amount and percentage as parameters in COMMAND.
Reply
#3

Quote:
Originally Posted by kamiliuxliuxliux
Посмотреть сообщение
Don't use amount and percentage as parameters in COMMAND.
That's not the issue, and has nothing to do with it (it would not effect the command in any way), So please don't reply to a thread if you have no clue on what you're talking about.

Example: This works perfectly fine, so proves you wrong.
pawn Код:
COMMAND:factioninfo(playerid,params[], factioninfo)
Reply
#4

USE sscanf.
Reply
#5

Quote:
Originally Posted by Dziugsas
Посмотреть сообщение
USE sscanf.
Again not the issue, and that you for point that out (forgot to add it). As you can see its a define issue.
pawn Код:
warning 236: unknown parameter in substitution (incorrect #define pattern)
Reply
#6

COMMANDercentage(playerid, params[], amount, percentage) this is the line where you get warning?
Reply
#7

If you use ZCMD, then you shouldn't use other arguments as kamiliuxliuxliux said because the include calls the cmd_... with 2 arguments only (playerid and params).

Anyways, the problem is with the #define pattern and not at the line is used. For example, doing:
pawn Код:
#define WorkOutPercentage(%0, %1) ... SOMETHING HERE ...
will give that warning because you cannot use space at the first part. The correct would be:
pawn Код:
#define WorkOutPercentage(%0,%1) ... SOMETHING HERE ...
Reply
#8

Quote:
Originally Posted by Dziugsas
Посмотреть сообщение
COMMANDercentage(playerid, params[], amount, percentage) this is the line where you get warning?
Correction it isthis line; 1525


Again proving its this issue.



Note: If you're planning on reply to this thread please actually READ the topic first.
Error: warning 236: unknown parameter in substitution You know this? that's what the thread is about. --> (incorrect #define pattern) <-- You know this? that's what the thread is about.


Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
If you use ZCMD, then you shouldn't use other arguments as kamiliuxliuxliux said because the include calls the cmd_... with 2 arguments only (playerid and params).

Anyways, the problem is with the #define pattern and not at the line is used. For example, doing:
pawn Код:
#define WorkOutPercentage(%0, %1) ... SOMETHING HERE ...
will give that warning because you cannot use space at the first part. The correct would be:
pawn Код:
#define WorkOutPercentage(%0,%1) ... SOMETHING HERE ...
At-least someone helped out, and nothing else if the problem. +1 Repped.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)