SA-MP Forums Archive
Attach object - 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: Attach object (/showthread.php?tid=607375)



Attach object - Micko123 - 18.05.2016

So i want to make this. When player type /cmd object will be placed on him. After 10sec it will blow and object will dissapear. I have explosion and timer. I just don't know how to make this with object. Can someone help me


Re: Attach object - Stuntff - 18.05.2016

Код:
new PlayerObjectTimer[MAX_PLAYERS];

OnPlayerDisconnect/OnPlayerConnect:
KillTimer(PlayerObjectTimer[playerid]);

to the end:
CMD:yourcmd(playerid,params[])
{
SetPlayerAttached(playerid, 0, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ);
PlayerObjectTimer[playerid] = SetTimerEx("ObjectDelete",10000,false,"i",playerid);
return 1;
}

forward ObjectDelete(playerid);
public ObjectDelete(playerid)
{
RemovePlayerAttachedObject(playerid, 0);
return KillTimer(PlayerObjectTimer[playerid]);
}