Jump to content
  • 0

eroare comanda /arrest


capetanos

Question

Nick:capetanos

Problema: imi da eroare la comanda /arrest

Erori / warnings:D:\R2P.V.1.0\gamemodes\CG.pwn(61152) : error 017: undefined symbol "PlayerData"

D:\R2P.V.1.0\gamemodes\CG.pwn(61152) : warning 215: expression has no effect

D:\R2P.V.1.0\gamemodes\CG.pwn(61152) : error 001: expected token: ";", but found "]"

D:\R2P.V.1.0\gamemodes\CG.pwn(61152) : error 029: invalid expression, assumed zero

D:\R2P.V.1.0\gamemodes\CG.pwn(61152) : fatal error 107: too many error messages on one line

Lini/script: if(OnDuty[playerid] != 1 && PlayerData[playerid][pMember] == 1)

Ai incercat sa rezolvi singur ?:da da nu imi iese

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

Poftim comanda mea de pe propriul gm

if(strcmp(cmd, "/arrest", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	   	{
			if(IsACop(playerid))
			{
				if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
				{
				    SendClientMessage(playerid, COLOR_GREY, "Nu esti ON Duty!");
				    return 1;
				}
		        if(!PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391) || !PlayerToPoint(6.0, playerid, 1529.4773,-1680.2808,5.8906))
				{// Jail spot
				    SendClientMessage(playerid, COLOR_GREY, "Nu esti langa jail, nu poti aresta!");
				    return 1;
				}
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Tasteaza: /arrest [pret] [time (minute)] [bail (0=no 1=yes)] [bailprice]");
					return 1;
				}
    			moneys = strval(tmp);
				if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, "   Jail Price can't be below $1 or above $99999 !"); return 1; }
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Tasteaza: /arrest [pret] [time (minute)] [bail (0=no 1=yes)] [bailprice]");
					return 1;
				}
				new time = strval(tmp);
				if(time < 1 || time > 20) { SendClientMessage(playerid, COLOR_GREY, "   Jail Time Minutes can't be below 1 or above 20 (Take the person to prison then) !"); return 1; }
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Tasteaza: /arrest [pret] [time (minute)] [bail (0=no 1=yes)] [bailprice]");
					return 1;
				}
				new bail = strval(tmp);
				if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, "   Jail Bailing can't be below 0 or above 1 !"); return 1; }
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Tasteaza: /arrest [pret] [time (minute)] [bail (0=no 1=yes)] [bailprice]");
					return 1;
				}
				new bailprice = strval(tmp);
				if(bailprice < 0 || bailprice > 3000000) { SendClientMessage(playerid, COLOR_GREY, "   Jail Bailing can't be below $0 or above $3000000 !"); return 1; }
				new suspect = GetClosestPlayer(playerid);
				if(IsPlayerConnected(suspect))
				{
					if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
					{
						GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						if(WantedLevel[suspect] < 1)
						{
						    SendClientMessage(playerid, COLOR_GREY, "Acest jucator trebuie sa aiba wanted!");
						    return 1;
						}
						format(string, sizeof(string), "* L-ai arestat pe %s!", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						GivePlayerCash(suspect, -moneys);
						format(string, sizeof(string), "Ai fost arestat de %s ~n~    pentru $%s", sendername, FormatNumber(moneys));
						GameTextForPlayer(suspect, string, 5000, 5);
						ResetPlayerWeapons(suspect);
						if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1)
						{
							format(string, sizeof(string), "<< Ofiter %s a arestat suspectul %s pentru %d minute (%s$). Cautiune: %s$ >>", sendername, giveplayer, time, FormatNumber(moneys), FormatNumber(bail));
							OOCNews(COLOR_LIGHTRED, string);
						}
						else if(PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2)
						{
							format(string, sizeof(string), "<< Agent FBI %s a arestat suspectul %s pentru %d minute (%s$). Cautiune: %s$ >>", sendername, giveplayer, time, FormatNumber(moneys), FormatNumber(bail));
							OOCNews(COLOR_LIGHTRED, string);
						}
						else if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3)
						{
							format(string, sizeof(string), "<< Soldat %s a arestat suspectul %s pentru %d minute (%s$). Cautiune: %s$ >>", sendername, giveplayer, time, FormatNumber(moneys), FormatNumber(bail));
							OOCNews(COLOR_LIGHTRED, string);
						}
						SetPlayerInterior(suspect, 6);
						SetPlayerPos(suspect,264.6288,77.5742,1001.0391);
						PlayerInfo[suspect][pJailTime] = time * 60;
						if(bail == 1)
						{
							JailPrice[suspect] = bailprice;
							format(string, sizeof(string), "* Ai fost incarcerat pentru %d secunde. Cautiune: $%s", PlayerInfo[suspect][pJailTime], FormatNumber(JailPrice[suspect]));
							SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
							SCM(suspect, -1, "Deoarece ai intrat in puscarie, ti-a fost confiscat telefonul mobil!");
							SCM(suspect, COLOR_WHITE, "Tasteaza /jailtime pentru a afla timpul ramas in puscarie!");
						}
						else
						{
						    JailPrice[suspect] = 0;
							format(string, sizeof(string), "* Ai fost incarcerat pentru %d secunde. Cautiune: nu exista!", PlayerInfo[suspect][pJailTime]);
							SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
							SCM(suspect, COLOR_WHITE, "Tasteaza /jailtime pentru a afla timpul ramas in puscarie!");
						}
						PlayerInfo[suspect][pJailed] = 1;
						PhoneOnline[playerid] = 1;
				        PlayerInfo[suspect][pArrested] += 1;
						WantedLevel[suspect] = 0;
						WantLawyer[suspect] = 1;
					}//distance
				}//not connected
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   No-one close enough to arrest.");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Nu esti intr-un departament (PD/FBI/NG)!");
			    return 1;
			}
		}//not connected
		return 1;
	}

