[HELP] Need help with /jail
#1

This may be a little hard to understand...
I've created a working /jail, but, on all my police cmds I have putted ranks, this is a example:

Код:
if (strcmp("/check", cmdtext, true, 5) == 0)
	{
		new str[256], pname[256];
    if(PlayerInfo[playerid][pRank] < 1) return SendClientMessage(playerid,0xFF0000FF, "Identification Error - You need LAE Rank 1 to do this.");
    if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,0xFF0000FF, "Identification Error - You are not a Police Officer.");
		GetPlayerName(playerid, pname, 256);
		format(str, 256, "Officer %s Checks him/her for any illegal items!", pname, cmdtext[7]);
		SendClientMessageToAll(COLOR_BLUE, str);
		return 1;
	}
Only Rank 1 may use that cmd.

So by quastion is, how should I put the rank on /jail, it's going to be rank 1.

Код:
if(strcmp(cmd, "/jail", true) == 0)
	{
	  if(PlayerToPoint(25.0,playerid,268.3492,77.7623,1001.0391))
	  {
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid/PartOfName] [time(minutes)]");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			if (GetPlayerTeam(playerid)==5)
			{
			  if(IsPlayerConnected(playa))
			  {
			    if(playa != INVALID_PLAYER_ID)
			    {
				    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "You Jailed %s.", giveplayer);
						SendClientMessage(playerid, COLOR_BLUE, string);
						format(string, sizeof(string), "You were Jailed by %s.", sendername);
						SendClientMessage(playa, COLOR_BLUE, string);
						ResetPlayerWeapons(playa);
						//WantedLevel[playa] = 0;
						PlayerInfo[playa][pJailed] = 2;
						PlayerInfo[playa][pJailTime] = money*60;
						SetPlayerInterior(playa, 6);
						SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
						format(string, sizeof(string), "You are jailed for %d minutes.", money);
						SendClientMessage(playa, COLOR_BLUE, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "Identification Error - You need LAE Rank 1 to do this.");
			}
		}
		}
		else
		{
    SendClientMessage(playerid, COLOR_RED, "You are not at the cells");
		}
		return 1;
	}
	return 0;
}
Thanks
Reply
#2

do
pawn Код:
if(PlayerInfo[playerid][pRank] == 1)
{
//ur hailfunction
}
else
SendClientMessage(playerid,0xFF0000FF, "Identification Error - Blah");
Reply
#3

Quote:
Originally Posted by saiberfun
do
pawn Код:
if(PlayerInfo[playerid][pRank] == 1)
{
//ur hailfunction
}
else
SendClientMessage(playerid,0xFF0000FF, "Identification Error - Blah");
Don't forget to return. :P

pawn Код:
if(strcmp(cmd, "/jail", true) == 0)
{
if(PlayerInfo[playerid][pRank] >= 1)
}
if(PlayerToPoint(25.0,playerid,268.3492,77.7623,1001.0391))
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid/PartOfName] [time(minutes)]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (GetPlayerTeam(playerid)==5)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "You Jailed %s.", giveplayer);
SendClientMessage(playerid, COLOR_BLUE, string);
format(string, sizeof(string), "You were Jailed by %s.", sendername);
SendClientMessage(playa, COLOR_BLUE, string);
ResetPlayerWeapons(playa);
//WantedLevel[playa] = 0;
PlayerInfo[playa][pJailed] = 2;
PlayerInfo[playa][pJailTime] = money*60;
SetPlayerInterior(playa, 6);
SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
format(string, sizeof(string), "You are jailed for %d minutes.", money);
SendClientMessage(playa, COLOR_BLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Identification Error - You need LAE Rank 1 to do this.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not at the cells");
}
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "You must be rank 1 to use this command");
}
Reply
#4

Quote:
Originally Posted by еddy
Don't forget to return. :P
hehe ye sry
Reply
#5

Iget thise errors...

Код:
invalid expression, assumed zero
Код:
expected token: ";", but found "if"
Код:
invalid function or declaration
Also some warnings...

Here is my script now.

