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

When another player is trying to wear the Night Vision Goggles or Thermal Goggles I can't see them doing any animation or the object on their head but they do see the object and anim on their screen.

I put this code under OnPlayerUpdate and it fixes the bug. Is there a way to apply an animation and attach an object when a player wears them but when he takes them off disable the object?
pawn Код:
switch(GetPlayerWeapon(playerid))
    {
        case 44, 45:
        {
            new keys, ud, lr;
            GetPlayerKeys(playerid, keys, ud, lr);
            if((keys & KEY_FIRE) && (!IsPlayerInAnyVehicle(playerid)))
            {
                return 0;
            }
        }
    }
Reply
#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
#3

Quote:
Originally Posted by Madzior_
Посмотреть сообщение
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.
I know that they are not synced in SAMP, maybe in future but for now I am going to use what you just said. I have another question, is there an easy way to get the right cords to attach the object on your character?
Reply
#4

Bump? Read my post above.
Reply
#5

dude there is no anim for night vision + how do i know night vision got a bug .. when one wear it up all players see green
Reply
#6

Quote:
Originally Posted by Toxik
Посмотреть сообщение
dude there is no anim for night vision + how do i know night vision got a bug .. when one wear it up all players see green
I am asking for help on how do I get the cords of an object to be placed on a player, I found a fix but it was buggy so I wanna renew it and there is an anim which wears the goggles, it's named "goggles_put_on". Also that when you wear them and everyone sees green, that's the bank; you don't need a lot of brain to get it unless you are an idiot.
Reply
#7

Well if you used something called a 'Search Engine' such as ******, seen are there quite a few Player Attachment editors (along with vehicle attachment editors) on the sa-mp forums, Fair enough that you need help but you cannot expect someone to do almost all the work.
Reply
#8

Quote:
Originally Posted by zT KiNgKoNg
Посмотреть сообщение
Well if you used something called a 'Search Engine' such as ******, seen are there quite a few Player Attachment editors (along with vehicle attachment editors) on the sa-mp forums, Fair enough that you need help but you cannot expect someone to do almost all the work.
I want to get the cords of a player's object, in numbers; PosX, PosY, PosZ, RotX etc. etc. not the editor itself.
Reply
#9

Quote:
Originally Posted by dionisak0s
Посмотреть сообщение
I want to get the cords of a player's object, in numbers; PosX, PosY, PosZ, RotX etc. etc. not the editor itself.
Bump, still looking for a way on how to get the cords of a player attached object so I can put the cords on the script.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)