Having some trouble with my /drag system
#1

Hello guys, i'm using ZCMD for my custom script, although i was testing a code wich my brother made and we are currently working on it, the /drag is fine as it detects if the player is cuffed or not but, there's a problem.. i can't drag him as nothing happends... not really sure what are we doing wrong, here's the code.

Код:
CMD:drag(playerid, params[])
{
	if(IsACop(playerid))
	{
		new string[128], giveplayerid;
		if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /drag [playerid]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(GetPVarInt(giveplayerid, "PlayerCuffed") == 2)
			{
				if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, " You must be out of the vehicle to use this command.");
				if(GetPVarInt(giveplayerid, "BeingDragged") == 1)
				{
					SendClientMessageEx(playerid, COLOR_WHITE, " That player is already being dragged. ");
					return 1;
				}
                new Float:dX, Float:dY, Float:dZ;
				GetPlayerPos(giveplayerid, dX, dY, dZ);
				if(!IsPlayerInRangeOfPoint(playerid, 5.0, dX, dY, dZ))
				{
					SendClientMessageEx(playerid, COLOR_GRAD2, " That suspect is not near you.");
					return 1;
				}
				format(string, sizeof(string), "* %s has is now dragging you.", GetPlayerNameEx(playerid));
				SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
				format(string, sizeof(string), "* You are now dragging %s, you may move them now.", GetPlayerNameEx(giveplayerid));
				SendClientMessageEx(playerid, COLOR_WHITE, string);
				format(string, sizeof(string), "* %s grabs ahold of %s and begins to move them.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				SendClientMessageEx(playerid, COLOR_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(playerid, COLOR_WHITE, " The specified player is not cuffed !");
			}
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GREY, "   You are not a LEO ! ");
		return 1;
	}
	return 1;
}
I was thinking that maybe changing GetPlayerPos(giveplayerid, dX, dY, dZ); to SetPlayerPos(giveplayerid, dX, dY, dZ); would actually move the player towards me, but tbh, I'm kinda lost.
Reply
#2

Oh btw i didn't define SetPVarInt(playerid, "BeingDragged", 1); since it's not letting me /drag the player, and SetPVarInt(giveplayerid, "BeingDragged", 1); has no effect, some help needed here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)