19.06.2012, 18:26
Hey , i wanna whene i give dammage to other player , with Unarmed weapon(Punch) , sending him back 4metters, how to done it ? & which function to use ? thanks.
OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
if(weaponid == 0 || weaponid == 1) //Fist or Brass Knuckles
{
//GetPlayerPos and SetPlyaerPos here
}
}
return 1;
}
pawn Код:
|
You might want to look in to the player velocity functions so that instead of them being teleported back 4 metres, you can push them back. You could even write code to accelerate and decelerate them, or apply one of the falling backwards animations.
|
Public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(weaponid == 0 )
{
new Float:x,Float:y,Float:z
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x-4,y,z);
ApplyAnimation(playerid,????);
}
return 1;
}
pawn Код:
|
OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new Float:p_pos[3];
GetPlayerPos(playerid, p_pos[0], p_pos[1], p_pos[2]);
if(issuerid != INVALID_PLAYER_ID)
{
if(weaponid == 0 || weaponid == 1) //Fist or Brass Knuckles
{
SetPlayerPos(playerid, p_pos[0], p_pos[1], p_pos[2]+4.0);
}
}
return 1;
}
//not tested
OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
if(weaponid == 0 || weaponid == 1) //Fist or Brass Knuckles
{
SetPlayerVelocity(playerid,0.2,0,0.1);
SetTimerEx("Velocity",400,false,"i",playerid);
}
}
return 1;
}
forward Velocity(playerid);
public Velocity(playerid)
{
SetPlayerVelocity(playerid,0,0,0);
return 1;
}