Cuffing players outside PD vehicles [SOLVED]
#1

Im looking for someone who could tell me how to Cuff players outside your police vehicle, like where ever you are that you can cuff players
Ive been trying over and over and whatever I tried I kept getting more errors,
anyone has suggestions?

Thanks in advance,
Greets
Reply
#2

Remove the IsPlayerInAVehicle or w/e it is from the cuff command,
Post it here and il do it for you if you want
Reply
#3

Thanks for the fast Reply!
Here it is,

if(strcmp(cmd, "/cuff", true) == 0 || strcmp(cmd, "/cu", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
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] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Player already Cuffed !");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
new car = GetPlayerVehicleID(playerid);
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Cuff yourself!"); return 1; }
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2 && IsPlayerInVehicle(giveplayerid, car))
{
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_WHITE, string);
format(string, sizeof(string), "* You Cuffed %s, till uncuff.", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, 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_PURPL E,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
TogglePlayerControllable(giveplayerid, 0);
PlayerCuffed[giveplayerid] = 2;
PlayerCuffedTime[giveplayerid] = 99999999999999;
Reply
#4

Код:
  if(strcmp(cmd, "/cuff", true) == 0 || strcmp(cmd, "/cu", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
     if(gTeam[playerid] == 2 || IsACop(playerid))
     {
       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] > 0)
          {
            SendClientMessage(playerid, COLOR_GREY, "  Player already Cuffed !");
            return 1;
          }
         if (ProxDetectorS(8.0, playerid, giveplayerid))
         {
           new car = GetPlayerVehicleID(playerid);
           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_WHITE, string);
            format(string, sizeof(string), "* You Cuffed %s, till uncuff.", giveplayer);
            SendClientMessage(playerid, COLOR_WHITE, 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] = 99999999999999;
Reply
#5

Thanks alot, Im going to test it right now =)

I made a Pastebin link too,
http://pastebin.com/m705f88bf

Just incase.
Reply
#6

C:\Users\Lex\Desktop\GMs from Scratch\gamemodes\LexRole1.pwn(36423) : error 029: invalid expression, assumed zero
C:\Users\Lex\Desktop\GMs from Scratch\gamemodes\LexRole1.pwn(36406) : warning 204: symbol is assigned a value that is never used: "car"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

new car = GetPlayerVehicleID(playerid); = line 36406


}
else = 36423
{

Reply
#7

This is the whole command of /cuff with the return at the end
maybe this helps more

http://pastebin.com/m38028efa
Reply
#8

Quote:
Originally Posted by Lexuss
C:\Users\Lex\Desktop\GMs from Scratch\gamemodes\LexRole1.pwn(36423) : error 029: invalid expression, assumed zero
C:\Users\Lex\Desktop\GMs from Scratch\gamemodes\LexRole1.pwn(36406) : warning 204: symbol is assigned a value that is never used: "car"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

new car = GetPlayerVehicleID(playerid); = line 36406


}
else = 36423
{

best to do

Код:
new car;
car = GetPlayerVehicleID(playerid);
its saying that your not manipulating the variable car

ie

if(car == 1)
Reply
#9

Quote:
Originally Posted by adsy
Quote:
Originally Posted by Lexuss
C:\Users\Lex\Desktop\GMs from Scratch\gamemodes\LexRole1.pwn(36423) : error 029: invalid expression, assumed zero
C:\Users\Lex\Desktop\GMs from Scratch\gamemodes\LexRole1.pwn(36406) : warning 204: symbol is assigned a value that is never used: "car"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

new car = GetPlayerVehicleID(playerid); = line 36406


}
else = 36423
{

best to do

Код:
new car;
car = GetPlayerVehicleID(playerid);
Cant he just delete that line? If car isent used then theres surely no need for it?
Reply
#10

good point but it depends on the rest of that section of code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)