Carry animation
#1

How can i make a player pickup a box on the ground and carry it?
Reply
#2

Create a box object using CreateObject(or preferably using a streamer plug-in).

Then to make them "carry" the object, you'd need to find offsets for the skins you're intending on carrying said box. Then attach the box object using AttachObjectToPlayer accordingly. Then, use SPECIAL_ACTION_CARRY to set them in the carrying animation.

This might help you get started:
pawn Код:
SetPlayerCarry(playerid, bool: toggle)
{
    if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
    if(toggle == true)
    {
          SetPVarInt(playerid, "is_carrying_box", 1);
          SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
          return 1;
    }
    else
    {
          SetPVarInt(playerid, "is_carrying_box", 0);
          SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
          return 1;
    }
    return -1;
}

IsPlayerCarryingBox(playerid)
{
    if(GetPVarInt(playerid, "is_carrying_box"))
    {
         return 1;
    }
    return 0;
}
Reply
#3

on command/key apply pickup anim, then set avarage anim play time in the timer, at time set idle anim, and at drop, apply dropping anim.
Reply
#4

ok thanks =), i may need help again later
Reply
#5

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Create a box object using CreateObject(or preferably using a streamer plug-in).

Then to make them "carry" the object, you'd need to find offsets for the skins you're intending on carrying said box. Then attach the box object using AttachObjectToPlayer accordingly. Then, use SPECIAL_ACTION_CARRY to set them in the carrying animation.

This might help you get started:
pawn Код:
SetPlayerCarry(playerid, bool: toggle)
{
    if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
    if(toggle == true)
    {
          SetPVarInt(playerid, "is_carrying_box", 1);
          SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
          return 1;
    }
    else
    {
          SetPVarInt(playerid, "is_carrying_box", 0);
          SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
          return 1;
    }
    return -1;
}

IsPlayerCarryingBox(playerid)
{
    if(GetPVarInt(playerid, "is_carrying_box"))
    {
         return 1;
    }
    return 0;
}
How about we add less spice to this code?

For someone who knows what they are doing

pawn Код:
SetPlayerCarry(playerid, bool:toggle)
{
    if(!IsPlayerConnected(playerid)) return 0;
    return SetPlayerSpecialAction(playerid, (toggle == true) ? SPECIAL_ACTION_CARRY : SPECIAL_ACTION_NONE);
}

IsPlayerCarryingBox(playerid) return GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY;
For someone who doesn't know what they are doing

pawn Код:
SetPlayerCarry(playerid, bool:toggle)
{
    if(!IsPlayerConnected(playerid)) return 0;
    if(toggle == true && GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_CARRY)
    {
          SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
    }
    else
    {
          SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
    }
    return 1;
}

IsPlayerCarryingBox(playerid)
{
    if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY)
        return 1;
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)