/suspect - 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: /suspect (
/showthread.php?tid=349957)
/suspect -
trulis - 10.06.2012
How i can make this /suspect command so a cop can set the wanted levels a players gets this way (/su)spect [playerid/PartOfName] [crime text] [wanted levels]. I want the command to add the wanted levels to the current wanted level the player has.
pawn Code:
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (IsACop(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(!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_GREY, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
return 1;
}
WantedPoints[giveplayerid] += 2;
SetPlayerCriminal(giveplayerid,playerid, result);
format(string, 256, "Wanted Bot: %s i-a dat lui %s Wanted pentru motivul %s",sendername, giveplayer, result);
ABroadCast(COLOR_YELLOW,string,1);
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 Police Departament,Federal Bureau Of Investigations or National Guard !");
}
}
return 1;
}
Re: /suspect -
trulis - 11.06.2012
Someone please ?
Re: /suspect -
Cxnnor - 11.06.2012
pawn Code:
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam == TEAM_COPS)
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(gTeam == TEAM_COPS)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(gTeam == TEAM_COPS)
{
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_GREY, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
return 1;
}
WantedPoints[giveplayerid] += 2;
SetPlayerCriminal(giveplayerid,playerid, result);
format(string, 256, "Wanted Bot: %s i-a dat lui %s Wanted pentru motivul %s",sendername, giveplayer, result);
ABroadCast(COLOR_YELLOW,string,1);
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 Police Departament,Federal Bureau Of Investigations or National Guard !");
}
}
return 1;
}
Removed:
Added:
Hope it works, any more troubles then reply.
Re: /suspect -
trulis - 11.06.2012
The command works, i just want that the syntax is this: /suspect [playerid/parofname][crime text][wanted levels] and this command to add the wanted levels to the current wanted level.