SA-MP Forums Archive
Cuffing players outside PD vehicles [SOLVED] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Cuffing players outside PD vehicles [SOLVED] (/showthread.php?tid=129557)



Cuffing players outside PD vehicles [SOLVED] - Lexuss - 22.02.2010

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


Re: Cuffing players outside PD vehicles - Torran - 22.02.2010

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


Re: Cuffing players outside PD vehicles - Lexuss - 22.02.2010

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;


Re: Cuffing players outside PD vehicles - Onyx09 - 22.02.2010

Код:
  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;



Re: Cuffing players outside PD vehicles - Lexuss - 22.02.2010

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

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

Just incase.


Re: Cuffing players outside PD vehicles - Lexuss - 22.02.2010

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
{




Re: Cuffing players outside PD vehicles - Lexuss - 22.02.2010

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

http://pastebin.com/m38028efa


Re: Cuffing players outside PD vehicles - adsy - 22.02.2010

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)


Re: Cuffing players outside PD vehicles - Torran - 22.02.2010

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?


Re: Cuffing players outside PD vehicles -Help?- - adsy - 22.02.2010

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