SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/08/2011, 08:27 PM   #1
Kindred
High-roller
 
Join Date: Aug 2011
Posts: 1,650
Reputation: 504
Default Drag Command

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

pawn Code:
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:

Code:
(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
Kindred is offline   Reply With Quote
Old 31/08/2011, 08:54 PM   #2
Jafet_Macario
Huge Clucker
 
Jafet_Macario's Avatar
 
Join Date: Jul 2011
Posts: 439
Reputation: 64
Default Re: Drag Command

PHP Code:
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;

__________________
Jafet_Macario is offline   Reply With Quote
Old 01/09/2011, 06:05 AM   #3
Kindred
High-roller
 
Join Date: Aug 2011
Posts: 1,650
Reputation: 504
Default Re: Drag Command

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?
Kindred is offline   Reply With Quote
Old 01/09/2011, 06:09 AM   #4
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,010
Reputation: 133
Default Re: Drag Command

http://wiki.sa-mp.com/wiki/SetTimerEx
http://wiki.sa-mp.com/wiki/GetPlayerPos
http://wiki.sa-mp.com/wiki/SetPlayerPos
__________________
(RETIRED)
=WoR=Varth is offline   Reply With Quote
Old 01/09/2011, 06:17 AM   #5
Kindred
High-roller
 
Join Date: Aug 2011
Posts: 1,650
Reputation: 504
Default Re: Drag Command

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?
Kindred is offline   Reply With Quote
Old 01/09/2011, 06:19 AM   #6
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,010
Reputation: 133
Default Re: Drag Command

Quote:
Originally Posted by KurtBag View Post
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.
/me salutes.
__________________
(RETIRED)
=WoR=Varth is offline   Reply With Quote
Old 01/09/2011, 06:36 AM   #7
Kindred
High-roller
 
Join Date: Aug 2011
Posts: 1,650
Reputation: 504
Default Re: Drag Command

((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.
Kindred is offline   Reply With Quote
Old 04/09/2013, 04:15 AM   #8
gunjand1
Little Clucker
 
Join Date: Jul 2013
Posts: 3
Reputation: 0
Default Re: Drag Command

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 : [email protected] and in skype : gunjand11
gunjand1 is offline   Reply With Quote
Old 02/04/2014, 06:57 PM   #9
Crissand
Little Clucker
 
Join Date: Mar 2014
Posts: 2
Reputation: 0
Default Re: Drag Command

Hello, there, i need some help with my script please, www.international-gaming.boards.net Meet you here
Crissand is offline   Reply With Quote
Old 02/04/2014, 07:48 PM   #10
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,499
Reputation: 439
Default Re: Drag Command

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;
}
Abagail is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/Drag command - help Compton Help Archive 2 19/08/2011 12:25 PM
/drag command nickdadon Help Archive 0 30/01/2011 04:51 AM
/Drag Command Gigi-The-Beast Help Archive 1 06/06/2010 02:49 PM
/drag command Shellegg Help Archive 23 25/03/2009 12:50 PM


All times are GMT. The time now is 01:13 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.