SA-MP Forums Archive
/tk command 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: /tk command help (/showthread.php?tid=342716)



/tk command help - Face9000 - 14.05.2012

Hello,i've coded this command to issue a ticket to the wanted player:

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 again.");
    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(GetDistanceBetweenPlayers(playerid,ID) < 10)
    {
    new opname[24], pname[24], string[144];
    GetPlayerName(playerid, pname, 24);
    GetPlayerName(ID, opname, 24);
    format(string, sizeof(string), "You have been issued a ticket by %s (%d) - You have been charged $5,000", pname, playerid);
    SendClientMessage(ID, COLOR_BLUE, string);
    format(string, sizeof(string), "You have issued a ticket %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 issued a ticket to %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);
    }
    return 1;
}
But when i compile it,i get 9 warnings of this:

warning 213: tag mismatch

Quote:

C:\Documents and Settings\Symone\Desktop\Cops&Robbers\gamemodes\SF. pwn(3332) : warning 213: tag mismatch
C:\Documents and Settings\Symone\Desktop\Cops&Robbers\gamemodes\SF. pwn(3333) : warning 213: tag mismatch
C:\Documents and Settings\Symone\Desktop\Cops&Robbers\gamemodes\SF. pwn(3337) : warning 213: tag mismatch
C:\Documents and Settings\Symone\Desktop\Cops&Robbers\gamemodes\SF. pwn(3339) : warning 213: tag mismatch
C:\Documents and Settings\Symone\Desktop\Cops&Robbers\gamemodes\SF. pwn(3340) : warning 213: tag mismatch
C:\Documents and Settings\Symone\Desktop\Cops&Robbers\gamemodes\SF. pwn(3347) : warning 213: tag mismatch
C:\Documents and Settings\Symone\Desktop\Cops&Robbers\gamemodes\SF. pwn(3351) : warning 213: tag mismatch
C:\Documents and Settings\Symone\Desktop\Cops&Robbers\gamemodes\SF. pwn(3354) : warning 213: tag mismatch

Line 3332:
pawn Код:
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.");
3333:
pawn Код:
if(GetDistanceBetweenPlayers(playerid,ID) < 10)
3337:
pawn Код:
GetPlayerName(ID, opname, 24);
3339:
pawn Код:
SendClientMessage(ID, COLOR_BLUE, string);
3340:
pawn Код:
format(string, sizeof(string), "You have issued a ticket %s (%d). You have recieved a collection prize of $1500.", opname, ID);
3347:
pawn Код:
format(string, sizeof(string), "%s (%d) has issued a ticket to %s (%d). He is no longer wanted.", pname, playerid, opname, ID);
3351:
pawn Код:
SetPlayerWantedLevel(ID, 0);
3354:
pawn Код:
GivePlayerMoney(ID, -5000);
What's wrong,guys?Thanks.


Re: /tk command help - Faisal_khan - 14.05.2012

Did you defined "ID"?


Re: /tk command help - Jonny5 - 14.05.2012

your sscanf is looking for 2 vars and you only supply 1

pawn Код:
sscanf(params, "ui", ID)
either remove the i specifier or add a var for it to assign to


Re: /tk command help - Mandrakke - 14.05.2012

ID is defined, but it seems to be an array and not an integer.


Re: /tk command help - Jonny5 - 14.05.2012

i dont see it defined inside the code you posted
try to define it in the command and maybe change it to targetID or something else.


Re: /tk command help - Face9000 - 14.05.2012

Fixed,thanks.