24.11.2011, 14:29
Thank you!
Well xD let me try to explain what my code does...
First it get the player position, and sum PosX to PosY to PosZ... Then the restfloat gets the rest of a division... so for example if the sum of those three floats is 2056.25663, the rest of the division of 2056.25663 and 1 will be: 0.25663... then the next function does 2056.25663 - 0.25663 = 2056.0
Then the next funcition tranform this float into an intenger = 2056
Well i could simply set this intenger as the player VW... But the player could be something like 1 ms diferent as before... than the VW would be 2055 or 2057... And that happened with me when i was testing... Than a thougth: if I get this intenger (2056) and divide for 10 (something like a point ratio) i would get 205.6 (witch cannot be a VW) so i used the operator %65999 witch remove the 0.6... so 205... then I *10 again... and the numer i get is 2050 witch is the VW id... So we got a ratio of 10 ms for the player enter at the same position as before...
And how about if the number is negative... well i did this:
for exemple... if the sum is -1963.13620 the number will become 1963.13620
And thats it =D
I dont know how about your code because there is no ratio... so a player could enter in a VW diferent... something like 1 ID of diference...
Quote:
The entry point based grouping is a very nice idea, but there are better ways of doing it (kudos for finding a solution though). Because you call "floatround" that entire "restfloat" function and subtraction is pointless (also, I'm not sure what happens when "PosX + PosY + PosZ" is negative):
pawn Код:
1) If there's an entry point at -100,-100,-10 and another one at 100,100,10 then they will result in the same interiour VW (your code and mine). 2) If there's an entry point at 105,100,10 and someone clips it at 104.9,100,10, while another person clips it at 105.1,100,10, they will end up in different VWs despite having just been right next to each other. |
First it get the player position, and sum PosX to PosY to PosZ... Then the restfloat gets the rest of a division... so for example if the sum of those three floats is 2056.25663, the rest of the division of 2056.25663 and 1 will be: 0.25663... then the next function does 2056.25663 - 0.25663 = 2056.0
Then the next funcition tranform this float into an intenger = 2056
Well i could simply set this intenger as the player VW... But the player could be something like 1 ms diferent as before... than the VW would be 2055 or 2057... And that happened with me when i was testing... Than a thougth: if I get this intenger (2056) and divide for 10 (something like a point ratio) i would get 205.6 (witch cannot be a VW) so i used the operator %65999 witch remove the 0.6... so 205... then I *10 again... and the numer i get is 2050 witch is the VW id... So we got a ratio of 10 ms for the player enter at the same position as before...
And how about if the number is negative... well i did this:
pawn Код:
if (PosSum < 0)
{
PosSumInt = floatround((0-PosSum), floatround_round);
}
And thats it =D
I dont know how about your code because there is no ratio... so a player could enter in a VW diferent... something like 1 ID of diference...