Object and anim of goggles doesn't shows up after using
#2

You can declare new boolean for each player on the top of script (new bool:******s[MAX_PLAYERS]) and on OnPlayerConnect set it to false. Next you should check if player used weapoid 44 or 45. Better way to do this is callback OnPlayerKeyStateChange than OnPlayerUpdate. Now you can attach ******s to player's head by SetPlayerAttachedObject and ApplyAnimation. You must set ******s[playerid] to true now. Next time when player'll using ******s (taking off) you should check if ******s[playerid] is true and if yes you can change it to false, ApplyAnimation and remove object.

Do something like this:

pawn Код:
new bool:******s[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    ******s[playerid] = false;
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_FIRE) && (!IsPlayerInAnyVehicle(playerid)))
    {
        switch(GetPlayerWeapon(playerid))
        {
            case 44, 45:
            {
                if(******s[playerid] == false)
                {
                    ******s[playerid] = true;
                    SetPlayerAttachedObject( ... ); // attack ******s on player's head
                    ApplyAnimation( ... ); // apply animation on player's skin
                }
                else // if true
                {
                    ******s[playerid] = false;
                    RemovePlayerAttachedObject( ... ); // remove attached ******s
                    ApplyAnimation( ... ); // animation
                }
            }
        }
    }
    return 1;
}
But remember that ******s aren't synced in samp already.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)