SA-MP Forums Archive
/aduty and /adutyoff help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /aduty and /adutyoff help (/showthread.php?tid=463745)



/aduty and /adutyoff help - PabloDiCostanzo - 13.09.2013

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.


Re: /aduty and /adutyoff help - EiresJason - 13.09.2013

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;
}



Re: /aduty and /adutyoff help - Konstantinos - 13.09.2013

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);



Respuesta: /aduty and /adutyoff help - PabloDiCostanzo - 13.09.2013

Thanks for your help