How to Limit PlayerAttach Object Size
#1

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?
Reply
#2

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

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

asdasdasd
Reply
#4

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?
Reply
#5

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

if(fScaleY < limit)

if(fScaleZ < limit)
Reply
#6

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;
}
Reply
#7

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);
}
Reply
#8

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);
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)