Drag Command
#1

I need some help with this command i edited from another post on the forum.

pawn Код:
CMD:drag(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
        {
            new giveplayerid;
            if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /drag [playerid]");
        }
        if(IsPlayerConnected(giveplayerid))
        {
            if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
            {
                SendClientMessage(playerid, COLOR_GREY, " You can't drag Cops !");
            return 1;
            }
            if(DragOff[giveplayerid] > 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "  You Are already being Dragged!");
            return 1;
            }
            if (ProxDetectorS(3.0, playerid, giveplayerid))
            {
               if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!"); return 1; }
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* You are being dragged by %s,", sendername);
                SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "* You begin to drag %s,", giveplayer);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "* %s has started to drag %s.", sendername ,giveplayer);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                TogglePlayerControllable(giveplayerid, 0);
                DragOff[giveplayerid] = playerid;

         }
         else
         {
           SendClientMessage(playerid, COLOR_GREY, "  That Player is not near you !");
           return 1;
         }
        }
      }
      else
      {
        SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
        return 1;
      }
     }
     else
     {
      SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop / FBI / National Guard!");
     }
   }
   return 1;
  }
  CMD:stopdrag(playerid, params[])
  {
    if(IsPlayerConnected(playerid))
    {
        if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
        {
            new string[128], giveplayerid
            if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /drag [playerid]");
        return 1;
        }
        if(IsPlayerConnected(giveplayerid))
        {
            if (ProxDetectorS(3.0, playerid, giveplayerid))
            {
           if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot stop dragging yourself!"); return 1; }
           if(DragOff[giveplayerid] > 0)
           {
             GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
             format(string, sizeof(string), "* %s stopped dragging you.", sendername);
            SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
            format(string, sizeof(string), "* You stopped dragging %s.", giveplayer);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            TogglePlayerControllable(giveplayerid, 1);
            DragOff[giveplayerid] = 0;
           }
           else
           {
             SendClientMessage(playerid, COLOR_GREY, "  That player isn't being dragged !");
             return 1;
           }
         }
         else
         {
           SendClientMessage(playerid, COLOR_GREY, "  That player is not near you !");
           return 1;
         }
        }
      }
      else
      {
        SendClientMessage(playerid, COLOR_GREY, "  That player is Offline !");
        return 1;
      }
     }
     else
     {
      SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop / FBI / Navy / National Guard !");
     }
   }//not connected
   return 1;
  }
these are the errors i get:

Код:
(55467) : error 017: undefined symbol "giveplayerid"
(55472) : warning 217: loose indentation
(55474) : error 017: undefined symbol "DragOff"
(55474) : error 017: undefined symbol "giveplayerid"
(55474) : error 029: invalid expression, 
(55474) : fatal error 107: too many error messages on one line
Reply
#2

PHP код:
CMD:drag(playeridparams[])
{
    new 
giveplayeridgiveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128], DragOff[MAX_PLAYERS];
    if(
sscanf(params,"u",giveplayerid)) return SendClientMessage(playeridCOLOR_WHITE,"USAGE: /drag [playerid]");
    if(!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_GREY"That Player is offline !");
    if(!
ProxDetectorS(3.0playeridgiveplayerid)) return SendClientMessage(playeridCOLOR_GREY,"That player isn't near you !");
    if(
DragOff[giveplayerid] > 0) return SendClientMessage(playeridCOLOR_GREY,"You are already being Dragged!");
    if(
giveplayerid == playerid) return SendClientMessage(playeridCOLOR_GREY"You Cannot Drag Yourself!");
    if(
gTeam[giveplayerid] == || IsACop(giveplayerid) || PlayerInfo[giveplayerid][pMember] == || PlayerInfo[giveplayerid][pMember] == || PlayerInfo[giveplayerid][pLeader] == 6)
    { return 
SendClientMessage(playeridCOLOR_GREY,"You can't drag cops"); }
    if(
gTeam[playerid] == || IsACop(playerid) || PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == 6)
    {
        
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
        
GetPlayerName(playeridsendernamesizeof(sendername));
        
format(stringsizeof(string), "* You are being dragged by %s,"sendername);
        
SendClientMessage(giveplayeridCOLOR_LIGHTBLUEstring);
         
format(stringsizeof(string), "* You begin to drag %s,"giveplayer);
         
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
         
format(stringsizeof(string), "* %s has started to drag %s."sendername ,giveplayer);
         
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
         
TogglePlayerControllable(giveplayerid0);
         
DragOff[giveplayerid] = playerid;
    }
    else return 
SendClientMessage(playeridCOLOR_GREY,"You are not a cop");
    return 
1;

Reply
#3

Is there a way for him to actually be following me when i do this? As i've seen on other servers, they float behind then when they walk, anyway to do it like that?
Reply
#4

https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/GetPlayerPos
https://sampwiki.blast.hk/wiki/SetPlayerPos
Reply
#5

Can you help me with it? Like, maybe make it for me out of my already made command? I'm guessing thats a no though, if not, this is what im wondering.

Due to the links you gave me and the order there in, are you telling me to make a timer so when a certain amount of time goes by ((like one second)) It gets my position and re-positions the man getting dragged a little behind me?
Reply
#6

Quote:
Originally Posted by KurtBag
Посмотреть сообщение
Can you help me with it? Like, maybe make it for me out of my already made command? I'm guessing thats a no though, if not, this is what im wondering.

Due to the links you gave me and the order there in, are you telling me to make a timer so when a certain amount of time goes by ((like one second)) It gets my position and re-positions the man getting dragged a little behind me?
You got the point.
* =WoR=Varth salutes.
Reply
#7

((Copied from double thread)) Well... i need a basic way to make it so that it GetPlayerPos's my position, then sets the giveplayerid's position slightly a little behind my character. Can someone show me a simple example? Thats all im asking, since i'm a Basic Scripter.
Reply
#8

Dude i have scriptted a server i need you to become my scripter and i will make you cheif of FBI or a family or faction of your choice email me : gunjand1@gmail.com and in skype : gunjand11
Reply
#9

Hello, there, i need some help with my script please, www.international-gaming.boards.net Meet you here
Reply
#10

You can call a timer in the drag command for something like this:

forward DragPlayer(playerid, giveplayerid);
public DragPlayer(playerid, giveplayerid)
{
if(giveplayerid == INVALID_PLAYER_ID) return 0;
if(Dragging[playerid] != INVALID_PLAYER_ID)
{
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(giveplayerid, x, y, z);
(Call the timer again if you want)
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)