Please look at this
#1

For my /taze command i only want it to work for cops...but i dunno what im doing wrong...it doesnt work for cops but it works for other teams..


Heres the code:

Код:
 	if (strcmp("/taze", cmd, true) == 0)
 {
		new giveplayerid;
		new giveplayer[MAX_PLAYER_NAME];
		new sendername[MAX_PLAYER_NAME];
		tmp = strtok(cmdtext, idx);
		if(gTeam[playerid] == TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
 		if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_ORANGE,"USAGE: /taze [playerid]");
 		if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR]: The ID you have entered does not exist!");

 		giveplayerid = ReturnUser(tmp);
 		if(gTeam[playerid] == TEAM_COP)
		{
			if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,0xAA3333AA,"You cannot taze police officers !");
			TogglePlayerControllable(giveplayerid,0);
			GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
			GetPlayerName(playerid,sendername,sizeof(sendername));
			format(tmp,sizeof(tmp),"You have tazed %s",giveplayer);
			SendClientMessage(playerid,0x33AA33AA,tmp);
  		format(tmp,sizeof(tmp),"You have been tazed by %s",sendername);
			SendClientMessage(giveplayerid,0xAA3333AA,tmp);
			PlayerTazed[playerid] = true;
  		SetTimerEx("Taze",8*1000,0,"i",playerid);
			}
 		return 1;
	}
Reply
#2

Change:
pawn Код:
if(gTeam[playerid] == TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
to:
pawn Код:
if(gTeam[playerid] != TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
Reply
#3

Quote:
Originally Posted by Don Correlli
Change:
pawn Код:
if(gTeam[playerid] == TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
to:
pawn Код:
if(gTeam[playerid] != TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
Thank you for the reply...but it kinda worked...

Can you fix my 3 commands, they work as in for what they are suppose to do, but they are messed up in what they are suppose to display, and i tryed to fix it on my own and it didnt work....

The cuff command. It should display as soon as someone is not part of the TEAM_COP it should display "Only Law enforcement agents can use this command!" but when someone that isnt part of the TEAM_COP and that person type /cuff it displays "USAGE: /cuff [playerid]" and when i type /cuff 5 it says ""[ERROR]: That ID not an active player " I just want it to display ""Only Law enforcement agents can use this command!"" and nothing else if they are not police
Код:
{ 
	new cmd[256];
	new tmp[256];
	new idx;
	cmd = strtok(cmdtext, idx);
	if (strcmp("/cuff", cmd, true) == 0) 
 	{
		new giveplayerid;
		new giveplayer[MAX_PLAYER_NAME];
		new sendername[MAX_PLAYER_NAME];
		tmp = strtok(cmdtext, idx);
 		if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,COLOR_ORANGE,"Only Law enforcement agents can use this command!");
 		if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_ORANGE,"USAGE: /cuff [playerid]");
 		if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR]: That ID not an active player ");
 		giveplayerid = ReturnUser(tmp);
 		if(gTeam[playerid] == TEAM_COP)
		{
			if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,0xAA3333AA,"You cannot cuff cops !");
			TogglePlayerControllable(giveplayerid,0);
			GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
			GetPlayerName(playerid,sendername,sizeof(sendername));
			format(tmp,sizeof(tmp),"You have cuffed %s",giveplayer);
			SendClientMessage(playerid,0x33AA33AA,tmp);
			format(tmp,sizeof(tmp),"You have been cuffed by %s",sendername);
			SendClientMessage(giveplayerid,0xAA3333AA,tmp);
			}
	  else return SendClientMessage(playerid,COLOR_GREY, "You are not a cop!");
	 	return 1;
		}
The /uncuff command same thing as the /cuff... so the display problem
Код:
	if (strcmp("/uncuff", cmd, true) == 0)
 	{
		new giveplayerid;
		new giveplayer[MAX_PLAYER_NAME];
		new sendername[MAX_PLAYER_NAME];
		tmp = strtok(cmdtext, idx);
		if(gTeam[playerid] == TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
 		if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_ORANGE,"USAGE: /uncuff [playerid]");
 		if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR]: The ID you have entered does not exist!");

 		giveplayerid = ReturnUser(tmp);
 		if(gTeam[playerid] == TEAM_COP)
		{
			if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,0xAA3333AA,"You cannot cuff police officers !");
			TogglePlayerControllable(giveplayerid,1);
			GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
			GetPlayerName(playerid,sendername,sizeof(sendername));
			format(tmp,sizeof(tmp),"You have uncuffed %s",giveplayer);
			SendClientMessage(playerid,0x33AA33AA,tmp);
 			format(tmp,sizeof(tmp),"You have been uncuffed by %s",sendername);
			SendClientMessage(giveplayerid,0xAA3333AA,tmp);
			}
			else return SendClientMessage(playerid,COLOR_GREY, "You are not a cop!");
		return 0;
	}
The /taze command same thing as the /cuff and /uncuff the display problems..
Код:
 	if (strcmp("/taze", cmd, true) == 0)
 {
		new giveplayerid;
		new giveplayer[MAX_PLAYER_NAME];
		new sendername[MAX_PLAYER_NAME];
		tmp = strtok(cmdtext, idx);
		if(gTeam[playerid] == TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
 		if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_ORANGE,"USAGE: /taze [playerid]");
 		if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR]: The ID you have entered does not exist!");

 		giveplayerid = ReturnUser(tmp);
 		if(gTeam[playerid] == TEAM_COP)
		{
			if(gTeam[giveplayerid] == TEAM_COP) return SendClientMessage(playerid,0xAA3333AA,"You cannot taze police officers !");
			TogglePlayerControllable(giveplayerid,0);
			GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
			GetPlayerName(playerid,sendername,sizeof(sendername));
			format(tmp,sizeof(tmp),"You have tazed %s",giveplayer);
			SendClientMessage(playerid,0x33AA33AA,tmp);
  		format(tmp,sizeof(tmp),"You have been tazed by %s",sendername);
			SendClientMessage(giveplayerid,0xAA3333AA,tmp);
			PlayerTazed[playerid] = true;
  		SetTimerEx("Taze",8*1000,0,"i",playerid);
			}
 		return 1;
	}
If you could help me i will be really grateful and could stop begging others please help me out
Reply
#4

Same as before:
Quote:
Originally Posted by Don Correlli
Change:
pawn Код:
if(gTeam[playerid] == TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
to:
pawn Код:
if(gTeam[playerid] != TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
Reply
#5

Quote:
Originally Posted by Don Correlli
Same as before:
Quote:
Originally Posted by Don Correlli
Change:
pawn Код:
if(gTeam[playerid] == TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
to:
pawn Код:
if(gTeam[playerid] != TEAM_COP) SendClientMessage(playerid, COLOR_ORANGE, "Only Law Enforcement can use this command");
I have tryed that, it still displayers all the things i said...Can you tell me where to put it? because im still having same issue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)