Tag mismatch
#1

Hello,i've this ticket command come:

pawn Код:
CMD:tk(playerid, params[])
{
    if(gTeam[playerid] != TEAM_COP) return 0;
    if(sscanf(params, "ui", ID)) SendClientMessage(playerid, COLOR_WHITE, "USAGE: /tk <playerid> / <PlayerName>");
    if(GetPVarInt(playerid,"TkTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"Please wait 5 seconds before issuing a ticket again.");
    if(GetDistanceBetweenPlayers(playerid,ID) < 10)
    {
    new pwl = GetPlayerWantedLevel(playerid);
    new opname[24];
    new pname[24];
    new string[120];
    GetPlayerName(playerid, pname, 24);
    if(pwl >= 4) return SendClientMessage(playerid, red, "This suspect has more than 4 wanted level,you can't issue a ticket to him.Use /ar instead.");
    GetPlayerName(ID, opname, 24);
    format(string, 120, "You have been fined by %s(%d) - You have been charged $5,000", pname, playerid);
    SendClientMessage(ID, COLOR_BLUE, string);
    format(string, 120, "You have fined %s (%d). You have recieved a collection prize of 1500$.", opname, ID);
    SendClientMessage(playerid, COLOR_BLUE, string);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
    if(!IsPlayerConnected(i))continue;
    if(gTeam[i] == TEAM_COP)
    {
    new copmsg[170];
    format(copmsg, sizeof(copmsg), "%s (%d) has fined %s (%d).He is no longer wanted.",pname, playerid, opname, ID);
    SendClientMessage(i, COLOR_BLUE, copmsg);
    }
    }
    SetPlayerWantedLevel(ID, 0);
    SetPlayerScore(playerid, 1);
    GivePlayerMoney(playerid, 1500);
    GivePlayerMoney(ID, -5000);
    }
    return 1;
}
But i got tag mismatch warning at most whole of it.What's wrong?
Reply
#2

Post the exact lines. No one wants to fish through that un-indented code.
Reply
#3

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
Post the exact lines. No no one wants to fish through that un-indented code.
"i got tag mismatch warning at most whole of it."

^

The tag mismatch starts from

pawn Код:
{
    if(gTeam[playerid] != TEAM_COP) return 0;
To:

pawn Код:
GivePlayerMoney(ID, -5000);
    }
That's why i dont posted the exact lines.
Reply
#4

1. Indent.
2. Comment on which lines the errors are on
3. Indent.
Reply
#5

Mistakes:

ui for sscanf? with only 1 ID?
GetPlayerWantedLevel used on the cop and not the tk'ee
170 string length on copmsg, 144 is max Client Message length
Setting the tk'ers score to 1 instead of adding 1
what is 1500$? isn't it $1500
Instead of creating a new copmsg string, just reuse string and set string's length to 144 (max) (144 is not even needed in this case, it could be lower)
You forgot to set TkTime PVar (use gettime rather, since GetTickCount has problems after 24 hours)

pawn Код:
CMD:tk(playerid, params[])
{
    if(gTeam[playerid] != TEAM_COP) return 0;
    if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /tk <playerid> / <PlayerName>");
    if(GetPlayerWantedLevel(ID) >= 4) return SendClientMessage(playerid, red, "This suspect has more than 4 wanted level,you can't issue a ticket to him.Use /ar instead.");
    if(GetPVarInt(playerid, "TkTime") > gettime()) return SendClientMessage(playerid, 0xFF0000FF, "Please wait 5 seconds before issuing a ticket again.");
    if(GetDistanceBetweenPlayers(playerid, ID) > 10.0) return 0;

    new opname[24], pname[24], string[144];
    GetPlayerName(playerid, pname, 24);
    GetPlayerName(ID, opname, 24);
    format(string, sizeof(string), "You have been fined by %s (%d) - You have been charged $5,000", pname, playerid);
    SendClientMessage(ID, COLOR_BLUE, string);
    format(string, sizeof(string), "You have fined %s (%d). You have recieved a collection prize of $1500.", opname, ID);
    SendClientMessage(playerid, COLOR_BLUE, string);
    for(new i = 0; i != MAX_PLAYERS; ++i)
    {
        if(!IsPlayerConnected(i))continue;
        if(gTeam[i] == TEAM_COP)
        {
            format(string, sizeof(string), "%s (%d) has fined %s (%d). He is no longer wanted.", pname, playerid, opname, ID);
            SendClientMessage(i, COLOR_BLUE, string);
        }
    }
    SetPlayerWantedLevel(ID, 0);
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
    GivePlayerMoney(playerid, 1500);
    GivePlayerMoney(ID, -5000);
    SetPVarInt(playerid, "TkTime", gettime() + 5); //5 = 5 seconds
    return 1;
}
Reply
#6

Anyone wanna say again indent??

My code is indented,is the forum that shit-paste the code!

The tag mismatch i gets on EVERY SINGLE LINE OF THAT COMMAND,so why i should show the lines when the error is?

The tag mismatch is at the WHOLE CODE (ALL LINES).
Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
I'll say it again. Indent your code! It doesn't really matter WHY it is poorely indented, the point is it is. And that does not look like indented code ported to the forums as there are certain patterns that aren't showing up there.
Man if you're going to help me,i'll appreciate it,but i can't indent more than this! The forums keep resetting to original indent! Just try to help me.
Reply
#8

You copy all the code straight from Pawno.

Go to the post, type
PHP код:
[pawn] [/pawn
and paste the code between those tags.
Reply
#9

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
You copy all the code straight from Pawno.

Go to the post, type
PHP код:
[pawn] [/pawn
and paste the code between those tags.
What the fuck?Is what i've done! Why you guys dont look at identation and just help me??

IT'S THE SAMP FORUM THAT KEEPS RESETTING TO A BAD IDENTATION,NOT MY CODE! MY CODE IS INDENTED CORRECTLY!
Reply
#10

Bump,still waiting a normal answer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)