SetPlayerAttachedObject - Holding Bin Bag
#1

Hello! I have a Trash Collector job scripted, where if close to the checkpoint and object, you press "c" and it destroys the object, then attaches it to the player. I have selected the left hand bone but the offset is out. How can I set this right? I have no idea of how to find the coordinates.
Here is what happens:



Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(PRESSED(KEY_CROUCH))
 	{
    	if(Player[playerid][Job] == 2)
    	{
    		if(IsPlayerInRangeOfPoint(playerid, 2.0, -2098.5347, -117.4365, 34.8203)) //
   			{
   		    	if(Checkpoint[playerid] > -1)
   		    	{
   					DisablePlayerCheckpoint(playerid);
    				Checkpoint[playerid] = -1;
    				DestroyObject(object);
    				object = SetPlayerAttachedObject(playerid, 6, 1264, 5); // here
				}
			}
        }
    }
	return 1;
}
Reply
#2

I think the object variable should be a global-player variable (MAX_PLAYERS).

PHP код:
new object// wrong
new object[MAX_PLAYERS]; // correct 
Reply
#3

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
I think the object variable should be a global-player variable (MAX_PLAYERS).

PHP код:
new object// wrong
new object[MAX_PLAYERS]; // correct 
You are right. Thanks for spotting that.
If there are any filterscripts, or something that you know of which helps to place objects correctly on players, please let me know.
Reply
#4

You can use EditAttachedObject to change an object's position, rotation and scale. The changed offsets will be given to OnPlayerEditAttachedObject.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)