taze command?
#1

Does this seem correct or should i alter it?
I just want 50% chance to succesfully taze a player, maybe 60 percent, however i have no clue on how to accomplish that.

Код:
CMD:taze(playerid, params[])
{
	new targetid;
	if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"{ff227a}[Syntax]:{ffffff} /taze [ID | Name]");
	if(gTeam[playerid] != TEAM_COP | TEAM_FBI | TEAM_CIA | TEAM_ARMY) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[Error]: {ffffff}This command is restricted to the LEO classes.");
	new time = tickcount() - 60000;
	if(time < TimerInfo[playerid][CMD_TAZE]) return SendClientMessage(playerid, -1, "{ff0000}[Error]: {ffffff}Please wait before using this command again.");
	TimerInfo[playerid][CMD_TAZE] = tickcount();
	if(targetid == playerid) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[Error]: {ffffff} You can not taze yourself.");
	if(GetPlayerWantedLevel(targetid) < 4) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[Error]: {ffffff} This player's wanted level is to low to be tazed.");
	if(GetDistanceBetweenPlayers(playerid, targetid) <= 5) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[Error]: {ffffff} This player is not close enough to be tazed.");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[Error]:{ffffff} This Player is not connected.");
	if(GetDistanceBetweenPlayers(playerid, targetid) <= 6)
		{
			if(TimerInfo[playerid][CMD_TAZE] == 0)
				{
					new Tazert = random(2);
					if(Tazert == 1)
					{
                        TogglePlayerControllable(targetid, 0);
                        stunned[targetid] = 1;
                        SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", targetid);
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "You failed to taze the dude");
				}
		}
	return 1;
}

forward stuntimer(targetid);
public stuntimer(targetid)
{
        stunned[targetid] = 0;
        TogglePlayerControllable(targetid, 1);
        SendClientMessage(targetid, COLOR_WHITE, "You have recovered from the tazer-shock");
}
Just wish to know if this is the correct way to use a taze command, with a random chance on succes.
Reply


Messages In This Thread
taze command? - by yvoms - 11.10.2016, 22:42
Re: taze command? - by Eoussama - 11.10.2016, 23:05
Re: taze command? - by azzerking - 11.10.2016, 23:51
Re: taze command? - by HeLiOn_PrImE - 11.10.2016, 23:57
Re: taze command? - by yvoms - 12.10.2016, 11:33
Re: taze command? - by yvoms - 14.10.2016, 00:37
Re: taze command? - by azzerking - 14.10.2016, 00:43
Re: taze command? - by yvoms - 14.10.2016, 00:59
Re: taze command? - by azzerking - 14.10.2016, 01:01
Re: taze command? - by yvoms - 14.10.2016, 01:05

Forum Jump:


Users browsing this thread: 1 Guest(s)