/drag Request/Help
#1

Can someone please make a /drag command the makes the player follow them (as long as the player is near-by). I need this for the police in a RP script. Thanks to whoever can. (I will +1 Rep if you help)

Example: /drag 3 - If player 3 is in range they will be dragged with the person.


Thanks: jakejohnsonusa
Reply
#2

Give me 10 mins and ill get one for you.
Reply
#3

Try This

pawn Код:
if(strcmp(cmd, "/drag", true) == 0) // by LordMan
    {
        if(IsPlayerConnected(playerid))
        {
            if(!IsACop(playerid))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You are not a cop!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid/PartOfName]");
                return 1;
            }
            if(PlayerInfo[playerid][pDBanned] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop Duty!");
                return 1;
            }
            new newcar = GetPlayerVehicleID(playerid);
            new playa;
            playa = ReturnUser(tmp);
            if(IsACopCar(newcar) || IsNgCar(newcar))
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        new Float:x, Float:y, Float:z;
                        GetPlayerPos(playa,x,y,z);
                        if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
                        {
                            PutPlayerInVehicle(playa,newcar,1);
                            GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s drags %s to his/her car/moped.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            new y1, m, d;
                            new h,mi,s;
                            getdate(y1,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /drag %s",d,m,y1,h,mi,s,sendername,giveplayer);
                            CommandLog(string);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You are not in police vehicle!");
            }
        }
        return 1;
    }
Reply
#4

Thanks! But I tried it and It crashed/can't compile.
Reply
#5

Can anyone make/fix this please? I can not find a good /drag system anywhere... please...

Thanks so much if you can!
Reply
#6

pawn Код:
if(strcmp(cmd, "/drag", true) == 0) // by LordMan
{
    if(IsPlayerConnected(playerid))
    {
        if(!IsACop(playerid))
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You are not a cop!");
            return 1;
        }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid/PartOfName]");
            return 1;
        }
        if(PlayerInfo[playerid][pDBanned] == 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop Duty!");
            return 1;
        }
        new newcar = GetPlayerVehicleID(playerid);
        new playa;
        playa = ReturnUser(tmp);
        if(IsACopCar(newcar) || IsNgCar(newcar))
        {
            if(IsPlayerConnected(playa))
            {
                if(playa != INVALID_PLAYER_ID)
                {
                    new Float:x, Float:y, Float:z;
                    GetPlayerPos(playa,x,y,z);
                    if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
                    {
                        PutPlayerInVehicle(playa,newcar,1);
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        format(string, sizeof(string), "* %s drags %s to his/her car/moped.", sendername ,giveplayer);
                        ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                        new y1, m, d;
                        new h,mi,s;
                        getdate(y1,m,d);
                        gettime(h,mi,s);
                        format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /drag %s",d,m,y1,h,mi,s,sendername,giveplayer);
                        CommandLog(string);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "Invalid Player Especify
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GRAD1, "
You are not in police vehicle!");
        }
    }
    return 1;
}
Reply
#7

Again my compiler stops working and wont compile... Is this a FILESCRIPT? If not can someone make it into one please... +1 Rep added for the help.
Reply
#8

pawn Код:
if(strcmp(cmd, "/drag", true) == 0) // by LordMan
{
    if(IsPlayerConnected(playerid))
    {
        if(!IsACop(playerid))
        {
            SendClientMessage(playerid, COLOR_GRAD1, "You are not a cop!");
            return 1;
        }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid/PartOfName]");
            return 1;
        }
        if(PlayerInfo[playerid][pDBanned] == 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop Duty!");
            return 1;
        }
        new newcar = GetPlayerVehicleID(playerid);
        new playa;
        playa = ReturnUser(tmp);
        if(IsACopCar(newcar) || IsNgCar(newcar))
        {
            return SendClientMessage(playerid, COLOR_GRAD1, "You are not in police vehicle!");
        }
        if(IsPlayerConnected(playa))
        {
            if(playa != INVALID_PLAYER_ID)
            {
                new Float:x, Float:y, Float:z;
                GetPlayerPos(playa,x,y,z);
                if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
                {
                    PutPlayerInVehicle(playa,newcar,1);
                    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                    format(string, sizeof(string), "* %s drags %s to his/her car/moped.", sendername ,giveplayer);
                    ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                    new y1, m, d;
                    new h,mi,s;
                    getdate(y1,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /drag %s",d,m,y1,h,mi,s,sendername,giveplayer);
                    CommandLog(string);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
                }
            }
        }
    }
    return 1;
}
now try this
Reply
#9

