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



Little help. - Anzhelov - 18.06.2011

I want to change something in one GM, it's the command suspect, when you /suspec someone he should receive a wanted level. This is the command, what should I do to add wanted level to the person who I am suspecting?
Код:
if(strcmp(cmd, "/suspect", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE2, "[USAGE:] /suspect [playerid] [crime]");
                PlayCrimeReportForPlayer(playerid,0,3);
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
			{
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[128];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_LIGHTBLUE2, "[USAGE:] /suspect [playerid] [crime]");
							return 1;
						}
      					if(CopOnDuty[playerid])
						{
							if(giveplayerid != playerid)
							{
								if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] = 3; }
								else { WantedPoints[giveplayerid]+= 2; }
								format(string, sizeof(string), "You have been suspected by %s, Reason: %s.", GetPlayerNameEx(playerid),result);
								SendClientMessage(giveplayerid, COLOR_RED, string);
								format(string, sizeof(string), "You have suspected %s, Reason: %s.", GetPlayerNameEx(giveplayerid),result);
								SendClientMessage(playerid, COLOR_WHITE, string);
								format(string, sizeof(string), "[SASP] %s has suspected %s, Reason: %s.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid),result);
								SendFactionTypeMessage(1,COLOR_LSPD,string);
								SetWantedLevel(id, 1);
								new location[MAX_ZONE_NAME];
								GetPlayer2DZone(giveplayerid, location, MAX_ZONE_NAME);
								format(string, sizeof(string), "[SASP] All units be on the lookout for %s - Person Last Seen: %s.", GetPlayerNameEx(giveplayerid),location);
								SendFactionTypeMessage(1,COLOR_LSPD,string);
							}
							else
							{
	                            SendClientMessage(playerid, COLOR_LIGHTBLUE2, "You can't suspect yourself!");
							}
						}
      					else
						{
      						SendClientMessage(playerid, COLOR_LIGHTBLUE2, "Your not on cop duty!");
						}
						return 1;
					}
				}
			}