keep SetPlayerAttachedObject issue +rep - 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: keep SetPlayerAttachedObject issue +rep (
/showthread.php?tid=317308)
keep SetPlayerAttachedObject issue +rep -
PawnoQ - 10.02.2012
hi,
how can i make it like a player also can keep the attached object after death?
thx
Re: keep SetPlayerAttachedObject issue +rep -
Nuke547 - 10.02.2012
Well if you have a variable set for whether or not they have the object attached, you could put it OnPlayerSpawn.
If you have the variable, then it would be like this:
PHP код:
public OnPlayerSpawn(playerid)
{
if(ObjectAttached[playerid] == 1)
{
SetPlayerAttachedObject(playerid, 3, 1609, 2); //That is a random object. Put this for whatever you had.
}
else
}
Re: keep SetPlayerAttachedObject issue +rep -
PawnoQ - 10.02.2012
thx,
yes i know the method u mentioned but if there is a kinda shop and players can buy clothes/objects there are many different objects so how to know what object shall be reattached after death?
Re: keep SetPlayerAttachedObject issue +rep -
Nuke547 - 10.02.2012
Well I think for that, you would need to do many different variables for each object.
Re: keep SetPlayerAttachedObject issue +rep -
Tanush123 - 11.02.2012
Quote:
Originally Posted by Nuke547
Well I think for that, you would need to do many different variables for each object.
|
no can't you do this, when you buy the object you could add different number for each of the objects, like object 1 will be
and object 2
You can do if playerspawns it will be like this
pawn Код:
if(Object[playerid] == 1)
{
//code
}
if(Object[playerid] == 2)
{
//code
}
Re: keep SetPlayerAttachedObject issue +rep -
Chris White - 11.02.2012
Or you can set two variables. One containing the purchased object's model ID, and another one to see if the object is attached to player or not as Nuke547 said.
Re: keep SetPlayerAttachedObject issue +rep -
Tanush123 - 11.02.2012
Quote:
Originally Posted by Chris White
Or you can set two variables. One containing the purchased object's model ID, and another one to see if the object is attached to player or not as Nuke547 said.
|
Why 2 variables? Just detect if Object is 0 that means its not detached or if its over 0 that means it is