Код:
if(strcmp(cmd, "/jail", true) == 0)
	{
	if(PlayerInfo[playerid][pRank] >= 1)
	}
	if(PlayerToPoint(25.0,playerid,268.3492,77.7623,1001.0391))
	{
	if(IsPlayerConnected(playerid))
	{
	tmp = strtok(cmdtext, idx);
	if(!strlen(tmp))
	{
	SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid/PartOfName] [time(minutes)]");
	return 1;
	}
	new playa;
	new money;
	playa = ReturnUser(tmp);
	tmp = strtok(cmdtext, idx);
	money = strval(tmp);
	if (GetPlayerTeam(playerid)==5)
	{
	if(IsPlayerConnected(playa))
	{
	if(playa != INVALID_PLAYER_ID)
	{
	GetPlayerName(playa, giveplayer, sizeof(giveplayer));
	GetPlayerName(playerid, sendername, sizeof(sendername));
	format(string, sizeof(string), "You Jailed %s.", giveplayer);
	SendClientMessage(playerid, COLOR_BLUE, string);
	format(string, sizeof(string), "You were Jailed by %s.", sendername);
	SendClientMessage(playa, COLOR_BLUE, string);
	ResetPlayerWeapons(playa);
	//WantedLevel[playa] = 0;
	PlayerInfo[playa][pJailed] = 2;
	PlayerInfo[playa][pJailTime] = money*60;
	SetPlayerInterior(playa, 6);
	SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
	format(string, sizeof(string), "You are jailed for %d minutes.", money);
	SendClientMessage(playa, COLOR_BLUE, string);
	}
	}
	}
	else
	{
	SendClientMessage(playerid, COLOR_RED, "Identification Error - You need LAE Rank 1 to do this.");
	}
	}
	}
	else
	{
	SendClientMessage(playerid, COLOR_RED, "You are not at the cells");
	}
	return 1;
	}
	else return SendClientMessage(playerid, COLOR_RED, "You must be rank 1 to use this command");
	}
	return 0;
}
Reply
#6

Whoupsy, I failed. XD

Use this:

pawn Код:
if(strcmp(cmd, "/jail", true) == 0)
{
if(PlayerInfo[playerid][pRank] >= 1)
{
if(PlayerToPoint(25.0,playerid,268.3492,77.7623,1001.0391))
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid/PartOfName] [time(minutes)]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (GetPlayerTeam(playerid)==5)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "You Jailed %s.", giveplayer);
SendClientMessage(playerid, COLOR_BLUE, string);
format(string, sizeof(string), "You were Jailed by %s.", sendername);
SendClientMessage(playa, COLOR_BLUE, string);
ResetPlayerWeapons(playa);
//WantedLevel[playa] = 0;
PlayerInfo[playa][pJailed] = 2;
PlayerInfo[playa][pJailTime] = money*60;
SetPlayerInterior(playa, 6);
SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
format(string, sizeof(string), "You are jailed for %d minutes.", money);
SendClientMessage(playa, COLOR_BLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Identification Error - You need LAE Rank 1 to do this.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not at the cells");
}
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "You must be rank 1 to use this command");
}
Reply
#7

Quote:
Originally Posted by еddy
Whoupsy, I failed. XD

Use this:

pawn Код:
if(strcmp(cmd, "/jail", true) == 0)
{
if(PlayerInfo[playerid][pRank] >= 1)
{
if(PlayerToPoint(25.0,playerid,268.3492,77.7623,1001.0391))
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid/PartOfName] [time(minutes)]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (GetPlayerTeam(playerid)==5)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "You Jailed %s.", giveplayer);
SendClientMessage(playerid, COLOR_BLUE, string);
format(string, sizeof(string), "You were Jailed by %s.", sendername);
SendClientMessage(playa, COLOR_BLUE, string);
ResetPlayerWeapons(playa);
//WantedLevel[playa] = 0;
PlayerInfo[playa][pJailed] = 2;
PlayerInfo[playa][pJailTime] = money*60;
SetPlayerInterior(playa, 6);
SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
format(string, sizeof(string), "You are jailed for %d minutes.", money);
SendClientMessage(playa, COLOR_BLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Identification Error - You need LAE Rank 1 to do this.");
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not at the cells");
}
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "You must be rank 1 to use this command");
}
Thanks, finaly my cadets stops abusing that cmd xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)