Change Player's Pos whene taking dammage?
#1

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.
Reply
#2

pawn Код:
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;
}
Reply
#3

This is already in the game though?
Reply
#4

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
pawn Код:
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;
}
Thank you !
Quote:
Originally Posted by ******
Посмотреть сообщение
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.
And this is exactly what i need , puching him back with falling animation
EDIT:
i tryed this :
pawn Код:
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;
}
but it will set his pos back only , i want making him like flying back whene i push him, thanks.
}
Reply
#5

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
pawn Код:
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;
}
I Agree With That

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
Reply
#6

thank you , but your code will gets player's Pos & put him back 4 metters only , i wanna make like flying back not change fastly his pos from x to x+4(i mean with flying or falling animation).
Reply
#7

Make it a little in the air to make it look like falling? o_O
Reply
#8

Quote:
Originally Posted by Gangs_Rocks
Посмотреть сообщение
Make it a little in the air to make it look like falling? o_O
yea lol , for example like Sparta Kick , whene he kicked him , he was falling back , wanna do like this..
Reply
#9

TESTED
pawn Код:
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;
}
Reply
#10

lol
[ame]http://www.youtube.com/watch?v=RAt_jiFHkc0[/ame]
ski to 148
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)