SA-MP Forums Archive
How do I attach a player object to a player? - 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)
+--- Thread: How do I attach a player object to a player? (/showthread.php?tid=481019)



How do I attach a player object to a player? - Dylan_Madigan69 - 13.12.2013

Im making a snow effects FS. I got this
---------------------------------------------------------------------------------------------
if(strcmp("/snow", cmdtext, true) == 0)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetWeather(27);
SnowObject[playerid] = CreatePlayerObject(playerid, 18863, x, y, z, 0.00, 0.00, 0.00, 0.00);
AttachObjectToPlayer(SnowObject[playerid], playerid, 35.00, 0.00, 0.00, 0.00, 0.00, 15.00);

return 1;
}
---------------------------------------------------------------------------------------------

Im sorry, i cant remember how to add codes. But anyway, im trying to make it where only that player can see the snow, and then have it move with them. It would be smoother then runnung a bunch of updates. I want it to cover there camera, that along with the right weather would look nice.


Re: How do I attach a player object to a player? - Krakuski - 14.12.2013

Try this:

pawn Код:
if(strcmp("/snow", cmdtext, true) == 0)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SetWeather(27);
    SetPlayerAttachedObject(playerid, 0, 18864, 1, -2.931000, 0.000000, 0.000000, 0.000000, 90.599914, 0.000000, 1.000000, 1.000000, 1.000000);
    return 1;
}
Does it work? Untested.