Link to comment
Share on other sites

Poftim comanda mea de pe propriul gm

if(strcmp(cmd, "/arrest", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	   	{
			if(IsACop(playerid))
			{
				if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
				{
				    SendClientMessage(playerid, COLOR_GREY, "Nu esti ON Duty!");
				    return 1;
				}
		        if(!PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391) || !PlayerToPoint(6.0, playerid, 1529.4773,-1680.2808,5.8906))
				{// Jail spot
				    SendClientMessage(playerid, COLOR_GREY, "Nu esti langa jail, nu poti aresta!");
				    return 1;
				}
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Tasteaza: /arrest [pret] [time (minute)] [bail (0=no 1=yes)] [bailprice]");
					return 1;
				}
    			moneys = strval(tmp);
				if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, "   Jail Price can't be below $1 or above $99999 !"); return 1; }
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Tasteaza: /arrest [pret] [time (minute)] [bail (0=no 1=yes)] [bailprice]");
					return 1;
				}
				new time = strval(tmp);
				if(time < 1 || time > 20) { SendClientMessage(playerid, COLOR_GREY, "   Jail Time Minutes can't be below 1 or above 20 (Take the person to prison then) !"); return 1; }
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Tasteaza: /arrest [pret] [time (minute)] [bail (0=no 1=yes)] [bailprice]");
					return 1;
				}
				new bail = strval(tmp);
				if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, "   Jail Bailing can't be below 0 or above 1 !"); return 1; }
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "Tasteaza: /arrest [pret] [time (minute)] [bail (0=no 1=yes)] [bailprice]");
					return 1;
				}
				new bailprice = strval(tmp);
				if(bailprice < 0 || bailprice > 3000000) { SendClientMessage(playerid, COLOR_GREY, "   Jail Bailing can't be below $0 or above $3000000 !"); return 1; }
				new suspect = GetClosestPlayer(playerid);
				if(IsPlayerConnected(suspect))
				{
					if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
					{
						GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						if(WantedLevel[suspect] < 1)
						{
						    SendClientMessage(playerid, COLOR_GREY, "Acest jucator trebuie sa aiba wanted!");
						    return 1;
						}
						format(string, sizeof(string), "* L-ai arestat pe %s!", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						GivePlayerCash(suspect, -moneys);
						format(string, sizeof(string), "Ai fost arestat de %s ~n~    pentru $%s", sendername, FormatNumber(moneys));
						GameTextForPlayer(suspect, string, 5000, 5);
						ResetPlayerWeapons(suspect);
						if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1)
						{
							format(string, sizeof(string), "<< Ofiter %s a arestat suspectul %s pentru %d minute (%s$). Cautiune: %s$ >>", sendername, giveplayer, time, FormatNumber(moneys), FormatNumber(bail));
							OOCNews(COLOR_LIGHTRED, string);
						}
						else if(PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2)
						{
							format(string, sizeof(string), "<< Agent FBI %s a arestat suspectul %s pentru %d minute (%s$). Cautiune: %s$ >>", sendername, giveplayer, time, FormatNumber(moneys), FormatNumber(bail));
							OOCNews(COLOR_LIGHTRED, string);
						}
						else if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3)
						{
							format(string, sizeof(string), "<< Soldat %s a arestat suspectul %s pentru %d minute (%s$). Cautiune: %s$ >>", sendername, giveplayer, time, FormatNumber(moneys), FormatNumber(bail));
							OOCNews(COLOR_LIGHTRED, string);
						}
						SetPlayerInterior(suspect, 6);
						SetPlayerPos(suspect,264.6288,77.5742,1001.0391);
						PlayerInfo[suspect][pJailTime] = time * 60;
						if(bail == 1)
						{
							JailPrice[suspect] = bailprice;
							format(string, sizeof(string), "* Ai fost incarcerat pentru %d secunde. Cautiune: $%s", PlayerInfo[suspect][pJailTime], FormatNumber(JailPrice[suspect]));
							SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
							SCM(suspect, -1, "Deoarece ai intrat in puscarie, ti-a fost confiscat telefonul mobil!");
							SCM(suspect, COLOR_WHITE, "Tasteaza /jailtime pentru a afla timpul ramas in puscarie!");
						}
						else
						{
						    JailPrice[suspect] = 0;
							format(string, sizeof(string), "* Ai fost incarcerat pentru %d secunde. Cautiune: nu exista!", PlayerInfo[suspect][pJailTime]);
							SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
							SCM(suspect, COLOR_WHITE, "Tasteaza /jailtime pentru a afla timpul ramas in puscarie!");
						}
						PlayerInfo[suspect][pJailed] = 1;
						PhoneOnline[playerid] = 1;
				        PlayerInfo[suspect][pArrested] += 1;
						WantedLevel[suspect] = 0;
						WantLawyer[suspect] = 1;
					}//distance
				}//not connected
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   No-one close enough to arrest.");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Nu esti intr-un departament (PD/FBI/NG)!");
			    return 1;
			}
		}//not connected
		return 1;
	}

