/tazer
#1

For some wierd reason if I type /tazer it comes up unknown command

Код:
CMD:tazer(playerid, params[]) {

	new
		string[128],
		playerNames[2][MAX_PLAYER_NAME],
		target;

    if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] != 1) {
        SendClientMessage(playerid, COLOR_GREY, "You're not a law enforcement officer.");
		return 1;
    }
	target = GetClosestPlayer(playerid);
    if(groupVariables[playerVariables[target][pGroup]][gGroupType] == 1) {
        SendClientMessage(playerid, COLOR_GREY, "You can't taze other law enforcement officers.");
    }
    else {
	    if(IsPlayerInRangeOfPlayer(playerid, target, 7.5)) {
            if(playerVariables[target][pFreezeType] == 0 || playerVariables[target][pFreezeType] == 5) {
                if(!IsPlayerInAnyVehicle(target)) {

					GetPlayerName(playerid, playerNames[0], MAX_PLAYER_NAME);
					GetPlayerName(target, playerNames[1], MAX_PLAYER_NAME);

    				TogglePlayerControllable(target, 0);
    				playerVariables[target][pFreezeTime] = 15;
					playerVariables[target][pFreezeType] = 1;
					PlayerPlaySound(target, 1085, 0.0, 0.0, 0.0);
    	    		GameTextForPlayer(target,"~n~~r~Tazed!",4000,4);

    	    		format(string, sizeof(string), "* %s fires their tazer at %s, stunning them.", playerNames[0], playerNames[1]);
    	    		nearByMessage(playerid, COLOR_PURPLE, string);
					format(string, sizeof(string),"You have successfully stunned %s.", playerNames[1]);
					SendClientMessage(playerid, COLOR_NICESKY, string);
					PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
					ApplyAnimation(target,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
    	    	}
    	    	else SendClientMessage(playerid, COLOR_GREY, "You can't taze someone who is inside a vehicle.");
    	    }
    	    else SendClientMessage(playerid, COLOR_GREY, "That person has already been cuffed, stunned, or frozen.");
		}
		else SendClientMessage(playerid, COLOR_GREY, "Nobody is in range.");
	}
	return 1;
}
Reply
#2

Ok now it just tazers the player infront of you.
Reply
#3

Try Debug your code and find where it crashes.
Reply
#4

Код:
CMD:tazer(playerid, params[]) {
	if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1 && playerVariables[playerid][pGroup] != 0) {
	    switch(playerVariables[playerid][pTazer]) {
			case 0: {
			    givePlayerValidWeapon(playerid, 22);
			    playerVariables[playerid][pTazer] = 1;
			}
			case 1: {
			    removePlayerWeapon(playerid, 22);
			    playerVariables[playerid][pTazer] = 0;
			}
		}
	}
	return 1;
}

CMD:taser(playerid, params[]) {
	return cmd_tazer(playerid, params);
}

/*CMD:tazer(playerid, params[]) {

	new
		string[128],
		playerNames[2][MAX_PLAYER_NAME],
		target;

    if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] != 1) {
        SendClientMessage(playerid, COLOR_GREY, "You're not a law enforcement officer.");
		return 1;
    }
	target = GetClosestPlayer(playerid);
    if(groupVariables[playerVariables[target][pGroup]][gGroupType] == 1) {
        SendClientMessage(playerid, COLOR_GREY, "You can't taze other law enforcement officers.");
    }
    else {
	    if(IsPlayerInRangeOfPlayer(playerid, target, 7.5)) {
            if(playerVariables[target][pFreezeType] == 0 || playerVariables[target][pFreezeType] == 5) {
                if(!IsPlayerInAnyVehicle(target)) {

					GetPlayerName(playerid, playerNames[0], MAX_PLAYER_NAME);
					GetPlayerName(target, playerNames[1], MAX_PLAYER_NAME);

    				TogglePlayerControllable(target, 0);
    				playerVariables[target][pFreezeTime] = 15;
					playerVariables[target][pFreezeType] = 1;
					PlayerPlaySound(target, 1085, 0.0, 0.0, 0.0);
    	    		GameTextForPlayer(target,"~n~~r~Tazed!",4000,4);

    	    		format(string, sizeof(string), "* %s fires their tazer at %s, stunning them.", playerNames[0], playerNames[1]);
    	    		nearByMessage(playerid, COLOR_PURPLE, string);
					format(string, sizeof(string),"You have successfully stunned %s.", playerNames[1]);
					SendClientMessage(playerid, COLOR_NICESKY, string);
					PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
					ApplyAnimation(target,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
    	    	}
    	    	else SendClientMessage(playerid, COLOR_GREY, "You can't taze someone who is inside a vehicle.");
    	    }
    	    else SendClientMessage(playerid, COLOR_GREY, "That person has already been cuffed, stunned, or frozen.");
		}
		else SendClientMessage(playerid, COLOR_GREY, "Nobody is in range.");
	}
	return 1;
}*/
This is what I added and got no errors, and now when I do tazer it acts like a Normal pistol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)