I need a /cuff and /uncuff command
#1

I've been through so many topics and can't find any that work.....

I need the /cuff and /uncuff command.....I know you guys are gonna be like "SEARCH" Ok, well i have, I've been through many topics asking the same question and any thing that is posted has sooo many errors and no one replys back when the user that asked the question says "This has so many errors"

So can someone give me the /cuff and /uncuff commands without any errors and that have this as the cop indicater

Код:
gTeam[playerid] = TEAM_COP;
Reply
#2

please someone?
Reply
#3

this one should work its from an old script i used to us

Код:
	if(strcmp(cmd, "/cuff", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			gTeam[playerid] = TEAM_COP;
			{
			  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(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
				    {
				      SendClientMessage(playerid, COLOR_GREY, "  You can't Cuff Cops !");
					    return 1;
				    }
					  if(PlayerCuffed[giveplayerid] > 1)
					  {
					    SendClientMessage(playerid, COLOR_GREY, "  Player already Cuffed !");
					    return 1;
					  }
						if (ProxDetectorS(3.0, playerid, giveplayerid))
						{
						  if (IsPlayerInAnyVehicle(giveplayerid))
						  {
						    SendClientMessage(playerid, COLOR_GREY, "  Cannot cuff them in a vehicle!");
						    return 1;
						  }

						  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Cuff yourself!"); return 1; }
     					if(GetPlayerState(playerid) == 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);
								PlayerCuffed[giveplayerid] = 2;
								PlayerCuffedTime[giveplayerid] = 800;
    				  }
							else
						  {
						    SendClientMessage(playerid, COLOR_GREY, "  Player not in your Car, or your not the Driver !");
						    return 1;
						  }
						}
						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 / FBI / National Guard !");
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/uncuff", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			gTeam[playerid] = TEAM_COP;
			{
			  tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /uncuff [Playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
					  if (ProxDetectorS(8.0, playerid, giveplayerid))
						{
						  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Uncuff yourself!"); return 1; }
							if(PlayerCuffed[giveplayerid])
							{
							  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
								GetPlayerName(playerid, sendername, sizeof(sendername));
							  format(string, sizeof(string), "* You were Uncuffed by %s.", sendername);
								SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
								format(string, sizeof(string), "* You Uncuffed %s.", giveplayer);
								SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
								GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3);
								TogglePlayerControllable(giveplayerid, 1);
								PlayerCuffed[giveplayerid] = 0;
								PlayerCuffedTime[giveplayerid] = 0;
								PlayerDragged[giveplayerid] = 0;
								PlayerDraggedBy[giveplayerid] = 255;
							}
							else
							{
							  SendClientMessage(playerid, COLOR_GREY, "  That player isn't Tied up !");
							  return 1;
							}
						}
						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 / FBI / National Guard !");
			}
		}//not connected
		return 1;
	}
Reply
#4

Quote:
Originally Posted by pepper
this one should work its from an old script i used to us

Код:
	if(strcmp(cmd, "/cuff", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			gTeam[playerid] = TEAM_COP;
			{
			  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(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
				    {
				      SendClientMessage(playerid, COLOR_GREY, " You can't Cuff Cops !");
					    return 1;
				    }
					  if(PlayerCuffed[giveplayerid] > 1)
					  {
					    SendClientMessage(playerid, COLOR_GREY, " Player already Cuffed !");
					    return 1;
					  }
						if (ProxDetectorS(3.0, playerid, giveplayerid))
						{
						  if (IsPlayerInAnyVehicle(giveplayerid))
						  {
						    SendClientMessage(playerid, COLOR_GREY, " Cannot cuff them in a vehicle!");
						    return 1;
						  }

						  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Cuff yourself!"); return 1; }
     					if(GetPlayerState(playerid) == 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);
								PlayerCuffed[giveplayerid] = 2;
								PlayerCuffedTime[giveplayerid] = 800;
    				 }
							else
						  {
						    SendClientMessage(playerid, COLOR_GREY, " Player not in your Car, or your not the Driver !");
						    return 1;
						  }
						}
						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 / FBI / National Guard !");
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/uncuff", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			gTeam[playerid] = TEAM_COP;
			{
			  tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /uncuff [Playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
					  if (ProxDetectorS(8.0, playerid, giveplayerid))
						{
						  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Uncuff yourself!"); return 1; }
							if(PlayerCuffed[giveplayerid])
							{
							  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
								GetPlayerName(playerid, sendername, sizeof(sendername));
							  format(string, sizeof(string), "* You were Uncuffed by %s.", sendername);
								SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
								format(string, sizeof(string), "* You Uncuffed %s.", giveplayer);
								SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
								GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3);
								TogglePlayerControllable(giveplayerid, 1);
								PlayerCuffed[giveplayerid] = 0;
								PlayerCuffedTime[giveplayerid] = 0;
								PlayerDragged[giveplayerid] = 0;
								PlayerDraggedBy[giveplayerid] = 255;
							}
							else
							{
							  SendClientMessage(playerid, COLOR_GREY, " That player isn't Tied up !");
							  return 1;
							}
						}
						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 / FBI / National Guard !");
			}
		}//not connected
		return 1;
	}
I get 13 errors

Код:
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(187) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(193) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(193) : error 017: undefined symbol "idx"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(194) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(198) : error 017: undefined symbol "giveplayerid"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(198) : error 017: undefined symbol "ReturnUser"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(199) : error 017: undefined symbol "giveplayerid"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(201) : error 017: undefined symbol "giveplayerid"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(203) : error 017: undefined symbol "giveplayerid"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(208) : error 017: undefined symbol "PlayerCuffed"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(208) : error 017: undefined symbol "giveplayerid"
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(208) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Anuj_2\Desktop\TESTTEAM.pwn(208) : fatal error 107: too many error messages on one line
Can you help me fix them please, i want to get this over with and working
Reply
#5

pawn Код:
if (strcmp("/cuff", cmdtext, true, 15) == 0)
    {
    new tmp[128];
    new idx;
    new giveplayerid;
    new giveplayer[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp) return SendClientMessage(playerid,0xAA3333AA,"USAGE: /cuff playerid");
    giveplayerid = strval(tmp);
    if(gTeam[playerid] == TEAM_COP)
    {
    if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,0xAA3333AA,"You cannot cuff cops !");
    ToggePlayerControllable(giveplayerid,0);
    format(tmp,sizeof(tmp),"You have cuffed %s",GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
    SendClientMessage(playerid,0x33AA33AA,tmp);
    format(tmp,sizeof(tmp),"You have been cuffed by %s",GetPlayerName(playerid,sendername,sizeof(sendername));
    return 1;
    }
Reply
#6

At the top:
Код:
new PlayerCuffed[MAX_PLAYERS];
new giveplayerid;
OnPlayerConnect:
Код:
PlayerCuffed[playerid] = 0;
Код:
	if(strcmp(cmd, "/cuff", true) == 0)
  	{
  	  new sendername[MAX_PLAYERS];
		new giveplayer[MAX_PLAYERS];
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
	   	SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /cuff [playerid]");
	   	return 1;
		}
		giveplayerid = ReturnUser(tmp);
	 	if(IsPlayerConnected(giveplayerid))
		{
		  if(giveplayerid != INVALID_PLAYER_ID)
		  {
			  if(PlayerCuffed[giveplayerid] == 1)
			  {
			    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That person is already cuffed.");
			    return 1;
			  }
				if (GetDistanceBetweenPlayers(playerid,suspect) < 5))
				{
				  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't cuff yourself!"); return 1; }
				  GetPlayerName(playerid, sendername, sizeof(sendername);
				  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer);
  				format(string, sizeof(string), "Cuffed by %s.", sendername);
					SendClientMessage(giveplayerid, COLOR_RED, string);
					format(string, sizeof(string), "%s successfully cuffed.", giveplayer);
					SendClientMessage(playerid, COLOR_WHITE, string);
					PlayerPlayerActionMessage(playerid,giveplayerid,15.0,"has just handcuffed");
					TogglePlayerControllable(giveplayerid, 0);
					PlayerCuffed[giveplayerid] = 1;
				}
				else
				{
				  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That player is not near you!");
				  return 1;
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
			  return 1;
			}
		}
		return 1;
	}
You can edit that however you like, but it will work.
Reply
#7

Quote:
Originally Posted by coole210
pawn Код:
if (strcmp("/cuff", cmdtext, true, 15) == 0)
    {
    new tmp[128];
    new idx;
    new giveplayerid;
    new giveplayer[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp) return SendClientMessage(playerid,0xAA3333AA,"USAGE: /cuff playerid");
    giveplayerid = strval(tmp);
    if(gTeam[playerid] == TEAM_COP)
    {
    if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,0xAA3333AA,"You cannot cuff cops !");
    ToggePlayerControllable(giveplayerid,0);
    format(tmp,sizeof(tmp),"You have cuffed %s",GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
    SendClientMessage(playerid,0x33AA33AA,tmp);
    format(tmp,sizeof(tmp),"You have been cuffed by %s",GetPlayerName(playerid,sendername,sizeof(sendername));
    return 1;
    }
These are the errors i get now

Код:
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(194) : error 001: expected token: ")", but found "return"
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(199) : error 017: undefined symbol "ToggePlayerControllable"
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(200) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(202) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(221) : warning 209: function "OnPlayerCommandText" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#8

pawn Код:
if (strcmp("/cuff", cmdtext, true, 15) == 0)
    {
    new tmp[128];
    new idx;
    new giveplayerid;
    new giveplayer[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp) return SendClientMessage(playerid,0xAA3333AA,"USAGE: /cuff playerid");
    giveplayerid = strval(tmp);
    if(gTeam[playerid] == TEAM_COP)
    {
    if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,0xAA3333AA,"You cannot cuff cops !");
    TogglePlayerControllable(giveplayerid,0);
    format(tmp,sizeof(tmp),"You have cuffed %s",GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
    SendClientMessage(playerid,0x33AA33AA,tmp);
    format(tmp,sizeof(tmp),"You have been cuffed by %s",GetPlayerName(playerid,sendername,sizeof(sendername));
    return 1;
    }
Reply
#9

Quote:
Originally Posted by coole210
pawn Код:
if (strcmp("/cuff", cmdtext, true, 15) == 0)
    {
    new tmp[128];
    new idx;
    new giveplayerid;
    new giveplayer[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp) return SendClientMessage(playerid,0xAA3333AA,"USAGE: /cuff playerid");
    giveplayerid = strval(tmp);
    if(gTeam[playerid] == TEAM_COP)
    {
    if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,0xAA3333AA,"You cannot cuff cops !");
    TogglePlayerControllable(giveplayerid,0);
    format(tmp,sizeof(tmp),"You have cuffed %s",GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
    SendClientMessage(playerid,0x33AA33AA,tmp);
    format(tmp,sizeof(tmp),"You have been cuffed by %s",GetPlayerName(playerid,sendername,sizeof(sendername));
    return 1;
    }
Still got errors, thanks for quick replys

Код:
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(194) : error 001: expected token: ")", but found "}"
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(194) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(194) : warning 215: expression has no effect
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(194) : error 001: expected token: ";", but found "return"
C:\Documents and Settings\Anuj_2\Desktop\Copy of TESTTEAM.pwn(194) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#10

Which is line 194?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)