SA-MP Forums Archive
/badge doesn't wanna compile - 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: /badge doesn't wanna compile (/showthread.php?tid=352381)



/badge doesn't wanna compile - Stefand - 19.06.2012

pawn Код:
command(badge, playerid, params[])
{
    new id, string[128];
    if(sscanf(params, "u", id))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /badge [playerid]");
    }
    else
    {
        if(Groups[Player[playerid][Group]][CommandTypes] == 1)
        {
                if(GetDistanceBetweenPlayers(playerid, id) < 7)
                {
                    format(string, sizeof(string), "* %s has showed his/her badge to %s.", GetName(playerid), GetName(id));
                    NearByMessage(playerid, NICESKY, string);
                    format(string, sizeof(string), "You have shown your badge to %s.", GetName(id));
                    SendClientMessage(playerid, WHITE, string);
                    format(string, sizeof(string), "---------[LEO Badge]---------", GetName(playerid));
                    SendClientMessage(id, COLOR_ORANGE, string);
                    format(string, sizeof(string), "%s is an offical LEO", GetName(playerid));
                    SendClientMessage(id, COLOR_NBLUE, string);
                    format(string, sizeof(string), "---------[LEO Badge]---------", GetName(playerid));
                    SendClientMessage(id, COLOR_ORANGE, string);
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "You're too far away!");
                }
            }
        }
        else
        {
            if(Groups[Player[playerid][Group]][CommandTypes] == 4)
            {
                if(GetDistanceBetweenPlayers(playerid, id) < 7)
                {
                    format(string, sizeof(string), "* %s has showed his/her badge to %s.", GetName(playerid), GetName(id));
                    NearByMessage(playerid, NICESKY, string);
                    format(string, sizeof(string), "You have shown your badge to %s.", GetName(id));
                    SendClientMessage(playerid, WHITE, string);
                    format(string, sizeof(string), "---------[GOVERNMENT Badge]---------", GetName(playerid));
                    SendClientMessage(id, COLOR_ORANGE, string);
                    format(string, sizeof(string), "%s is an offical Government employee.", GetName(playerid));
                    SendClientMessage(id, COLOR_NBLUE, string);
                    format(string, sizeof(string), "---------[GOVERNMENT Badge]---------", GetName(playerid));
                    SendClientMessage(id, COLOR_ORANGE, string);
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "You're too far away!");
                }
            }
        }
    return 1;
}
pawn Код:
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(16171) : warning 217: loose indentation
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(16171) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(16194) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: /badge doesn't wanna compile - Kindred - 19.06.2012

pawn Код:
command(badge, playerid, params[])
{
    new id, string[128];
    if(sscanf(params, "u", id))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /badge [playerid]");
    }
    else
    {
        if(Groups[Player[playerid][Group]][CommandTypes] == 1)
        {
            if(GetDistanceBetweenPlayers(playerid, id) < 7)
            {
                 format(string, sizeof(string), "* %s has showed his/her badge to %s.", GetName(playerid), GetName(id));
                 NearByMessage(playerid, NICESKY, string);
                 format(string, sizeof(string), "You have shown your badge to %s.", GetName(id));
                 SendClientMessage(playerid, WHITE, string);
                 format(string, sizeof(string), "---------[LEO Badge]---------", GetName(playerid));
                 SendClientMessage(id, COLOR_ORANGE, string);
                 format(string, sizeof(string), "%s is an offical LEO", GetName(playerid));
                 SendClientMessage(id, COLOR_NBLUE, string);
                 format(string, sizeof(string), "---------[LEO Badge]---------", GetName(playerid));
                 SendClientMessage(id, COLOR_ORANGE, string);
            }
            else
            {
                SendClientMessage(playerid, WHITE, "You're too far away!");
            }
        }
        else
        {
            if(Groups[Player[playerid][Group]][CommandTypes] == 4)
            {
                if(GetDistanceBetweenPlayers(playerid, id) < 7)
                {
                    format(string, sizeof(string), "* %s has showed his/her badge to %s.", GetName(playerid), GetName(id));
                    NearByMessage(playerid, NICESKY, string);
                    format(string, sizeof(string), "You have shown your badge to %s.", GetName(id));
                    SendClientMessage(playerid, WHITE, string);
                    format(string, sizeof(string), "---------[GOVERNMENT Badge]---------", GetName(playerid));
                    SendClientMessage(id, COLOR_ORANGE, string);
                    format(string, sizeof(string), "%s is an offical Government employee.", GetName(playerid));
                    SendClientMessage(id, COLOR_NBLUE, string);
                    format(string, sizeof(string), "---------[GOVERNMENT Badge]---------", GetName(playerid));
                    SendClientMessage(id, COLOR_ORANGE, string);
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "You're too far away!");
                }
            }
        }
    }
    return 1;
}
Try now, you had an extra end bracket and then forgot an end bracket.

If you get more errors, tell me the lines of the errors so I can fix them.


Re: /badge doesn't wanna compile - Stefand - 19.06.2012

Gonna test now, no errors so far