Nu o sa mearga nici comanda da ...

On : In loc de PlayerData pune PlayerInfo sau depinde cum ai tu .. dar de obicei ai PlayerInfo.. Posteaza putin ShowStats sa vedem sigur cum ai . dar mai intai incearca cu PlayerInfo .

Link to comment
Share on other sites

Uite aici o comanda /arrest care functioneaza:

[pawn]if(strcmp(cmd, "/arrest", true) == 0)

{

    if(IsPlayerConnected(playerid))

  {

if(gTeam[playerid] == 2  || IsACop(playerid))

{

if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)

{

    SendClientMessage(playerid, COLOR_GREY, "  You are not on Duty!");

    return 1;

}

        if(!PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391))

{// Jail spot

    SendClientMessage(playerid, COLOR_GREY, "  You are not near the Jail, can not Arrest !");

    return 1;

}

tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");

return 1;

}

moneys = strval(tmp);

if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, "  Jail Price can not be below $1 or above $99999 !"); return 1; }

tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");

return 1;

}

new time = strval(tmp);

if(time < 1 || time > 20) { SendClientMessage(playerid, COLOR_GREY, "  Jail Time Minutes can not be below 1 or above 20 (Take the person to prison then) !"); return 1; }

tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");

return 1;

}

new bail = strval(tmp);

