SA-MP Forums Archive
I need Drag and stop drag command - 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)
+--- Thread: I need Drag and stop drag command (/showthread.php?tid=466137)



I need Drag and stop drag command - Jizz - 26.09.2013

Can someone help me? Just create it please, I'll match the scripts with my GM.


Re: I need Drag and stop drag command - Voxel - 26.09.2013

From: https://sampforum.blast.hk/showthread.php?tid=280379

hope it works !

pawn Код:
CMD:drag(playerid, params[])
{
    new giveplayerid, giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128], DragOff[MAX_PLAYERS];
    if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /drag [playerid]");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "That Player is offline !");
    if(!ProxDetectorS(3.0, playerid, giveplayerid)) return SendClientMessage(playerid, COLOR_GREY,"That player isn't near you !");
    if(DragOff[giveplayerid] > 0) return SendClientMessage(playerid, COLOR_GREY,"You are already being Dragged!");
    if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You Cannot Drag Yourself!");
    if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid) || PlayerInfo[giveplayerid][pMember] == 2 || PlayerInfo[giveplayerid][pMember] == 6 || PlayerInfo[giveplayerid][pLeader] == 6)
    { return SendClientMessage(playerid, COLOR_GREY,"You can't drag cops"); }
    if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6)
    {
        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 return SendClientMessage(playerid, COLOR_GREY,"You are not a cop");
    return 1;
}



Re: I need Drag and stop drag command - Jizz - 26.09.2013

Not work bro


Re: I need Drag and stop drag command - ***Niko*** - 26.09.2013

Quote:
Originally Posted by Jizz
Посмотреть сообщение
Not work bro
Maybe you use strcmp...
try this

Код:
	if(strcmp(cmd, "/drag", true) == 0) 
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(!IsACop(playerid) && !IsAGovMember(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) || IsAnFbiCar(newcar) || IsAGovernmentCar(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;
	}
Command will place player in car on backseat.


Re: I need Drag and stop drag command - Jizz - 26.09.2013

I'm using ZCMD.


Re: I need Drag and stop drag command - adihanifsdr - 24.02.2014

It's work, but i need an undrag script can you help me