[Include] Tornado
#1

What is this?
This is a simple tornado include file. It's maybe not coded in the best way for the RolePlay servers but it could be useful if you want to have some fun.


Screenshots:
http://i36.tinypic.com/30upnbc.png
http://i33.tinypic.com/9acx89.png
http://i35.tinypic.com/6ycghg.png
/imageshack/img185/8789/samp001jr.png


Credits:
- Y_Less for foreach & randomEx function,
- Tannz0rz for smoke-objects idea


How to install?
It's easy and simple - download and put the tornado.inc into the \pawno\include\ folder and do the same thing with the foreach.inc file.
Open your script and put this:
pawn Code:
#include <foreach>
#include <tornado>
right after the
pawn Code:
#include <a_samp>
Put the tornados in the OnGameModeInit callback.
Example:
pawn Code:
/*
CreateTornado(Float:x, Float:y, Float:z, Float:speed, Float:range);
*/

CreateTornado(485.7347, -1833.4973, 5.2154, 7.0, 50.0);
CreateTornado(587.4223, -1880.6510, 4.0786, 5.0, 30.0);
CreateTornado(598.7793, -1850.9843, 5.3381, 10.0, 60.0);
These 3 tornados are located at the Santa Maria Beach. Here are safe spawn coordinates, a bit away from the tornados:
pawn Code:
542.57208252, -1912.07702637, 2.0

Functions:
CreateTornado
Adds the tornado to the server.
@Float: x = Tornado start X position.
@Float: y = Tornado start Y position.
@Float: z = Tornado start Z position.
@Float: speed = The speed of tornado, maximum speed is defined with MAX_TORNADO_SPEED and even if you set bigger speed it will still set the speed of MAX_TORNADO_SPEED define.
@Float: range = The maximum allowed range for tornado to move from his starting position. If he is out of this range then he'll return to the starting position.
returns the tornado ID which starts with 0. If you exceed the MAX_TORNADOS define then it will return the invalid ID which is -1.
Example:
pawn Code:
new
        gTornado = -1;

public OnGameModeInit()
{
    gTornado = CreateTornado(485.7347, -1833.4973, 5.2154, 7.0, 50.0);
    return true;
}
DestroyTornado
Deletes the tornado from the server.
@tdid = The tornado ID.
returns true if the tornado is valid and false if it's not.
Example:
pawn Code:
DestroyTornado(gTornado);
IsTornadoCreated
Checks if tornado is created.
@tdid = The tornado ID.
returns true if the tornado is valid and false if it's not.
Example:
pawn Code:
if(IsTornadoCreated(gTornado)) printf("Tornado is created.");
else printf("Tornado is NOT created.");
Defines:
pawn Code:
#define MAX_TORNADOS (10)
#define MAX_TORNADO_SPEED (20.0)
#define P_TO_TORNADO_RANGE (45.0)
MAX_TORNADOS - The maximum amount of tornados allowed for script to load on the server.
MAX_TORNADO_SPEED - The maximum speed of the tornado.
P_TO_TORNADO_RANGE - The "player-to-tornado" range. If player is in this range then he'll find himself inside the tornado.


How to get coordinates for tornados?
Just launch the server or join one and go to the position where you want to have the tornado. Then use the /save command and when you're done go to the savedpositions.txt file and get your coordinates (you only need x, y and z).


Download:
http://www.solidfiles.com/d/50103e2415


Other:
When you delete the last tornado then the timer will stop so you don't have to do anything, and when you add the first tornado then it will start again.

If you get caught inside the tornado then you'll be inside for random amount of time (15 - 30 seconds) and once you're out (if you ain't dead yet) you'll have 5 seconds to run away before you're doomed once again.

The smoke objects are not as great as I expected, but they're better than nothing, right? There is also a test gamemode included into the download package.

There is no effect for the players in vehicles in this version.
Reply
#2

Amazing work!
Reply
#3

good job man
Reply
#4

That's really nice. Good work
Reply
#5

Very nice job.
Reply
#6

LOL Holy crap good job!
Reply
#7

Tornado Wind or Tornado Car?

Anyway Godd Job Man
Reply
#8

Btw, do we need the foreach.inc? Because I'm getting errors relating to foreach.
pawn Code:
C:\Users\user\Desktop\***********\pawno\include\tornado.inc(224) : error 017: undefined symbol "foreach"
C:\Users\user\Desktop\***********\pawno\include\tornado.inc(227) : error 017: undefined symbol "u"
C:\Users\user\Desktop\***********\pawno\include\tornado.inc(201) : warning 204: symbol is assigned a value that is never used: "string"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


24 Errors. //I took some errors out >>
Reply
#9

Quote:
Originally Posted by The Toni
View Post
Btw, do we need the foreach.inc? Because I'm getting errors relating to foreach.
pawn Code:
C:\Users\user\Desktop\***********\pawno\include\tornado.inc(224) : error 017: undefined symbol "foreach"
C:\Users\user\Desktop\***********\pawno\include\tornado.inc(227) : error 017: undefined symbol "u"
C:\Users\user\Desktop\***********\pawno\include\tornado.inc(201) : warning 204: symbol is assigned a value that is never used: "string"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


24 Errors. //I took some errors out >>
Indeed you do. As you can see I gave the credits to the Y_Less for his foreach function in the main post. You also have the link there.
Reply
#10

Quote:
Originally Posted by Correlli
View Post
Indeed you do. As you can see I gave the credits to the Y_Less for his foreach function in the main post. You also have the link there.
right...ermm this might be a noobish question, but I've downloaded it, well, copy/paste, and added it to a .inc file...now what? I tried #include <foreach> in the inc, and my Test GM.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)