SA-MP Forums Archive
[HELP PLEASE !] Suspect 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 PLEASE !] Suspect command. (/showthread.php?tid=70284)



[HELP PLEASE !] Suspect command. - Hot - 23.03.2009

Код:
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/sus", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {

			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_YELLOW, "USAGE: (/sus)spect [Playerid] [Reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (gTeam[playerid] == 3 )
			{
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
						if (gTeam[giveplayerid] != 3)
						{
							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_YELLOW, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
								return 1;
							}
							if(Wanted[playerid] == 0) { Wanted[playerid] = 3; }
							else { Wanted[giveplayerid]+= 2; }
							return 1;
						}
						else
						{
							SendClientMessage(playerid, COLOR_YELLOW, "  You can't suspect a Cop !");
						}
					}
				}
				else
				{
						format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
						SendClientMessage(playerid, COLOR_YELLOW, string);
						return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_YELLOW, "  You are not a Cop");
			}
		}
		return 1;
	}
Код:
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\WH-RP.pwn(533) : error 017: undefined symbol "ReturnUser"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: [HELP PLEASE !] Suspect command. - Danut - 23.03.2009

http://pastebin.com/f5415e291


Re: [HELP PLEASE !] Suspect command. - Jason_Larson - 23.03.2009

I use this suspect command, and I know this works... feel free to give it a shot

Код:
/----------------------------------[SetCrim]-----------------------------------------------
	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, "USAGE: (/su)spect [playerid/PartOfName] [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, "USAGE: (/su)spect [playerid/PartOfName] [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 Cop / FBI / National Guard !");
			}
		}
		return 1;
	}



Re: [HELP PLEASE !] Suspect command. - Hot - 23.03.2009

But, what it means with your are not on duty ? it's like , you are not a police officer ?

And I don't have OnDuty variable ? should I crate ? But I don't know even what duty means :S



Re: [HELP PLEASE !] Suspect command. - Jason_Larson - 23.03.2009

Quote:
Originally Posted by Hot
But, what it means with your are not on duty ? it's like , you are not a police officer ?
Correct, you must be on duty to use the cop command.... You can change this just remove 'IsACop(playerid)' and you don't have to be on duty to use it....


What script are you using?


Re: [HELP PLEASE !] Suspect command. - Hot - 23.03.2009

I USE a wanted level system , and on one part of the script it says WantedPoints[giveplayerid] . WHAT I DO ?


Re: [HELP PLEASE !] Suspect command. - Jason_Larson - 23.03.2009

Oh so your command would probably be like /wanted?

Depends on how bad you want to give them if someone uses the command....

WantedPoints[playerid]+=2; - will increase by 2
WantedPoints[playerid] = 12; - will set their wanted to 12

Thats two different ways you may see it in your script, depending on how the command is used you may need change 'playerid' to 'giveplayerid' or 'killerid' depends on how you have it setup. There's alot of ways it may show in your script, hopefully this will give you the concept...



This is what I have for if someone robs a Bank
Код:
WantedPoints[playerid] =20; SetPlayerCriminal(playerid,255, "Robbing the BANK!");



Re: [HELP PLEASE !] Suspect command. - Hot - 23.03.2009

No , the command is /suspect, its like , a cop do /suspect and SendClientMessageToAll : Officer "Hot" make "Jason" a suspect for "Robbing bank"

understand ?


Re: [HELP PLEASE !] Suspect command. - Jason_Larson - 23.03.2009

Yeah I understand, although you have the weirdest /suspect I've ever seen....

What script do you use?

I'm not sure what to tell you, maybe one of these masters here can assist you better, sorry


Re: [HELP PLEASE !] Suspect command. - Danut - 23.03.2009

why u don't use my command ? pastebin up


Re: [HELP PLEASE !] Suspect command. - Hot - 23.03.2009

See it, I am using it, when you gave it to me, it had 8 errors, but I fix it, now it has only 1 error.

Код:
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/sus", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {

			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_YELLOW, "USAGE: (/sus)spect [Playerid] [Reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (gTeam[playerid] == 3 )
			{
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
						if (gTeam[giveplayerid] != 3)
						{
							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_YELLOW, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
								return 1;
							}
							if(Wanted[playerid] == 0) { Wanted[playerid] = 3; }
							else { Wanted[giveplayerid]+= 2; }
							return 1;
						}
						else
						{
							SendClientMessage(playerid, COLOR_YELLOW, "  You can't suspect a Cop !");
						}
					}
				}
				else
				{
						format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
						SendClientMessage(playerid, COLOR_YELLOW, string);
						return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_YELLOW, "  You are not a Cop");
			}
		}
		return 1;
	}
Код:
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\WH-RP.pwn(533) : error 017: undefined symbol "ReturnUser"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: [HELP PLEASE !] Suspect command. - Hot - 23.03.2009

SORRY FOR DOUBLE POST, BUT SOMEONE HELP!

Код:
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/sus", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {

			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_YELLOW, "USAGE: (/sus)spect [Playerid] [Reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (gTeam[playerid] == 3 )
			{
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
						if (gTeam[giveplayerid] != 3)
						{
							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_YELLOW, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
								return 1;
							}
							if(Wanted[playerid] == 0) { Wanted[playerid] = 3; }
							else { Wanted[giveplayerid]+= 2; }
							return 1;
						}
						else
						{
							SendClientMessage(playerid, COLOR_YELLOW, "  You can't suspect a Cop !");
						}
					}
				}
				else
				{
						format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
						SendClientMessage(playerid, COLOR_YELLOW, string);
						return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_YELLOW, "  You are not a Cop");
			}
		}
		return 1;
	}
Код:
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\WH-RP.pwn(533) : error 017: undefined symbol "ReturnUser"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: [HELP PLEASE !] Suspect command. - LarzI - 23.03.2009

Get the ReturnUser function by Y_Less