/tackle command ( SCCANF )
#1

Hello there,
I made myself a nice little /tackle command but..
I want it that players can only tackle if they are MOVING.
If they're standing still they CAN'T tackle..
I think I need to do it with OnPlayerKeyStateChange or something, but I'm not sure.
Can anyone help me out, please?

/tackle:

Код:
forward Tackle(playerid);
forward waitfortackle(playerid);

	//--------------------TACKLE-------------------------//
	dcmd_tackle(playerid, params[])
	{
	new
		id;
	if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /tackle [Playerid/Part of Playername]");
	else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
	else if(Vantispam[playerid] == 0)
	{
	if(GetDistanceBetweenPlayers(playerid, id) < 3)
	{
	if (!IsPlayerInAnyVehicle(id))
	{
	if(ResultChance(40))//40 procent kans dat het fout gaat
 	{
	new string[48];
	new strings[48];
	new tacklename[MAX_PLAYERS];
	new tackledname[MAX_PLAYERS];
	GetPlayerName(playerid, tacklename, sizeof(tacklename));
	format(string, sizeof(string), "You have been tackled by %s!",tacklename);
	TogglePlayerControllable(id, false);
	SendClientMessage(id,0xAA3333AA,string);
	GetPlayerName(id, tackledname, sizeof(tackledname));
	format(strings, sizeof(strings), "You have tackled %s!",tackledname);
	SendClientMessage(playerid,0xAA3333AA,strings);
	SetTimerEx("Tackle", 3000, false, "u", id);
	ApplyAnimation(id,"CRACK","crckdeth2",4.0,0,0,0,1,1);
	Vantispam[playerid] = 1;
	SetTimerEx("waitfortackle", 60000, false, "i", playerid);
	}else{
	  SendClientMessage(id,0xAA3333AA,"It failed!");
	}
	}else{
	  SendClientMessage(id,0xAA3333AA,"You need to wait before tackle again!");
	}
	}
	}
	if(GetDistanceBetweenPlayers(playerid, id) > 3)
	{
	SendClientMessage(playerid,0xAA3333AA,"Player is to far away!");
	}
	if(IsPlayerInAnyVehicle(id))
	{
	SendClientMessage(playerid,0xAA3333AA,"You can't tackle somebody when he's in a car!");
	}
	return 1;
	}
	
public Tackle(playerid)
{
	TogglePlayerControllable(playerid, true);
	ClearAnimations(playerid);
	return 1;
}
public waitfortackle(playerid)
{
	Vantispam[playerid] = 0;
	return 1;
}
Reply


Messages In This Thread
/tackle command ( SCCANF ) - by Pawno_Master - 02.05.2010, 12:11
Re: /tackle command ( SCCANF ) - by Dark_Kostas - 02.05.2010, 12:18
Re: /tackle command ( SCCANF ) - by Pawno_Master - 02.05.2010, 14:30
Re: /tackle command ( SCCANF ) - by Pawno_Master - 02.05.2010, 15:30
Re: /tackle command ( SCCANF ) - by Pawno_Master - 02.05.2010, 19:04

Forum Jump:


Users browsing this thread: 1 Guest(s)