[HELP] Police Commands
#1

Hello guys,

I need a /tazer and /detain and /cuff command for cops.

If someone has it please direct me to the topic or file.
Reply
#2

Here is the link: http://forum.sa-mp.com/index.php?topic=30726.0
Reply
#3

Quote:
Originally Posted by joeri55
Hello guys,

I need a /tazer and /detain and /cuff command for cops.

If someone has it please direct me to the topic or file.
=

http://forum.sa-mp.com/index.php?topic=30726.0 -as said by roban-

OR

Godfather, moderntopia, sf-rp, and loads more :P
Reply
#4

I've got a tazer script now.

Quote:

#include <a_samp>

#define filterscript

#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//-------------- EDIT BELOW THIS LINE --------------
#define COLOR_KILLED 0x880000FF //The color, when a player gets killed by tazing
#define COLOR_ERROR 0xFF0000AA //The color of the message, when an error occurs
#define COLOR_MSG 0x00FFFFFF //Color of general messages
#define STUNNED_TIME 4 //The time in seconds the stun lasts
#define ANTISPAM 5 //The minimum allowed time between /taze commands
//-----------------NO NEED TO EDIT BELOW THIS LINE ---------------------

new stunned[MAX_PLAYERS];
new tazetime[MAX_PLAYERS];

stock ReturnPlayerName(ID)
{
new name[25];
GetPlayerName(ID, name, 25);
return name;
}

stock Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float1,Float:y1,Float:z1,Float3,Float:y3,Float :z3;
if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x3,y3,z3);
return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2 )+floatpower(floatabs(floatsub(y3,y1)),2)+floatpow er(floatabs(floatsub(z3,z1)),2));
}

forward stuntimer(taze);
forward tazetimer(i);

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*5000, 0, "i", taze);
}
}
else
{
new string[256], Floathlth;
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*5000, 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;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(taze, 4, cmdtext);
return 0;
}

public stuntimer(taze)
{
stunned[taze] = 0;
TogglePlayerControllable(taze, 1);
SendClientMessage(taze, COLOR_MSG, "You have recovered from the tazer-shock");
}
public tazetimer(i)
{
tazetime[i] = 0;
}

But how can I script that only cops can use it?
Reply
#5

Quote:
Originally Posted by joeri55
But how can I script that only cops can use it?
Check if player is a cop with if statement.
For example: if you have teams, check if he is in cop team.

PS: And post big codes at pastebin.
Reply
#6

Don,
Ok sorry for posting the big code.
You can see I am a n0b and I know. But I want to learn And I know the team from the cops is 2..

Can't you just gimme a easy script to edit so I can place it into my GM?
Reply
#7

Allready posted it here sorry for the other topic
Reply
#8

use
  • if(!gTeam[playerid] == TEAM_COPS ) {
    SendClientMessage(playerid, COLOR_BLUE,"Your Not a cop!!!!"); }
Reply
#9

Where must I place that in my script?

Damn man you know I am noob.. Can't you just give a small tut on how to do this?
Reply
#10

Place that at the start of your command. If you don't understand anything then learn the basics of pawn already.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)