SetPlayerHoldingObject
#4

Quote:
Originally Posted by MartinDee
Посмотреть сообщение
You can do something like:

pawn Код:
new Shield[MAX_PLAYERS];
new WithShield[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/shield", cmdtext, true, 10) == 0)
    {
        if(WithShield[playerid] == 0)
        {
            ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
            Shield[playerid] = CreateObject(1533,2470.573,-1660.366,14.271,0.0,0.0,-90.000);
            AttachObjectToPlayer(Shield[playerid],playerid,-0.8,0.5,-1.65,0.0,0,0.0);
            ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
            DestroyObject(Shield[playerid]);
            SetTimerEx("SAnim", 500, 0, "i", playerid);
            WithShield[playerid] = 1;
            return 1;
        }
        else if(WithShield[playerid] == 1)
        {
            DestroyObject(Shield[playerid]);
            SendClientMessage(playerid,ROJO,"You have dropped the shield.");
            ClearAnimations(playerid);
            WithShield[playerid] = 0;
            return 1;
        }
    }
    return 0;
}

forward SAnim(playerid);
public SAnim(playerid)
{
    ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
    return 1;
}
Thanks MartinDee, I'll try it like that and see if it works
Reply


Messages In This Thread
SetPlayerHoldingObject - by Agent Smith - 29.08.2010, 20:16
Re: SetPlayerHoldingObject - by Mauzen - 29.08.2010, 20:25
Re: SetPlayerHoldingObject - by MartinDee - 29.08.2010, 20:27
Re: SetPlayerHoldingObject - by Agent Smith - 29.08.2010, 20:30
Re: SetPlayerHoldingObject - by MartinDee - 29.08.2010, 20:31

Forum Jump:


Users browsing this thread: 2 Guest(s)