Whats wrong with that code?
#1

Please someone tell me whats wrong with that code, ohh and imma real beginner actually so maybe you could change it for me if you like.
Thank you!!
Код:
if (strcmp(cmd, "/tiri", true) == 0)
	{
	  if(gTeam[playerid] == 2 || IsACop(playerid))
		{
		  tmp = strtok(cmdtext, idx);
			giveplayerid = strval(tmp);
		  if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "KASUTA: /tiri [mдngija id]");
				return 1;
			}
			if(!IsPlayerConnected(giveplayerid))
			{
				format(string, sizeof(string), "%d is not an active player.", giveplayerid);
				SendClientMessage(playerid,COLOR_GREY, string);
				return 1;
			}
			if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 3)
			{
 				SendClientMessage(playerid, 0xFF0000AA, "You are too far away from that player.");
  			return 1;
  			}
  			if(giveplayerid == playerid)
			{
				SendClientMessage(playerid, COLOR_RED, "You cannot drag yourself!");
				return 1;
			}
			if(DragTimer[playerid] <= 0)
			{
				if(IsPlayerConnected(giveplayerid) == 1)
				{
				  GetPlayerName(giveplayerid, sendername, sizeof(sendername));
			  	GetPlayerName(playerid, playername, sizeof(playername));
				  format(string, sizeof(string), "Officer %s started dragging %s", playername, sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					DragTimer[playerid] = SetTimerEx("Drag", 1000, 1, "ii", playerid, giveplayerid);
					TogglePlayerControllable(giveplayerid, 0);
					return 1;
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "  You are not a Cop / FBI / Marine !");
		}
		return 1;
 	}
Reply
#2

Quote:
Originally Posted by Gucci's Label
Please someone tell me whats wrong with that code
Well ugh.. Mayhap state the problem ?
Reply
#3

we need to know whats ur problem.. :S i have looked at script 20 times but i dont know what to look after..
Reply
#4

that code is extreamly buggy, when your an cop and you use /tiri(/drag) it just starts dragging other players too, not everyone, just some players. I hope you knwo what i'm saying
Reply
#5

Quote:
Originally Posted by Gucci's Label
that code is extreamly buggy, when your an cop and you use /tiri(/drag) it just starts dragging other players too, not everyone, just some players. I hope you knwo what i'm saying
Do you mean it will drag players that are near, or randomly select some, and drag them too?
Reply
#6

Just randomly selecst someone, and drags them too.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)