Jump to content
  • 0

Probleme la o comanda.


Jason_Statham

Question

Am intampinat probleme la o comanda.

//----------------------------------[SetCrim]-----------------------------------------------
	if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(PlayerInfo[playerid][pDuty] == 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;

				if(IsPlayerConnected(playerid))
				if(PlayerInfo[playerid][pDuty] == 1)
			{
			    SendClientMessage(playerid, COLOR_GREY, "Ai primit wanted de la"(playerid));
			    return 1;
			}
			if(PlayerInfo[playerid][pDBanned] == 1)
			{
			    SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop Duty!");
			    return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (IsACop(playerid) || IsAFreecop(playerid))
			{
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						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_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
							return 1;
						}
						if(IsACop(giveplayerid))
						{
						    if(PlayerInfo[playerid][pRank] >= 6)
						    {
								if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] = 6; }
								else { WantedPoints[giveplayerid]+= 2; }
								SetPlayerCriminalEx(giveplayerid,playerid, result);
							}
							else
							{
							    SendClientMessage(playerid, COLOR_GREY,"* Your rank must be Higher or Equal to 6 to suspect other cops");
							    return 1;
							}
						}
						else if(IsAFreecop(giveplayerid))
						{
							if(PlayerInfo[playerid][pRank] >= 3)
						    {
								if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] = 6; }
								else { WantedPoints[giveplayerid]+= 2; }
								SetPlayerCriminalEx(giveplayerid,playerid, result);
							}
							else
							{
							    SendClientMessage(playerid, COLOR_GREY,"* Your rank must be Higher or Equal to 3 to suspect security guards");
							    return 1;
							}
						}
						else
						{
						    if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] = 6; }
							else { WantedPoints[giveplayerid]+= 2; }
							SetPlayerCriminalEx(giveplayerid,playerid, result);
						}
						new y, m, d;
						new h,mi,s;
						getdate(y,m,d);
						gettime(h,mi,s);
						format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /suspect %s %s",d,m,y,h,mi,s,sendername, giveplayer, (result));
						CommandLog(string);
						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;
		}
		return 1;
	}

	if(strcmp(cmd, "/asuspect", true) == 0 || strcmp(cmd, "/asu", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(PlayerInfo[playerid][pAdmin] < 2)
			{
			    SendClientMessage(playerid, COLOR_GREY, "** You are not Authorized to use This Command!");
			    return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/asu)spect [playerid/PartOfName] [crime discription]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
   				if(giveplayerid != INVALID_PLAYER_ID)
			    {
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));

					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_GRAD2, "USAGE: (/asu)spect [playerid/PartOfName] [crime text]");
						return 1;
					}
					if(WantedPoints[giveplayerid] == 0)
					{
						WantedPoints[giveplayerid] = 6;
					}
					else
					{
						WantedPoints[giveplayerid] = 6;
					}
					SetPlayerCriminalEx(giveplayerid,playerid, result);
					new y, m, d;
					new h,mi,s;
					getdate(y,m,d);
					gettime(h,mi,s);
					format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /asuspect %s %s",d,m,y,h,mi,s,sendername, giveplayer, (result));
					AdminLog(string);
					return 1;
				}
			}
			else
			{
				format(string, sizeof(string), "** %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
				return 1;
			}
		}
		return 1;
	}

E scriptul de la serverul de teste. As dori sa apara textul "Ai primit wanted-ul X de la politistul Y . Motiv : "..."

Iar politistului sa apara : "Ai acordat wanted-ul X playerului Y . Infractiune : "...".

MULTUMESC ANTICIPAT !!!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.