It doesn't it just "Pawn Compiler library has stopped working" Close program...
Reply
#10

It's because you have too many errors that it says that it stop working.I bet you didn't place the codes at the right place, you don't have IsACop defines, strtok, PlayerInfo, COLOR_GREY, IsACopCar, IsNgCar, ect.
The codes wont work before all of the things are defined properly and placed a the good place. Taking codes from an other script doesn't help you at all for learning and it's not always good. You should try making a basic, then we can help you, tell you your mistakes.
Reply
#11

What command proccesser are you using?
Reply
#12

0.3e Pawn.exe, windows version... If this is working can someone upload the .pwn and .amx ... thanks!
Reply
#13

Try This;

PHP Code:
if(strcmp(cmd"/drag"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(!
IsACop(playerid))
            {
                
SendClientMessage(playeridCOLOR_GRAD1"You are not a cop!");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /drag [playerid/PartOfName]");
                return 
1;
            }
            if(
PlayerInfo[playerid][pDBanned] == 1)
            {
                
SendClientMessage(playeridCOLOR_GREY"** You are Banned From Cop Duty!");
                 return 
1;
            }
            new 
newcar GetPlayerVehicleID(playerid);
            new 
playa;
            
playa ReturnUser(tmp);
            if(
IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar))
            {
                if(
IsPlayerConnected(playa))
                {
                    if(
playa != INVALID_PLAYER_ID)
                    {
                        new 
Float:xFloat:yFloat:z;
                        
GetPlayerPos(playa,x,y,z);
                        if(
IsPlayerInRangeOfPoint(playerid5xyz))
                        {
                            
PutPlayerInVehicle(playa,newcar,1);
                            
GetPlayerName(playagiveplayersizeof(giveplayer));
                            
format(stringsizeof(string), "* %s drags %s to his/her car/moped."sendername ,giveplayer);
                            
ProxDetector(30.0playeridstringCOLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            new 
y1md;
                            new 
h,mi,s;
                            
getdate(y1,m,d);
                            
gettime(h,mi,s);
                            
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /drag %s",d,m,y1,h,mi,s,sendername,giveplayer);
                            
CommandLog(string);
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_GREY"Player is not near you.");
                        }
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1"You are not in police vehicle!");
            }
        }
        return 
1;
    } 
Or This!

PHP Code:
CMD:drag(playeridparams[])
{
    if(
IsACop(playerid))
    {
        new 
string[128], giveplayerid;
        if(
sscanf(params"u"giveplayerid)) return SendClientMessageEx(playeridCOLOR_GREY"USAGE: /drag [playerid]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
GetPVarInt(giveplayerid"PlayerCuffed") == 2)
            {
                if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playeridCOLOR_WHITE" You must be out of the vehicle to use this command.");
                if(
GetPVarInt(giveplayerid"BeingDragged") == 1)
                {
                    
SendClientMessageEx(playeridCOLOR_WHITE" That person is already being dragged. ");
                    return 
1;
                }
                new 
Float:dXFloat:dYFloat:dZ;
                
GetPlayerPos(giveplayeriddXdYdZ);
                if(!
IsPlayerInRangeOfPoint(playerid5.0dXdYdZ))
                {
                    
SendClientMessageEx(playeridCOLOR_GRAD2" That suspect is not near you.");
                    return 
1;
                }
                
format(stringsizeof(string), "* %s has is now dragging you."GetPlayerNameEx(playerid));
                
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
                
format(stringsizeof(string), "* You are now dragging %s, you may move them now."GetPlayerNameEx(giveplayerid));
                
SendClientMessageEx(playeridCOLOR_WHITEstring);
                
format(stringsizeof(string), "* %s grabs ahold of %s and begins to move them."GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
SendClientMessageEx(playeridCOLOR_WHITE"You are now dragging the suspect, press the '{AA3333}FIRE{FFFFFF}' button to stop.");
                
SetPVarInt(giveplayerid"BeingDragged"1);
                
SetPVarInt(playerid"DraggingPlayer"giveplayerid);
            }
            else
            {
                
SendClientMessageEx(playeridCOLOR_WHITE" The specified person is not cuffed !");
            }
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GREY"   You are not a LEO ! ");
        return 
1;
    }
    return 
1;

Enjoy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)