30.01.2015, 01:09
How can i make a player pickup a box on the ground and carry it?
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;
}
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 0;
return SetPlayerSpecialAction(playerid, (toggle == true) ? SPECIAL_ACTION_CARRY : SPECIAL_ACTION_NONE);
}
IsPlayerCarryingBox(playerid) return GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CARRY;
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;
}