Tazer bug
#1

Basically I got this bug, that when I go in game, the /tazer doesn't work, and nothing even shows up, what did I do wrong? Thank you.

Код:
if(strcmp(cmd, "/tazer", true) ==0 || strcmp(cmd, "/ta", true) ==0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(gTeam[playerid] == 2 || IsACop(playerid))
			{
			    if(IsPlayerInAnyVehicle(playerid))
			    {
			        SendClientMessage(playerid, COLOR_GREY, "   Cannot use this while being in the car.");
			        return 1;
			    }
			    new suspect = GetClosestPlayer(playerid);
			    if(IsPlayerConnected(suspect))
				{
				    if(PlayerCuffed[suspect] > 0)
				    {
				        SendClientMessage(playerid, COLOR_GREY, "   Player is already cuffed!");
				        return 1;
				    }
				    if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
					{
					    if(gTeam[suspect] == 2)
					    {
					        SendClientMessage(playerid, COLOR_GREY, "   Cannot taze other law enforcement members.");
					        return 1;
					    }
					    if(IsPlayerInAnyVehicle(suspect))
					    {
					        SendClientMessage(playerid, COLOR_GREY, "   Suspect is in the car, get him out first.");
					        return 1;
					    }
					    GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new randt = random(4)+1;
						if(randt == 1)
						{
						    format(string, sizeof(string), "* %s shoots with his Tazer at %s, but missed.", sendername ,giveplayer);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						}
						else
						{
							format(string, sizeof(string), "* You were Tazed by %s for 20 seconds.", sendername);
							SendClientMessage(suspect, COLOR_WHITE, string);
							format(string, sizeof(string), "* You Tazed %s for 20 seconds.", giveplayer);
							SendClientMessage(playerid, COLOR_WHITE, string);
							format(string, sizeof(string), "* %s shoots with his Tazer at %s and tazed him.", sendername ,giveplayer);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							GameTextForPlayer(suspect, "~r~Tazed", 2500, 3);
							TogglePlayerControllable(suspect, 0);
							LoopingAnim(suspect, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
							PlayerCuffed[suspect] = 1;
							PlayerCuffedTime[suspect] = 20;
						}
		            }
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "   No one is near you!");
					    return 1;
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "   You are not a law enforcement officer.");
			}
		}//not connected
	    return 1;
	}
Reply
#2

pawn Код:
if(strcmp(cmd, "/tazer", true) ==0 || strcmp(cmd, "/ta", true) ==0)
    {
            printf("a");
        if(IsPlayerConnected(playerid))
        {
                        printf("b");
            if(gTeam[playerid] == 2 || IsACop(playerid))
            {
                            printf("c");
                if(IsPlayerInAnyVehicle(playerid))
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Cannot use this while being in the car.");
                    return 1;
                }
                new suspect = GetClosestPlayer(playerid);
                if(IsPlayerConnected(suspect))
                {
                                    printf("d");
                    if(PlayerCuffed[suspect] > 0)
                    {
                                       printf("e");
                       SendClientMessage(playerid, COLOR_GREY, "   Player is already cuffed!");
                        return 1;
                    }
                    if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
                    {
                        if(gTeam[suspect] == 2)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   Cannot taze other law enforcement members.");
                            return 1;
                        }
                        if(IsPlayerInAnyVehicle(suspect))
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   Suspect is in the car, get him out first.");
                            return 1;
                        }
                        GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new randt = random(4)+1;
                        if(randt == 1)
                        {
                            format(string, sizeof(string), "* %s shoots with his Tazer at %s, but missed.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        }
                        else
                        {
                            format(string, sizeof(string), "* You were Tazed by %s for 20 seconds.", sendername);
                            SendClientMessage(suspect, COLOR_WHITE, string);
                            format(string, sizeof(string), "* You Tazed %s for 20 seconds.", giveplayer);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                            format(string, sizeof(string), "* %s shoots with his Tazer at %s and tazed him.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            GameTextForPlayer(suspect, "~r~Tazed", 2500, 3);
                            TogglePlayerControllable(suspect, 0);
                            LoopingAnim(suspect, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
                            PlayerCuffed[suspect] = 1;
                            PlayerCuffedTime[suspect] = 20;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "   No one is near you!");
                        return 1;
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not a law enforcement officer.");
            }
        }//not connected
        return 1;
    }
__________________
See upto which alphabet is printed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)