/aduty and /adutyoff help
#1

Greetings sa-mp



Today I was doing this simple script and I can not find where is teh error, I was looking for it but I can not find, take a look:

pawn Код:
//==============================================================================

new OnDuty[MAX_PLAYERS];
CMD:aduty(playerid, params[])
{
    if(gPlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1, "SERVER: You are not allowed to use this command");
    {
        new id, string[128];
        if(sscanf(params, "us[128]", id, string))
       
        SetPlayerColor(playerid, 0x00FFFF);
        SetPlayerSkin(playerid, 217);
        SetPlayerHealth(playerid, 0x7F800000);

        format(string, sizeof(string), "ADMIN DUTY: %s is now on duty", GetName(id))
        SendClientMessageToAll(0xFE2E2E, string);
    }
    return 1;
}

CMD:adutyoff(playerid, params[])
{
    if(gPlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1, "SERVER: You are not allowed to use this command");
    {
        new id, string[128];
        if(sscanf(params, "us[128]", id, string))

        format(string, sizeof(string), "ADMIN DUTY: %s is now off duty", GetName(id))
        SendClientMessageToAll(0xFE2E2E, string);

        SetPlayerHealth(playerid, 0.0);
        ForceClassSelection(playerid);
        SetPlayerColor(playerid, -1);
           
        SendClientMessage(playerid, -1, "{FE2E2E}DUTY: Now you are off duty, but you must keep doing it");
    }
    if(OnDuty[playerid] == 0)
    {
        SendClientMessage(playerid, -1, "{FE2E2E}ERROR: You are not on duty mode");
    }
    return 1;
}
And I get this errors:

pawn Код:
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(518) : error 001: expected token: ";", but found "-identifier-"
C:\Users\usuario\Sa-Mp\filterscripts\Commands.pwn(531) : error 001: expected token: ";", but found "-identifier-"
LINES:

pawn Код:
SendClientMessageToAll(0xFE2E2E, string);

SendClientMessageToAll(0xFE2E2E, string);
If anyone can help me.

Regards,
Pablo.
Reply
#2

You never added a semi-colon to the end of the formats.

pawn Код:
new OnDuty[MAX_PLAYERS];
CMD:aduty(playerid, params[])
{
    if(gPlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1, "SERVER: You are not allowed to use this command");
    {
        new id, string[128];
        if(sscanf(params, "us[128]", id, string))
       
        SetPlayerColor(playerid, 0x00FFFF);
        SetPlayerSkin(playerid, 217);
        SetPlayerHealth(playerid, 0x7F800000);

        format(string, sizeof(string), "ADMIN DUTY: %s is now on duty", GetName(id));
        SendClientMessageToAll(0xFE2E2E, string);
    }
    return 1;
}

CMD:adutyoff(playerid, params[])
{
    if(gPlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1, "SERVER: You are not allowed to use this command");
    {
        new id, string[128];
        if(sscanf(params, "us[128]", id, string))

        format(string, sizeof(string), "ADMIN DUTY: %s is now off duty", GetName(id));
        SendClientMessageToAll(0xFE2E2E, string);

        SetPlayerHealth(playerid, 0.0);
        ForceClassSelection(playerid);
        SetPlayerColor(playerid, -1);
           
        SendClientMessage(playerid, -1, "{FE2E2E}DUTY: Now you are off duty, but you must keep doing it");
    }
    if(OnDuty[playerid] == 0)
    {
        SendClientMessage(playerid, -1, "{FE2E2E}ERROR: You are not on duty mode");
    }
    return 1;
}
Reply
#3

You forgot a semicolon ; at the end of format function.
pawn Код:
format(string, sizeof(string), "ADMIN DUTY: %s is now on duty", GetName(id));
SendClientMessageToAll(0xFE2E2E, string);
pawn Код:
format(string, sizeof(string), "ADMIN DUTY: %s is now off duty", GetName(id));
SendClientMessageToAll(0xFE2E2E, string);
Reply
#4

Thanks for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)