[HELP] /cuff
#1

I've maked a /cuff cmd, it works to cuff people but...
I want a rank connected to it, I have already connected the team to it, but on all my cop cmd's I got a rank connected.

I'm using ranks like this:

Код:
PlayerInfo[playerid][pRank] < 1)
Here is my /cuff command:

Код:
if(strcmp(cmd, "/cuff", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
		if(GetPlayerTeam(playerid)==11)
			{
				if(IsPlayerInAnyVehicle(playerid))
			  {
			    SendClientMessage(playerid, COLOR_GREY, "  Cannot use this while being in the Car !");
			    return 1;
			  }
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [Playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if (IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
						if(GetPlayerTeam(playerid)==11)
						{
							SendClientMessage(playerid, COLOR_GREY, "  You can't Cuff Cops !");
							return 1;
						}
						if (ProxDetectorS(8.0, playerid, giveplayerid))
						{
						  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Cuff yourself!"); return 1; }
						  {
								GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
								GetPlayerName(playerid, sendername, sizeof(sendername));
								format(string, sizeof(string), "* You were Cuffed by %s, till uncuff.", sendername);
								SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
								format(string, sizeof(string), "* You Cuffed %s, till uncuff.", giveplayer);
								SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
								format(string, sizeof(string), "* %s Hand Cuffs %s, so he wont go anywhere.", sendername ,giveplayer);
								ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
								GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
								TogglePlayerControllable(giveplayerid, 0);
								ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0);
								ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0);
								PlayerCuffed[giveplayerid] = 2;
								PlayerCuffedTime[giveplayerid] = 300;
						  }
						}
						else
						{
						  SendClientMessage(playerid, COLOR_GREY, "  That player is not near you !");
						  return 1;
						}
					}
				}
				else
				{
				  SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
				  return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop !");
			}
		}
		return 1;
	}
So, how should I put a rank in to this command?

Thanks
Reply
#2

pawn Код:
if(PlayerInfo[playerid][pRank] < 1) return SendClientMessage(playerid,color,"You need to have a higher rank.");
Reply
#3

100$ that's copypasted from godfather, please stop doing that and try coding yourself. It's horrible the way it is coded, I took some time and made it hawter. (my style)

pawn Код:
if(strcmp(cmd, "/cuff", true) == 0)
{
    tmp = strtok(cmdtext, idx);
    giveplayerid = ReturnUser(tmp);
    if (!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [Playerid/PartOfName]");
    if (GetPlayerTeam(playerid) != 11) return SendClientMessage(playerid, COLOR_GREY, "  You ain't no cop!");
    if (PlayerInfo[playerid][pRank] < 1) return SendClientMessage(playerid, COLOR_GREY, "  Your rank is too low!");
    if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "  Cannot use this while being in the Car !");
    if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
    if (GetPlayerTeam(giveplayerid) == 11) return SendClientMessage(playerid, COLOR_GREY, "  You can't Cuff Cops !");
    if (giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "  Invalid player! !");
    if (giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "  You cannot Cuff yourself!");
    if (ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "  That player is not near you !");
    {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* You were Cuffed by %s, till uncuff.", sendername);
       
        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "* You Cuffed %s, till uncuff.", giveplayer);
       
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "* %s Hand Cuffs %s, so he wont go anywhere.", sendername ,giveplayer);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
       
        GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
        TogglePlayerControllable(giveplayerid, 0);
        ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0);
        ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0);
        PlayerCuffed[giveplayerid] = 2;
        PlayerCuffedTime[giveplayerid] = 300;
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by //exora
100$ that's copypasted from godfather, please stop doing that and try coding yourself. It's horrible the way it is coded, I took some time and made it hawter. (my style)

pawn Код:
if(strcmp(cmd, "/cuff", true) == 0)
{
    tmp = strtok(cmdtext, idx);
    giveplayerid = ReturnUser(tmp);
    if (!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [Playerid/PartOfName]");
    if (GetPlayerTeam(playerid) != 11) return SendClientMessage(playerid, COLOR_GREY, " You ain't no cop!");
    if (PlayerInfo[playerid][pRank] < 1) return SendClientMessage(playerid, COLOR_GREY, " Your rank is too low!");
    if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, " Cannot use this while being in the Car !");
    if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
    if (GetPlayerTeam(giveplayerid) == 11) return SendClientMessage(playerid, COLOR_GREY, " You can't Cuff Cops !");
    if (giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, " Invalid player! !");
    if (giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, " You cannot Cuff yourself!");
    if (ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
    {
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* You were Cuffed by %s, till uncuff.", sendername);
       
        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "* You Cuffed %s, till uncuff.", giveplayer);
       
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "* %s Hand Cuffs %s, so he wont go anywhere.", sendername ,giveplayer);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
       
        GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
        TogglePlayerControllable(giveplayerid, 0);
        ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0);
        ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0);
        PlayerCuffed[giveplayerid] = 2;
        PlayerCuffedTime[giveplayerid] = 300;
    }
    return 1;
}
Thanks

Just a quastion, I'm making a /uncuff of this cmd, that looks like this:

Код:
	if(strcmp(cmd, "/uncuff", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		giveplayerid = ReturnUser(tmp);
		if (!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /uncuff [Playerid/PartOfName]");
		if (GetPlayerTeam(playerid) != 11) return SendClientMessage(playerid, COLOR_RED, "Identification Error - You are not a Police Officer.");
		if (PlayerInfo[playerid][pRank] < 1) return SendClientMessage(playerid, COLOR_RED, "Identification Error - You need LAE Rank 1 to do this.");
		if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "To far away from player.");
		if (giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "To far away from player.");
		{
			GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "You were uncuffed by %s.", sendername);

			SendClientMessage(giveplayerid, COLOR_BLUE, string);
			format(string, sizeof(string), "You uncuffed %s.", giveplayer);

			GameTextForPlayer(giveplayerid, "~r~Uncuffed", 2500, 3);
			TogglePlayerControllable(giveplayerid, 1);
			PlayerCuffed[giveplayerid] = 2;
			PlayerCuffedTime[giveplayerid] = 300;
		}
		return 1;
	}
Is there any animation to play when it goes /uncuff? because when I do /uncuff, he'ss till in /hide psition and walks around...
Reply
#5

https://sampwiki.blast.hk/wiki/ClearAnimations
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)