Carry problem
#4

pawn Код:
new crate[MAX_PLAYERS] = {INVALID_OBJECT_ID, ...};
Disconnect
pawn Код:
if(crate[playerid] != INVALID_OBJECT_ID)
    DestroyObject(crate[playerid]);

crate[playerid] = INVALID_OBJECT_ID;
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_ANALOG_LEFT)
    {
        if(crate[playerid] != INVALID_OBJECT_ID)
        {
            new Float:x, Float:y, Float:z;
            GetObjectPos(crate[playerid], x, y, z);

            if(IsPlayerInRangeOfPoint(playerid, 1.5, x, y, z))
            {
                ApplyAnimation(playerid, "CARRY", "liftup", 4.1, 0, 1, 1, 0, 0, 1);
                SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
                DestroyObject(crate[playerid]);
                SetPlayerAttachedObject(playerid,0,2358,5,0.091000,0.125999,0.180000,-76.000015,0.000000,100.000000);
                crate[playerid] = INVALID_OBJECT_ID;
            }
        }
        else
        {
            ApplyAnimation(playerid, "CARRY", "putdwn", 4.1, 0, 1, 1, 0, 0, 1);
            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
            RemovePlayerAttachedObject(playerid, 0);
            new Float:x, Float:y, Float:z, Float:angle;
            GetPointInAngleOfPlayer(playerid, x, y, z, 0.8, 0.0);
            GetPlayerFacingAngle(playerid, angle);
            crate[playerid] = CreateObject(2358, x, y, z-0.85, 0.0, 0.0, angle);
        }
        return 0;
    }
    return 1;
}
Reply


Messages In This Thread
Carry problem - by cnoopers - 27.01.2015, 18:40
Re: Carry problem - by Jefff - 27.01.2015, 20:15
Re: Carry problem - by cnoopers - 27.01.2015, 20:40
Re: Carry problem - by Jefff - 27.01.2015, 21:04
Re: Carry problem - by cnoopers - 28.01.2015, 00:31
Re: Carry problem - by cnoopers - 28.01.2015, 13:42
Re: Carry problem - by cnoopers - 28.01.2015, 23:43
Re: Carry problem - by Jefff - 29.01.2015, 00:50
Re: Carry problem - by cnoopers - 29.01.2015, 12:24

Forum Jump:


Users browsing this thread: 2 Guest(s)