SA-MP Forums Archive
2 questions about floats and calculation - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 2 questions about floats and calculation (/showthread.php?tid=211051)



2 questions about floats and calculation - CyNiC - 14.01.2011

1 Explanations

Well, I do not know much about trigonometry, and do not know how to apply it to the game, I would like that if possible, give me some examples of applications of the following functions, I know what's the point, just want to have an example of usage I can understand clearly what is happening in the code. Thank you in advance.

floatsin
floatcos
floatabs
floattan
floatroot

2 A question:

How to calculate the position for which the camera moves to the left and right like a platform game (Mario, Metal Slug, etc.).


Re: 2 questions about floats and calculation - CyNiC - 15.01.2011

I know I ask too much, so I'm going up the topic to ask me at least answer the second question, please.


Re: 2 questions about floats and calculation - CyNiC - 16.01.2011

Last bump, i give up.


Re: 2 questions about floats and calculation - admantis - 16.01.2011

Learn to search.

https://sampwiki.blast.hk/wiki/Floatsin
https://sampwiki.blast.hk/wiki/Floatcos
https://sampwiki.blast.hk/wiki/Floatabs
https://sampwiki.blast.hk/wiki/Floattan
https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector


Re: 2 questions about floats and calculation - CyNiC - 16.01.2011

I read about it all, and not helped me in anything. I wanted application examples in the game to help me understand clearly how to use it to do what I want.
The links posted just to show examples of calculations.


Re: 2 questions about floats and calculation - admantis - 16.01.2011

It clearly says you use, ex, Floatabs to get the asbolute number of a Floating number. Example:
pawn Код:
new answer = floatsin(10,degrees));
public OnPlayerText(playerid, text[])
{
    if (text[0] == answer)
    {
        new str[128];
        format(str, 128, "The sine of 10 is %f",answer);
        SendClientMessage(playerid,0xFFFFFF,str);
    }
    return 1;
}
And ^ code might not work.
Also used for calculations (intern codes)


Re: 2 questions about floats and calculation - Toreno - 16.01.2011

It's not that hard, if you learnd cos, tan, sin... it's like using professional calculator.
It simply takes the number and does it as in calculator.

Код:
tan 30 = 0.577350269
sin 90 = 1
cos 90 = 0