Useful Functions and Callbacks Re-release
#3

let me explain you why i decided to return BIG_FLOAT instead of -1.0:
if you want to know if for example player 2 is at most 200.0 metres away from you (playerid=0)
Код:
if(GetDistanceBetweenPlayers(0,2)<=200.0)
{
   SendClientMessage(0, 0xFFFFFFFF, "player 2 is at most 200.0 m away from you");
}
now think about the case, that player 2 i not connected. in this case it returns BIG_FLOAT.
so we have:
Код:
if(999999999999999.0<=200.0) //that's not true, so we won't get the message
{
   SendClientMessage(0, 0xFFFFFFFF, "player 2 is at most 200.0 m away from you");
}
if the function would return -1.0 we would have:
Код:
if(-1.0<=200.0) //that's true, so we will get the message, although player 2 is not connected
{
   SendClientMessage(0, 0xFFFFFFFF, "player 2 is at most 200.0 m away from you");
}
of course we could add something like this
Код:
if(GetDistanceBetweenPlayers(0,2)<=200.0 && GetDistanceBetweenPlayers(0,2)!=-1.0)
{
//and so on
}
but in my opinion its easier to return BIG_FLOAT, so others don't have to add " && GetDistanceBetweenPlayers(0,2)!=-1.0" to each if-condition.
why are BIG_FLOAT and BIG_INT not valid float and integer? are they too big?
if so please tell me max_float and max_int

the other thing you mentioned: yes, i didn't recognized that, but i already updated the file with only one return.
there could still be a few small bugs, because i can't check 4288 lines without making any mistakes (errare humanum est!!!).

best wishes
larcius
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)