My object problem -
Soumi - 16.08.2011
I'm making a stretcher command which will attach a created object to the player
here's my /getstretcher cmd:
pawn Код:
PlayerStat[playerid][StretcherObject] = CreateObject(2146, X, Y, Z, 0, 0, 0, 75.0);
AttachObjectToPlayer(PlayerStat[playerid][StretcherObject], playerid, -0.506504, 1.504988, 0.031584, 0.000000, 89.566635, 0.000000);
and this is my /removestretcher cmd:
pawn Код:
DestroyObject(PlayerStat[playerid][StretcherObject]);
when i use /removestretcher then try to get another stretcher using /getstretcher it doesn't work
Re: My object problem -
MadeMan - 16.08.2011
Quote:
Originally Posted by Soumi
it doesn't work ![Huh?](images/smilies/confused.gif)
|
Explain please.
Re : My object problem -
Soumi - 16.08.2011
Ok, i used /getstretcher which creates an Stretcher object then attach this object to the player.
pawn Код:
PlayerStat[playerid][StretcherObject] = CreateObject(2146, X, Y, Z, 0, 0, 0, 75.0);
AttachObjectToPlayer(PlayerStat[playerid][StretcherObject], playerid, -0.506504, 1.504988, 0.031584, 0.000000, 89.566635, 0.000000);
this works, so i tested the /removestretcher command.
pawn Код:
DestroyObject(PlayerStat[playerid][StretcherObject]);
and it destroyed the stretcher object (Works)
But when i wanted to use /getstretcher again after destroying that object, its not working nothing happens
Re: My object problem -
ElieJabbour - 16.08.2011
You're using the DestroyObject wrong.
https://sampwiki.blast.hk/wiki/DestroyObject
Re: Re : My object problem -
Kush - 16.08.2011
Quote:
Originally Posted by ElieJabbour
|
He is using it correctly. Instead of making accusations, why not tell him how to solve the problem?
Quote:
Originally Posted by Soumi
But when i wanted to use /getstretcher again after destroying that object, its not working
nothing happens ![Huh?](images/smilies/confused.gif)
|
Try mine:
PHP код:
new Object[MAX_PLAYERS];
YCMD:getstretcher(playerid, params[], help)
{
new Float:X, Float:Y, Float:Z;
#pragma unused help
#pragma unused params
Object[playerid] = CreateObject(2146, X, Y, Z, 0, 0, 0, 75.0);
AttachObjectToPlayer(Object[playerid], playerid, -0.506504, 1.504988, 0.031584, 0.000000, 89.566635, 0.000000);
return 1;
}
YCMD:removestretcher(playerid, params[], help)
{
#pragma unused help
#pragma unused params
DestroyObject(Object[playerid]);
return 1;
}
Re: My object problem -
=WoR=Varth - 16.08.2011
Quote:
Originally Posted by ElieJabbour
|
Why you said so?
I don't see any problem with your little code. Perhaps there's something to do with your command in another line.
Is the object created or not?
Re: My object problem -
Soumi - 16.08.2011
Quote:
Originally Posted by Kush
He is using it correctly. Instead of making accusations, why not tell him how to solve the problem?
Try mine:
PHP код:
new Object[MAX_PLAYERS];
YCMD:getstretcher(playerid, params[], help)
{
new Float:X, Float:Y, Float:Z;
#pragma unused help
#pragma unused params
Object[playerid] = CreateObject(2146, X, Y, Z, 0, 0, 0, 75.0);
AttachObjectToPlayer(Object[playerid], playerid, -0.506504, 1.504988, 0.031584, 0.000000, 89.566635, 0.000000);
return 1;
}
YCMD:removestretcher(playerid, params[], help)
{
#pragma unused help
#pragma unused params
DestroyObject(Object[playerid]);
return 1;
}
|
it's looks just like my command
Quote:
Originally Posted by varthshenon
Why you said so?
I don't see any problem with your little code. Perhaps there's something to do with your command in another line.
Is the object created or not?
|
Yes the object is created and it's attached to the player but after using Destroying the object (which works also)
i can't use the /getstretcher command anymore.
Re: My object problem -
=WoR=Varth - 16.08.2011
I mean is the object created again (When you do /getstretcher) after it destroyed?
Re: My object problem -
Soumi - 16.08.2011
Quote:
Originally Posted by varthshenon
I mean is the object created again (When you do /getstretcher) after it destroyed?
|
No, that's the problem
Re: My object problem -
Kush - 16.08.2011
Quote:
Originally Posted by Soumi
it's looks just like my command
Yes the object is created and it's attached to the player but after using Destroying the object (which works also)
i can't use the /getstretcher command anymore.
|
It's your command except Object is defined as a global var.
I've tested it out and you can remove and get the stretcher how many times you would like.