My /uncuff command not working.
#1

Hi guys, I have a uncuff command.

I will show u my uncuff command.

Quote:
Код:
	if(strcmp(cmd, "/uncuff", true) == 0)
	{
	    new playername[MAX_PLAYER_NAME];
	    tmp = strtok(cmdtext, idx);
	    GetPlayerName(strval(tmp), playername, sizeof(playername));
		if(strlen(tmp) == 0) return SendClientMessage(playerid, ERROR, "Use: /uncuff [ID]");
	    if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != ARMY && gTeam[playerid] != FBI)
	    {
	        if(IsPlayerSpawned(strval(tmp)))
	        {
		    	if(GetDistanceBetweenPlayers(playerid, strval(tmp) <= 2))
				{
					if(!IsPlayerInAnyVehicle(playerid))
					{
						if(Cuffed[strval(tmp)] == 1)
						{
							new string[250], string2[250];
							Cuffed[strval(tmp)] = 0;
							TogglePlayerControllable(strval(tmp), true);
							SendClientMessage(playerid, red, "[Player Uncuffed]");
							format(string, sizeof(string), "You uncuffed %s[ID:%d].", playername, strval(tmp));
							SendClientMessage(playerid, blue, string);
						   	SendClientMessage(strval(tmp), red, "[Uncuffed]");
						   	SetPlayerCuffed(playerid, 0);
							format(string2, sizeof(string2), "Law Enforcement Officer %s[ID:%d] has uncuffed you.", playername, playerid);
							return SendClientMessage(strval(tmp), blue, string2);
						}
						else if(Cuffed[strval(tmp)] == 0)
						{
							new string[250];
							IsPlayerCuffed(playerid);
							format(string, sizeof(string), "%s[ID:%d] is not uncuffed.", playername, strval(tmp));
							return SendClientMessage(playerid, ERROR, string);
						}
					}
					else return SendClientMessage(playerid, ERROR, "You cannot uncuff anyone from inside a vehicle.");
				}
			}
			else
			{
			    new string[250];
			    format(string, sizeof(string), "%s[ID:%d] is too far away.", playername, strval(tmp));
			    return SendClientMessage(playerid, ERROR, string);
			}
		}
		else return SendClientMessage(playerid, ERROR, "Only Police Officers can use this command!");
	}
So when I try to /uncuff someone, It says only police officers can use this command. but i'm already police officer.. can u guys help me?

I will show u my cuff command just for u guys to check

Quote:
Код:
 	if(strcmp(cmd, "/cuff", true) == 0)
	{
	    new playername[MAX_PLAYER_NAME];
	    tmp = strtok(cmdtext, idx);
	    GetPlayerName(strval(tmp), playername, sizeof(playername));
		if(strlen(tmp) == 0) return SendClientMessage(playerid, ERROR, "Use: /cuff [ID]");
        if(gTeam[playerid] != CIVILIAN)
		{
    	 if(GetPlayerTeam(strval(tmp) != COP))
	        {
	            if(IsPlayerSpawned(strval(tmp)))
	            {
		            if(GetDistanceBetweenPlayers(playerid, strval(tmp) <= 2))
		            {
			            if(!IsPlayerInAnyVehicle(playerid))
			            {
							if(!IsPlayerInAnyVehicle(strval(tmp)))
							{
							    if(Cuffed[strval(tmp)] == 0)
							    {
							        new string[250], string2[250];
	  						        Cuffed[strval(tmp)] = 1;
							        TogglePlayerControllable(strval(tmp), false);
							        SendClientMessage(playerid, red, "[Player Handcuffed]");
							        format(string, sizeof(string), "You handcuffed %s[ID:%d].", playername, strval(tmp));
							        SendClientMessage(playerid, WHITE, string);
							        SendClientMessage(strval(tmp), red, "[Handcuffed]");
							        SetPlayerCuffed(playerid, 1);
							       	format(string2, sizeof(string2), "Law Enforcement Officer %s[ID:%d] has handcuffed you.", playername, playerid);
							       	SendClientMessage(strval(tmp), blue, string2);
							       	return true;
							    }
							    else if(Cuffed[strval(tmp)] == 1)
								{
								    new string[250];
								    IsPlayerCuffed(playerid);
								    format(string, sizeof(string), "%s[ID:%d] is already handcuffed.", playername, strval(tmp));
								    return SendClientMessage(playerid, ERROR, string);
								}
							}
							else
							{
							    new string[250];
							    format(string, sizeof(string), "%s[ID:%d] is in a vehicle.", playername, strval(tmp));
							    return SendClientMessage(playerid, ERROR, string);
							}
						}
						else return SendClientMessage(playerid, ERROR, "You cannot handcuff anyone from inside a vehicle.");
					}
					else
					{
				    	new string[250];
				    	format(string, sizeof(string), "%s[ID:%d] is too far away.", playername, strval(tmp));
				    	return SendClientMessage(playerid, ERROR, string);
					}
				}
				else
				{
				    new string[250];
			    	format(string, sizeof(string), "%s[ID:%d] is dead.", playername, strval(tmp));
				    return SendClientMessage(playerid, ERROR, string);
				}
			}
			else return SendClientMessage(playerid, ERROR, "You cannot handcuff another Police Officer!");
  		}
		else return SendClientMessage(playerid, ERROR, "Only Police Officers can use this command!");
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)