Function error
#1

pawn Код:
stock SetAdminDuty(playerid, state)
{
    switch(state)
    {
        case 1:
        {
            OnDuty[playerid] = 1;
           
            SetPlayerHealth(playerid, FLOAT_INFINITY);
           
            SCMTAEX(COLOR_YELLOW, "» %s (%d) is now on duty.", ReturnPlayerName(playerid), playerid);

            SetPlayerColor(playerid, COLOR_YELLOW);
        }
       
        case 0:
        {
            OnDuty[playerid] = 0;
           
            SetPlayerHealth(playerid, MAX_HEALTH);
           
            SCMTAEX(COLOR_YELLOW, "» %s (%d) is now off duty.", ReturnPlayerName(playerid), playerid);
           
            new col = random(sizeof (PlayerColors));
            SetPlayerColor(playerid, PlayerColors[col]);
        }
    }
}
In the /duty cmd:

pawn Код:
switch(OnDuty[playerid])
    {
        case 0: SetAdminDuty(playerid, 1); //Admin duty is off, enable it...
        case 1: SetAdminDuty(playerid, 0); //Admin duty is on, disable it...
    }
Getting this errors:

Quote:

error 010: invalid function or declaration
error 001: expected token: "-identifier-", but found ")"
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition

Reply
#2

So what i have to do?
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
Name it something else, like `isOn`. Also, why are you using `switch` for true/false, and not using `bool:`? And `SCMTAEX` is the worst function name I've ever seen. Most functions should include at least a verb and a noun to tell you what they're operating on and what they're doing with it. That tells you nothing.
Ok i'll nominate them.

About SCMATEX means SendClientMessageEx, it's just a macro to abbreviate it. And i know what they're operating and what they do, no problem.
Reply
#4

Ah ok you're right then, next time i'll explain. But i think seems clear what SCMTAEX does. (Sends a formatted message).

However i fixed, you can close this topic.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)