How To Make Only For Cops
#1

Hello Guyz Can Anyone Help me Pls With My Problem I Want To Make It This Command Only For Police/Cops,FBI,Army

Command:
Код:
dcmd_taze(playerid, params[])
{
	new taze = strval(params);
	if(!strlen(params))
	{
		SendClientMessage(playerid, COLOR_ERROR, "USAGE: /taze [ID]");
	}
	else
	{
		if(IsPlayerConnected(taze))
		{
			if(GetDistanceBetweenPlayers(playerid, taze) <= 6)
			{
				if(tazetime[playerid] == 0)
				{
					new tehtaze = random(5);
					if(tehtaze == 1 || tehtaze == 2 || tehtaze == 3 || tehtaze == 4)
					{
						new string[256], Float:thlth;
						format(string, sizeof(string), "%s (%i) has tazed you.",ReturnPlayerName(playerid), playerid);
						SendClientMessage(taze, COLOR_MSG, string);
						format(string, sizeof(string), "You have tazed %s (%i).",ReturnPlayerName(taze), taze);
						SendClientMessage(playerid, COLOR_MSG, string);
						GetPlayerHealth(taze, thlth);
						new Float:tehtaze3 = thlth-15-random(30);
						SetPlayerHealth(taze, tehtaze3);
						if(thlth < tehtaze3)
						{
							format(string, sizeof(string), "%s (%i) has been tazed to death", ReturnPlayerName(taze), taze);
							SendClientMessageToAll(COLOR_KILLED, string);
						}
						else
						{
							SendClientMessage(taze, COLOR_MSG, "You are stunned for a while.");
							TogglePlayerControllable(taze, 0);
							stunned[taze] = 1;
							tazetime[playerid] = 1;
							SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
							SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", taze);
						}
					}
					else
					{
						new string[256], Float:phlth;
						format(string, sizeof(string), "%s (%i) has accidentally held the tazer the wrong way and tazed himself",ReturnPlayerName(playerid), playerid);
						SendClientMessage(taze, COLOR_MSG, string);
						SendClientMessage(playerid, COLOR_MSG, "You accidentally held the tazer the wrong way and tazed yourself");
						GetPlayerHealth(playerid, phlth);
						new Float:tehtaze2 = phlth-25-random(30);
						SetPlayerHealth(playerid, tehtaze2);
						if(phlth < tehtaze2)
						{
							format(string, sizeof(string), "%s (%i) has been tazed to death",ReturnPlayerName(playerid), playerid);
							SendClientMessageToAll(COLOR_KILLED, string);
						}
						else
						{
							SendClientMessage(playerid, COLOR_MSG, "You are stunned for a while.");
							TogglePlayerControllable(playerid, 0);
							stunned[playerid] = 1;
							SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", playerid);
							SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
							tazetime[playerid] = 1;
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_MSG, "Please wait before tazing someone again!");
				}
			}
			else
			{
				new string[256];
				format(string, sizeof(string), "%s (%i) is not close enough to taze!", ReturnPlayerName(taze), taze);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_MSG, "That player is not connected!");
		}
	}
	return 1;
}
Pls Anyone Can Help Me? Thank You I Will Rep You!
Reply
#2

Add this on top of your script (If you dont have it).

Код:
new gTeam[MAX_PLAYERS];
Код:
dcmd_taze(playerid, params[])
{
	new taze = strval(params);
        if(gTeam[playerid] !=  TEAM_COPS) return SendClientMessage(playerid,COLOR_RED,"You are not a Cop/FBI/Soldier !"); // change this to your team
	if(!strlen(params))
	{
		SendClientMessage(playerid, COLOR_ERROR, "USAGE: /taze [ID]");
	}
	else
	{
		if(IsPlayerConnected(taze))
		{
			if(GetDistanceBetweenPlayers(playerid, taze) <= 6)
			{
				if(tazetime[playerid] == 0)
				{
					new tehtaze = random(5);
					if(tehtaze == 1 || tehtaze == 2 || tehtaze == 3 || tehtaze == 4)
					{
						new string[256], Float:thlth;
						format(string, sizeof(string), "%s (%i) has tazed you.",ReturnPlayerName(playerid), playerid);
						SendClientMessage(taze, COLOR_MSG, string);
						format(string, sizeof(string), "You have tazed %s (%i).",ReturnPlayerName(taze), taze);
						SendClientMessage(playerid, COLOR_MSG, string);
						GetPlayerHealth(taze, thlth);
						new Float:tehtaze3 = thlth-15-random(30);
						SetPlayerHealth(taze, tehtaze3);
						if(thlth < tehtaze3)
						{
							format(string, sizeof(string), "%s (%i) has been tazed to death", ReturnPlayerName(taze), taze);
							SendClientMessageToAll(COLOR_KILLED, string);
						}
						else
						{
							SendClientMessage(taze, COLOR_MSG, "You are stunned for a while.");
							TogglePlayerControllable(taze, 0);
							stunned[taze] = 1;
							tazetime[playerid] = 1;
							SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
							SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", taze);
						}
					}
					else
					{
						new string[256], Float:phlth;
						format(string, sizeof(string), "%s (%i) has accidentally held the tazer the wrong way and tazed himself",ReturnPlayerName(playerid), playerid);
						SendClientMessage(taze, COLOR_MSG, string);
						SendClientMessage(playerid, COLOR_MSG, "You accidentally held the tazer the wrong way and tazed yourself");
						GetPlayerHealth(playerid, phlth);
						new Float:tehtaze2 = phlth-25-random(30);
						SetPlayerHealth(playerid, tehtaze2);
						if(phlth < tehtaze2)
						{
							format(string, sizeof(string), "%s (%i) has been tazed to death",ReturnPlayerName(playerid), playerid);
							SendClientMessageToAll(COLOR_KILLED, string);
						}
						else
						{
							SendClientMessage(playerid, COLOR_MSG, "You are stunned for a while.");
							TogglePlayerControllable(playerid, 0);
							stunned[playerid] = 1;
							SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", playerid);
							SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
							tazetime[playerid] = 1;
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_MSG, "Please wait before tazing someone again!");
				}
			}
			else
			{
				new string[256];
				format(string, sizeof(string), "%s (%i) is not close enough to taze!", ReturnPlayerName(taze), taze);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_MSG, "That player is not connected!");
		}
	}
	return 1;
}
Now the entire team_cops can only use it , tell me if you want it for exact skin ids.

EDIT: If you want only exact skin ids to be able to use it, delete the gTeam line and put this one.

Код:
for(new i=0;i<MAX_PLAYERS;i++) {
    if(GetPlayerSkin(i) == 285 || GetPlayerSkin(i) == 282 || GetPlayerSkin(i) == 280 || GetPlayerSkin(i) == 265 || GetPlayerSkin(i) == 266 ||GetPlayerSkin(i) == 267  || GetPlayerSkin(i) == 165 || GetPlayerSkin(i) == 286 || GetPlayerSkin(i) == 284 || GetPlayerSkin(i) == 166 || GetPlayerSkin(i) == 283) {
Reply
#3

<Remove>
Reply
#4

Код:
pds2012;2150387]C:\Users\GMZeus\Desktop\Cops Robbers Project\filterscripts\TazeCommand.pwn(44) : error 017: undefined symbol "TEAM_COPS"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I Got Error..[/QUOTE]
Reply
#5

<Remove>
Reply
#6

That means your Cops,FBI, Army team isnt TEAM_COPS, check somewhere on top of your script for your team defines, you could find something like that -

Код:
#define TEAM_GROVE 1
#define TEAM_BALLAS 2
#define TEAM_VAGOS 3
#define TEAM_AZTECAS 4
#define TEAM_COPS 5
or simply try using this one


Код:
dcmd_taze(playerid, params[])
{
	new taze = strval(params);
        for(new i=0;i<MAX_PLAYERS;i++) {
        if(GetPlayerSkin(i) == 285 || GetPlayerSkin(i) == 282 || GetPlayerSkin(i) == 280 || GetPlayerSkin(i) == 265 || GetPlayerSkin(i) == 266 ||GetPlayerSkin(i) == 267  || GetPlayerSkin(i) == 165 || GetPlayerSkin(i) == 286 || GetPlayerSkin(i) == 284 || GetPlayerSkin(i) == 166 || GetPlayerSkin(i) == 283) {
    
	if(!strlen(params))
	{
		SendClientMessage(playerid, COLOR_ERROR, "USAGE: /taze [ID]");
	}
	else
	{
		if(IsPlayerConnected(taze))
		{
			if(GetDistanceBetweenPlayers(playerid, taze) <= 6)
			{
				if(tazetime[playerid] == 0)
				{
					new tehtaze = random(5);
					if(tehtaze == 1 || tehtaze == 2 || tehtaze == 3 || tehtaze == 4)
					{
						new string[256], Float:thlth;
						format(string, sizeof(string), "%s (%i) has tazed you.",ReturnPlayerName(playerid), playerid);
						SendClientMessage(taze, COLOR_MSG, string);
						format(string, sizeof(string), "You have tazed %s (%i).",ReturnPlayerName(taze), taze);
						SendClientMessage(playerid, COLOR_MSG, string);
						GetPlayerHealth(taze, thlth);
						new Float:tehtaze3 = thlth-15-random(30);
						SetPlayerHealth(taze, tehtaze3);
						if(thlth < tehtaze3)
						{
							format(string, sizeof(string), "%s (%i) has been tazed to death", ReturnPlayerName(taze), taze);
							SendClientMessageToAll(COLOR_KILLED, string);
						}
						else
						{
							SendClientMessage(taze, COLOR_MSG, "You are stunned for a while.");
							TogglePlayerControllable(taze, 0);
							stunned[taze] = 1;
							tazetime[playerid] = 1;
							SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
							SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", taze);
						}
					}
					else
					{
						new string[256], Float:phlth;
						format(string, sizeof(string), "%s (%i) has accidentally held the tazer the wrong way and tazed himself",ReturnPlayerName(playerid), playerid);
						SendClientMessage(taze, COLOR_MSG, string);
						SendClientMessage(playerid, COLOR_MSG, "You accidentally held the tazer the wrong way and tazed yourself");
						GetPlayerHealth(playerid, phlth);
						new Float:tehtaze2 = phlth-25-random(30);
						SetPlayerHealth(playerid, tehtaze2);
						if(phlth < tehtaze2)
						{
							format(string, sizeof(string), "%s (%i) has been tazed to death",ReturnPlayerName(playerid), playerid);
							SendClientMessageToAll(COLOR_KILLED, string);
						}
						else
						{
							SendClientMessage(playerid, COLOR_MSG, "You are stunned for a while.");
							TogglePlayerControllable(playerid, 0);
							stunned[playerid] = 1;
							SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", playerid);
							SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
							tazetime[playerid] = 1;
						}
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_MSG, "Please wait before tazing someone again!");
				}
			}
			else
			{
				new string[256];
				format(string, sizeof(string), "%s (%i) is not close enough to taze!", ReturnPlayerName(taze), taze);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_MSG, "That player is not connected!");
		}
	}
	return 1;
}
Reply
#7

Its Bug.. There /Cops/Army/CIA/FBI Cant Use This Command..

Pls Fix And The Command You Have Just Give to me Got Error
Код:
C:\Users\GMZeus\Desktop\Cops Robbers Project\filterscripts\TazeCommand.pwn(134) : error 029: invalid expression, assumed zero
C:\Users\GMZeus\Desktop\Cops Robbers Project\filterscripts\TazeCommand.pwn(134) : error 004: function "OnPlayerCommandText" is not implemented
C:\Users\GMZeus\Desktop\Cops Robbers Project\filterscripts\TazeCommand.pwn(136) : error 017: undefined symbol "cmdtext"
C:\Users\GMZeus\Desktop\Cops Robbers Project\filterscripts\TazeCommand.pwn(136) : error 029: invalid expression, assumed zero
C:\Users\GMZeus\Desktop\Cops Robbers Project\filterscripts\TazeCommand.pwn(136) : warning 215: expression has no effect
C:\Users\GMZeus\Desktop\Cops Robbers Project\filterscripts\TazeCommand.pwn(136) : error 001: expected token: ";", but found "]"
C:\Users\GMZeus\Desktop\Cops Robbers Project\filterscripts\TazeCommand.pwn(136) : fatal error 107: too many error messages on one line

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


6 Errors.
If U Want To Fix It Via Teamviewer
ID:870 752 264
Password:d8qv56
Reply
#8

I have to download it first... anyways, I will try to help you wait a second
Reply
#9

Rep Added Thnx Dizzle!
Reply
#10

I also need help with this guys...I got your CMD for my server (Thanks ,rep added) but i get the same errors you got....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)