Hallo Leute,
Ich habe ein kleines Problem mit dem /su befehl:
Wenn ein cop den befehl 1 mal eingibt, bekommt der gesuchte manchaml 1 und machmal 2 wanteds. Hier der PWN-Code:
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, " Du bist nicht im Dienst !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "BENUTZUNG: (/su)spect [playerid/Name] [Verbrechen]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (gTeam[playerid] == 2 || IsACop(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (gTeam[giveplayerid] != 2 && !IsACop(giveplayerid))
{
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, "BENUTZUNG: (/su)spect [playerid/Name] [Verbrechen]");
return 1;
}
if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] = 2; }
else { WantedPoints[giveplayerid]+= 2; }
SetPlayerCriminal(giveplayerid,playerid, result);
WantedLevel[giveplayerid]++;
SetPlayerWantedLevel(giveplayerid,WantedLevel[giveplayerid]);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Du kannst keinen Polizisten anklagen !");
}
}
}
else
{
format(string, sizeof(string), " %d ist kein aktiver Spieler.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Du bist kein Polizist !");
}
}
return 1;
}