SA-MP Forums Archive
Objects Attaching help - 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: Objects Attaching help (/showthread.php?tid=91532)



Objects Attaching help - XtremeChio - 15.08.2009

Hello,

So I have created an object and this is how it looks.

pawn Код:
new shark;
- Above OnGameModeInit

pawn Код:
shark = CreateObject(1608,blabla);
pawn Код:
if(strcmp(cmdtext, "/shark", true) == 0)
    {
    AttachObjectToPlayer(shark, playerid,0,0,0,0,0,0);
    return 1;
    }
I left it like this, but when I died, the object was where I died, left alone( :P ). So I added this

pawn Код:
DestroyObject(shark)
- I added OnPlayerDisconnect and OnPlayerDeath.

But then I can't type shark anymore. I know it's because I destroyed it but how can I make it that I can type again ?
( without removing the DestroyObject(shark) ofcourse )

What must I add ? [MAX_PLAYERS] somewhere or what ?
I tried but I got multiple errors ( because I have more than just the shark ), therefore I decided to post it here.


Re: Objects Attaching help - dice7 - 15.08.2009

pawn Код:
if(strcmp(cmdtext, "/shark", true) == 0)
    {
shark = CreateObject(1608,blabla);
    AttachObjectToPlayer(shark, playerid,0,0,0,0,0,0);
    return 1;
    }



Re: Objects Attaching help - XtremeChio - 15.08.2009

Oh god, why didn't I think of creating the object when you type so xD

Thanks dice, really