SetPlayerAttachedObject Problem
#1

SetPlayerAttachedObject(extraid, 9, 3026, 1); //Backpack attached to player

It won't show the players backpack on their back. I have

PHP код:
if(PlayerInfo[extraid][pDonorBackpack] > 0)
                {
                    
printf("Got Here");
                    
SetPlayerAttachedObject(extraid930261); //Backpack attached to player
                    
printf("Got Past Here");
                } 
and it's printing the correct variables into the command prompt. I can't seem to find the problem with it.
Reply
#2

Here you go.

Код:
if(PlayerInfo[extraid][pDonorBackpack] > 0) 
                { 
                    printf("Got Here"); 
                    SetPlayerAttachedObject(extraid, 9, 3026, 1,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0); //Backpack attached to player 
                    printf("Got Past Here"); 
                }
Reply
#3

Didn't work.

https://sampwiki.blast.hk/wiki/SetPlayerAttachedObject

Everything after the bone id is optional. I have no idea why this isn't working to be honest...
Reply
#4

PHP код:
if(SetPlayerAttachedObject(extraid930261,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0) == 0)
                    {
                        print(
"Failed");
                    }
                    else
                    {
                        print(
"Success");
                    } 
I tried the above and it spits out "Success" into the command prompt. I have no idea why it's appearing on the player though.
Reply
#5

Where are you executing this code? The player should probably be spawned first before you attach an object. If this code is not inside OnPlayerSpawn, try moving it there.
Reply
#6

Just copy and paste what I posted above.
Reply
#7

It still didn't work =/
Reply
#8

Fixed it using:

PHP код:
     if(PlayerInfo[playerid][pDonorBackpack] > 0)
     {
          
printf("Got Here");
            
SetPlayerAttachedObject(playerid930261); //Backpack attached to player
            
printf("Got Past Here");
     } 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)