SA-MP Forums Archive
Change Player's Pos whene taking dammage? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Change Player's Pos whene taking dammage? (/showthread.php?tid=352383)



Change Player's Pos whene taking dammage? - Saw® - 19.06.2012

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.


Re: Change Player's Pos whene taking dammage? - [MM]RoXoR[FS] - 20.06.2012

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;
}



Re: Change Player's Pos whene taking dammage? - MP2 - 20.06.2012

This is already in the game though?


Re: Change Player's Pos whene taking dammage? - Saw® - 20.06.2012

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.
}


Re: Change Player's Pos whene taking dammage? - RipLagger - 20.06.2012

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



Re: Change Player's Pos whene taking dammage? - Saw® - 20.06.2012

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).


Re: Change Player's Pos whene taking dammage? - Gangs_Rocks - 20.06.2012

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


Re: Change Player's Pos whene taking dammage? - Saw® - 20.06.2012

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..


Re: Change Player's Pos whene taking dammage? - [MM]RoXoR[FS] - 20.06.2012

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;
}



Re: Change Player's Pos whene taking dammage? - Rudy_ - 20.06.2012

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