Tag mismatch
#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


Messages In This Thread
Tag mismatch - by Face9000 - 11.05.2012, 23:09
Re: Tag mismatch - by ReneG - 11.05.2012, 23:24
Re: Tag mismatch - by Face9000 - 11.05.2012, 23:31
Re: Tag mismatch - by MP2 - 12.05.2012, 01:17
Re: Tag mismatch - by Kar - 12.05.2012, 02:11
Re: Tag mismatch - by Face9000 - 12.05.2012, 09:28
Re: Tag mismatch - by Face9000 - 12.05.2012, 22:10
Re: Tag mismatch - by ReneG - 12.05.2012, 22:43
Re: Tag mismatch - by Face9000 - 12.05.2012, 23:41
Re: Tag mismatch - by Face9000 - 13.05.2012, 08:20

Forum Jump:


Users browsing this thread: 1 Guest(s)