/Drag Command
#1

Hello to you all
I need a little help
I want to make a /drag command for the pd, but i don't mean on that command to put a player in a car
I want that the cop (playerid) inputs that command and the id of another player (giveplayerid), and the giveplayerid can't move but follow's playerid
I know that i need to use a timer and a public, bud i don't know how to code this

Код:
	if(strcmp(cmd, "/drag", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(gTeam[playerid] == 2 || IsACop(playerid))
			{
				if(KnockedDown[playerid] == 1)
				{
					SendClientMessage(playerid, COLOR_GREY, "You are knocked down so you can't use this command.");
					return 1;
				}
				if(PlayerTied[playerid] == 1)
				{
					SendClientMessage(playerid, COLOR_GREY, "  You are tied!");
					return 1;
				}
			  tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "Use: /drag [Player ID/Part of Name]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
        new Float:vucix, Float:vuciy, Float:vuciz;

			  if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
				    if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
				    {
				      SendClientMessage(playerid, COLOR_GREY, "  You can't drag a cop!");
					    return 1;
				    }
						if (ProxDetectorS(8.0, playerid, giveplayerid))
						{
						  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You can't drag yourself!"); return 1; }
						  {
						    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
								GetPlayerName(playerid, sendername, sizeof(sendername));
						    format(string, sizeof(string), "* %s drags you.", sendername);
								SendClientMessage(giveplayerid, COLOR_WHITE, string);
								format(string, sizeof(string), "* You are draging %s-a.", giveplayer);
								SendClientMessage(playerid, COLOR_WHITE, string);
								format(string, sizeof(string), "* %s drags %s-a.", sendername ,giveplayer);
								ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
								TogglePlayerControllable(giveplayerid, 0);
		  					GetPlayerPos(playerid, vucix, vuciy, vuciz);
		  					SetPlayerPos(giveplayerid, vucix, vuciy, vuciz);
						  }

						}
						else
						{
						  SendClientMessage(playerid, COLOR_GREY, "  Player isn't near !");
						  return 1;
						}
					}
				}
				else
				{
				  SendClientMessage(playerid, COLOR_GREY, "  That player is offline !");
				  return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "  You are not a COP / FBI / SWAT !");
			}
		}
		return 1;
	}
so how to set up a timer here and a public that updates giveplayerid's position to playerid's position?
thanks
Reply
#2

bump ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)