Error with /badge
#1

So i have a command, It works perfectly (Although i get 2 warnings, Tags mismatch or something).
Then i decided to add something to it, so that people can only do it in the locker room.

This is the original command that works with 2 warnings
Код:
command(badge, playerid, params[])
{
	if (Player[playerid][Group] == 1) {
		new string[128];
		switch(Player[playerid][pBadge])
		{
		    case 0:
		    {
      		Player[playerid][pBadge] = 1;
	        format(string, sizeof(string), "* %s snaps on their badge", GetName(playerid));
			NearByMessage(playerid, NICESKY, string);
			SendClientMessage(playerid, WHITE, "You are now on duty");
			Player[playerid][CopDuty] = 1;
			SetPlayerColor(playerid, BLUE);
	 		Player[playerid][Ranks] = Rank5;
	 		SetPlayerSkin(playerid, 288);
	 		GivePlayerWeapon(playerid, 24, 200);
			}


			case 1:
			{
			    Player[playerid][pBadge] = 0;
			    format(string, sizeof(string), "* %s snaps off their badge", GetName(playerid));
				NearByMessage(playerid, NICESKY, string);
				Player[playerid][CopDuty] = 0;
				SendClientMessage(playerid, WHITE, "You are now off duty");
				SetPlayerColor(playerid, WHITE);
				SetPlayerSkin(playerid, Player[playerid][LastSkin]);
				ResetPlayerWeapons(playerid);
			}
		}
	}
 	return 1;
}
.

This is what i changed it too
Код:
command(badge, playerid, params[])
{
	if (Player[playerid][Group] == 1) {
		new string[128];
		switch(Player[playerid][pBadge])
		{
		    case 0:
		    {
		        if(IsPlayerInRangeOfPoint(playerid, 4.0, 264.24, 109.34, 1004.62)){
		        {
			        Player[playerid][pBadge] = 1;
			        format(string, sizeof(string), "* %s snaps on their badge", GetName(playerid));
					NearByMessage(playerid, NICESKY, string);
					SendClientMessage(playerid, WHITE, "You are now on duty");
					Player[playerid][CopDuty] = 1;
					SetPlayerColor(playerid, BLUE);
				 	Player[playerid][Ranks] = Rank5;
				 	SetPlayerSkin(playerid, 288);
				 	GivePlayerWeapon(playerid, 24, 200);
				}
				else SendClientMessage(playerid, WHITE, "You need to be in the locker rooms to do this command!");
			}


			case 1:
			{
			    Player[playerid][pBadge] = 0;
			    format(string, sizeof(string), "* %s snaps off their badge", GetName(playerid));
				NearByMessage(playerid, NICESKY, string);
				Player[playerid][CopDuty] = 0;
				SendClientMessage(playerid, WHITE, "You are now off duty");
				SetPlayerColor(playerid, WHITE);
				SetPlayerSkin(playerid, Player[playerid][LastSkin]);
				ResetPlayerWeapons(playerid);
			}
		}
	}
 	return 1;
}
I'm fully aware that what i changed it too probably looks wrong as fuck, i'm new to scripting and I thought i'd try to add something with watching a tut or anything, If someone could help that'd be nice, i forgot to get the error code, if you need it, ask for it in the replies.
Reply


Messages In This Thread
Error with /badge - by Joshswag - 03.11.2012, 05:14
Re: Error with /badge - by Glad2BeHere - 03.11.2012, 05:16
Re: Error with /badge - by Joshswag - 03.11.2012, 05:32
Re: Error with /badge - by Joshswag - 03.11.2012, 06:28
Re: Error with /badge - by Glad2BeHere - 03.11.2012, 06:32
Re: Error with /badge - by [HK]Ryder[AN] - 03.11.2012, 06:54
Re: Error with /badge - by Joshswag - 03.11.2012, 07:13
Re: Error with /badge - by Glad2BeHere - 03.11.2012, 07:20
Re: Error with /badge - by Joshswag - 03.11.2012, 08:01
Re: Error with /badge - by Glad2BeHere - 03.11.2012, 08:13

Forum Jump:


Users browsing this thread: 3 Guest(s)