SA-MP Forums Archive
How to Limit PlayerAttach Object Size - 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 to Limit PlayerAttach Object Size (/showthread.php?tid=556762)



How to Limit PlayerAttach Object Size - danish007 - 11.01.2015

hello,
i made attachment system. in it players can increase tooooo bug attachment size
so how can i limit size?
if player increase it too big and when i click finish edit it should be reset at default size?


Re: How to Limit PlayerAttach Object Size - IstuntmanI - 11.01.2015

https://sampwiki.blast.hk/wiki/OnPlayerEditAttachedObject

Use "Float:fScaleX, Float:fScaleY, Float:fScaleZ" parameters. Default is 1.


Re: How to Limit PlayerAttach Object Size - Divergent - 11.01.2015

asdasdasd


Re: How to Limit PlayerAttach Object Size - danish007 - 11.01.2015

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/OnPlayerEditAttachedObject

Use "Float:fScaleX, Float:fScaleY, Float:fScaleZ" parameters. Default is 1.
but how to set maximum size?


Re: How to Limit PlayerAttach Object Size - Divergent - 11.01.2015

Quote:
Originally Posted by danish007
Посмотреть сообщение
but how to set maximum size?
if(fScaleX < limit)

if(fScaleY < limit)

if(fScaleZ < limit)


Re: How to Limit PlayerAttach Object Size - Pottus - 11.01.2015

pawn Код:
#define CONSTRAINT_MIN_X 0.75
#define CONSTRAINT_MIN_Y 0.75
#define CONSTRAINT_MIN_Z 0.75
#define CONSTRAINT_MAX_X 1.25
#define CONSTRAINT_MAX_Y 1.25
#define CONSTRAINT_MAX_Z 1.25

IsValidScale(Float:sx, Float:sy, Float:sz)
{
    if( sx <= CONSTRAINT_MIN_X || sx >= CONSTRAINT_MAX_X  ||
       sy <= CONSTRAINT_MIN_Y || sy >= CONSTRAINT_MAX_Y  ||
       sz <= CONSTRAINT_MIN_Z || sz >= CONSTRAINT_MAX_Z ) return 0;
    return 1;
}



Re: How to Limit PlayerAttach Object Size - danish007 - 11.01.2015

still i can increase object size to bigger..

i used like this..

on top
pawn Код:
#define CONSTRAINT_MIN_X 0.75
#define CONSTRAINT_MIN_Y 0.75
#define CONSTRAINT_MIN_Z 0.75
#define CONSTRAINT_MAX_X 1.25
#define CONSTRAINT_MAX_Y 1.25
#define CONSTRAINT_MAX_Z 1.25

IsValidScale(Float:sx, Float:sy, Float:sz)
{
    if( sx <= CONSTRAINT_MIN_X || sx >= CONSTRAINT_MAX_X  || sy <= CONSTRAINT_MIN_Y || sy >= CONSTRAINT_MAX_Y  || sz <= CONSTRAINT_MIN_Z || sz >= CONSTRAINT_MAX_Z ) return 0;
    return 1;
}
and under onplayereditattachedobject.
pawn Код:
if(IsValidScale(fScaleX, fScaleY, fScaleZ))
{  
SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
}



Re: How to Limit PlayerAttach Object Size - Pottus - 11.01.2015

Where is your else statement to set it to the correct size ?


pawn Код:
else SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,1.0,1.0,1.0);



Re: How to Limit PlayerAttach Object Size - danish007 - 11.01.2015

i have to put correct size into else statement or new size?


Re: How to Limit PlayerAttach Object Size - Aasim - 11.01.2015

Quote:
Originally Posted by danish007
Посмотреть сообщение
i have to put correct size into else statement or new size?
maximum size.