SA-MP Forums Archive
Help with command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with command (/showthread.php?tid=127218)



Help with command - DokerJr - 12.02.2010

Quote:

if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
if(IsPlayerConnected(playerid))
{
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);
if (gTeam[playerid] == 2 || IsACop(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
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;
}
if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] = 3; }
else { WantedPoints[giveplayerid]+= 2; }
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;
}

How to add to this command: /suspect [id] [crime] [wanted level]

I am post here because nobody answer me in Godfather post


Re: Help with command - MadeMan - 12.02.2010

This is /suspect [id] [wanted level] [crime]

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;
}



Re: Help with command - LiDeRu`s - 13.02.2010

Unfortunately, this command gives four error
the error are these ....

pawn Код:
D:\s\gamemodes\LSRP.pwn(10639) : error 001: expected token: ")", but found ""
D:\s\gamemodes\LSRP.pwn(10639) : error 029: invalid expression, assumed zero
D:\s\gamemodes\LSRP.pwn(10639) : error 029: invalid expression, assumed zero
D:\s\gamemodes\LSRP.pwn(10639) : 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.



Re: Help with command - MadeMan - 13.02.2010

And the line with these errors?


Re: Help with command - LiDeRu`s - 13.02.2010

pawn Код:
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1 )
This is line with the error