if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, "  Jail Bailing can not be below 0 or above 1 !"); return 1; }

tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");

return 1;

}

new bailprice = strval(tmp);

if(bailprice < 0 || bailprice > 3000000) { SendClientMessage(playerid, COLOR_GREY, "  Jail Bailing can not be below $0 or above $3000000 !"); return 1; }

new suspect = GetClosestPlayer(playerid);

if(IsPlayerConnected(suspect))

{

if(GetDistanceBetweenPlayers(playerid,suspect) < 5)

{

GetPlayerName(suspect, giveplayer, sizeof(giveplayer));

GetPlayerName(playerid, sendername, sizeof(sendername));

if(WantedLevel[suspect] < 1)

{

    SendClientMessage(playerid, COLOR_GREY, "  Player must be at least Wanted Level 1 !");

    return 1;

}

format(string, sizeof(string), "* You arrested %s !", giveplayer);

SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

GivePlayerMoney(suspect, -moneys);

format(string, sizeof(string), "arrested by %s ~n~    for $%d", sendername, moneys);

GameTextForPlayer(suspect, string, 5000, 5);

ResetPlayerWeapons(suspect);

if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1)

{

format(string, sizeof(string), "<< Officer %s arrested suspect %s >>", sendername, giveplayer);

OOCNews(COLOR_LIGHTRED, string);

}

else if(PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2)

{

format(string, sizeof(string), "<< FBI Agent %s arrested suspect %s >>", sendername, giveplayer);

OOCNews(COLOR_LIGHTRED, string);

}

else if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3)

{

format(string, sizeof(string), "<< Soldier %s arrested suspect %s >>", sendername, giveplayer);

OOCNews(COLOR_LIGHTRED, string);

}

SetPlayerInterior(suspect, 6);

SetPlayerPos(suspect,264.6288,77.5742,1001.0391);

PlayerInfo[suspect][pJailTime] = time * 60;

if(bail == 1)

{

JailPrice[suspect] = bailprice;

format(string, sizeof(string), "You are jailed for %d seconds.  Bail: $%d", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);

SendClientMessage(suspect, COLOR_LIGHTBLUE, string);

}

else

{

    JailPrice[suspect] = 0;

format(string, sizeof(string), "You are jailed for %d seconds.  Bail: Unable", PlayerInfo[suspect][pJailTime]);

SendClientMessage(suspect, COLOR_LIGHTBLUE, string);

}

PlayerInfo[suspect][pJailed] = 1;

        PlayerInfo[suspect][pArrested] += 1;

SetPlayerFree(suspect,playerid, "Got Arrested");

WantedPoints[suspect] = 0;

WantedLevel[suspect] = 0;

WantLawyer[suspect] = 1;

}//distance

}//not connected

else

{

    SendClientMessage(playerid, COLOR_GREY, "  No-one close enough to arrest.");

    return 1;

}

}

else

{

    SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop / FBI / National Guard !");

    return 1;

}

}//not connected

return 1;

}[/pawn]

Link to comment
Share on other sites

Defineste PlayerData.

OFF:Cum sa defineasca PlayerData, tu iti dai seama cat are de reconstruit dupa. Crezi ca e usor tot enum-ul de la pInfo sau cum are el trebuie sa il dubleze. Nu stiu cum faci dar clar nu e de tine scriptig-ul.

ON:Aratane comanda /makeadmin pentru a stii cu ce variabila lucrezi.

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Link to comment
Share on other sites

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.