Problem /suspect command
#1

How to do the following command work?
if an error compliant gives me something I can help this to be functioning?

pawn Код:
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
    if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1 )
    {
        SendClientMessage(playerid, COLOR_GREY, " You are not on Duty!");
        return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR_GRAD2, "MESAJ: (/su)spect [ Name / Id ] [crime discription]");
        return 1;
    }
    giveplayerid = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR_GRAD2, "MESAJ: (/su)spect [ Name / Id ] [crime discription]");
        return 1;
    }
    new wantedlevel = strval(tmp);
    if (gTeam[playerid] == 2 || IsACop(playerid))
    {
        if(IsPlayerConnected(giveplayerid))
        {
            if (gTeam[giveplayerid] != 2)
            {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[64];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "MESAJ: (/su)spect [ Name / Id ] [crime text]");
                    return 1;
                }
                WantedPoints[giveplayerid] += wantedlevel;
                SetPlayerCriminal(giveplayerid,playerid, result);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, " You can't suspect a Cop !");
            }
        }
        else
        {
            format(string, sizeof(string), " %d is not an active player.", giveplayerid);
            SendClientMessage(playerid, COLOR_GRAD1, string);
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD2, " You are not a PD/FBI/NG");
    }
    return 1;
}
Reply
#2

help me please
Reply
#3

help me please "!!!!!!
Reply
#4

Tell the error.
Reply
#5

pawn Код:
C:\Documents and Settings\LiDeRu\Desktop\Necesar\Server SAMP\gamemodes\LSRP.pwn(13604) : error 001: expected token: ")", but found ""
C:\Documents and Settings\LiDeRu\Desktop\Necesar\Server SAMP\gamemodes\LSRP.pwn(13604) : error 029: invalid expression, assumed zero
C:\Documents and Settings\LiDeRu\Desktop\Necesar\Server SAMP\gamemodes\LSRP.pwn(13604) : error 029: invalid expression, assumed zero
C:\Documents and Settings\LiDeRu\Desktop\Necesar\Server SAMP\gamemodes\LSRP.pwn(13604) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

post the line 13604
Reply
#7


You forgot one ")" because you have to close each bracket.

Correct: (( ))
Wrong: (( )

Hope you see what I mean.



This should work!:
pawn Код:
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
    if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1 )
    {
        SendClientMessage(playerid, COLOR_GREY, " You are not on Duty!");
        return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR_GRAD2, "MESAJ: (/su)spect [ Name / Id ] [crime discription]");
        return 1;
    }
    giveplayerid = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR_GRAD2, "MESAJ: (/su)spect [ Name / Id ] [crime discription]");
        return 1;
    }
    new wantedlevel = strval(tmp);
    if (gTeam[playerid] == 2 || IsACop(playerid))
    {
        if(IsPlayerConnected(giveplayerid))
        {
            if (gTeam[giveplayerid] != 2)
            {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[64];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "MESAJ: (/su)spect [ Name / Id ] [crime text]");
                    return 1;
                }
                WantedPoints[giveplayerid] += wantedlevel;
                SetPlayerCriminal(giveplayerid,playerid, result);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, " You can't suspect a Cop !");
            }
        }
        else
        {
            format(string, sizeof(string), " %d is not an active player.", giveplayerid);
            SendClientMessage(playerid, COLOR_GRAD1, string);
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD2, " You are not a PD/FBI/NG");
    }
    return 1;
}
[/quote]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)