SA-MP Forums Archive
AttachObjectToPlayer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: AttachObjectToPlayer (/showthread.php?tid=190427)



AttachObjectToPlayer - SkizzoTrick - 15.11.2010

How could i attach a briefcase to a player?And check if it is attached to player like

Buy a briefcase in 24/7(if you die,you loose it),you go to rob the bank,if you don't have a briefcase you just can't rob it!


Re: AttachObjectToPlayer - The_Moddler - 15.11.2010

There is a FS that will help you attaching the object, then when you die you destroy the object, and if you wanna check if he has the briefcase, you must make a variable.

Something like this:

pawn Код:
new bool:HasObject[MAX_PLAYERS];

stock AttachObjectToPlayerEx(objectid, playerid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:rX, Float:rY, Float:rZ)
{
    AttachObjectToPlayer(objectid, playerid, OffsetX, OffsetY, OffsetZ, rX, rY, rZ);
    HasObject[playerid] = true;
    return 1;
}

stock DetachObject(objectid)
{
    DestroyObject(objectid);
    HasObject[playerid] = false;
    return 1;
}

stock HasAttachedObject(playerid)
{
    return HasObject[playerid];
}
To use that you will have to use AttachObjectToPlayerEx.


Re: AttachObjectToPlayer - SkizzoTrick - 15.11.2010

Thx man,it worked xD


Re: AttachObjectToPlayer - iggy1 - 15.11.2010

You might want to look at this function i think it will do a better job for what you want than "AttachObjectToPlayer".

SetPlayerHoldingObject


Re: AttachObjectToPlayer - SkizzoTrick - 15.11.2010

Quote:
Originally Posted by iggy1
Посмотреть сообщение
You might want to look at this function i think it will do a better job for what you want than "AttachObjectToPlayer".

SetPlayerHoldingObject
Yes,that's what im searching,thx alot xD


Re: AttachObjectToPlayer - iggy1 - 15.11.2010

Your welcome.


Re: AttachObjectToPlayer - mick88 - 15.11.2010

Quote:
Originally Posted by SkizzoTrick
Посмотреть сообщение
How could i attach a briefcase to a player?
Код:
SetPlayerHoldingObject( playerid, 1210, 6, 0.303294, 0.081651, 0.010630, 0.000000, 270.000000, 0.000000 ); // briefcase
To check if player is holding briefcase you need to save that information to a var. To cancel briefcase se this:

Код:
StopPlayerHoldingObject(playerid);



Re: AttachObjectToPlayer - SkizzoTrick - 15.11.2010

Quote:
Originally Posted by mick88
Посмотреть сообщение
Код:
SetPlayerHoldingObject( playerid, 1210, 6, 0.303294, 0.081651, 0.010630, 0.000000, 270.000000, 0.000000 ); // briefcase
To check if player is holding briefcase you need to save that information to a var. To cancel briefcase se this:

Код:
StopPlayerHoldingObject(playerid);
How did you find the coordinates?xD


Re: AttachObjectToPlayer - iggy1 - 15.11.2010

There are a few filterscripts try this one by g_aSlice: Hold Studio