04.11.2010, 08:17
(
Последний раз редактировалось Correlli; 14.09.2012 в 21:58.
)
What is this?
This is a script which allows you to surf on the surf-objects. It can be useful if you want to have some fun.
Video:
https://*****.com/45751015
Credits:
- ****** for foreach & GetXYInFrontOfPlayer functions,
- ZeeX for zcmd command processor.
How to install?
It's easy and simple - download and put the surfboard.inc into the \pawno\include\ folder and do the same thing with the foreach.inc and zcmd.inc file.
Open your script and put this:
right after the
Put the surfboards in the OnGameModeInit callback.
Example:
These 5 surfboards are located at the Santa Maria Beach. Here are the spawn coordinates:
Functions:
CreateSurfboard
Adds the surfboard to the server.
@modelid = Model-ID of the surfboard - valid model-IDs are 1, 2 and 3.
@Float: x = Surfboard spawn X position.
@Float: y = Surfboard spawn Y position.
@Float: z = Surfboard spawn Z position.
@Float: rx = Surfboard spawn X rotation.
@Float: ry = Surfboard spawn Y rotation.
@Float: rz = Surfboard spawn Z rotation.
returns the surfboard ID which starts with 0. If you exceed the MAX_SURFBOARDS define then it will return the invalid ID which is -1.
Example:
DestroySurfboard
Deletes the surfboard from the server.
@sbid = The surfboard ID.
returns true if the surfboard is valid and false if it's not.
Example:
IsSurfboardCreated
Checks if surfboard is created.
@sbid = The surfboard ID.
returns true if the surfboard is valid and false if it's not.
Example:
StopSurfboard
Stops the surfboard.
@sbid = The surfboard ID.
returns true if the surfboard is valid and false if it's not.
Example:
RespawnSurfboard
Re-spawns the surfboard.
@sbid = The surfboard ID.
returns true if the surfboard is valid and false if it's not.
Example:
SetSurfboardSpeed
Sets the speed of the surfboard.
@sbid = The surfboard ID.
@surfspeed = The speed to set for the surfboard.
returns true if the surfboard is valid and false if it's not.
If the you set the speed which is higher than MAX_SURFBOARD_SPEED, then the function will automatically set it to the MAX_SURFBOARD_SPEED.
Example:
This will set the speed of the surfboard to 3.5:
This will set the speed of the surfboard to the maximum (which is defined with MAX_SURFBOARD_SPEED):
IsPlayerAtSurfboard
Checks if player is near the surfboard.
@playerid = The ID of the player.
@sbid = The surfboard ID.
returns true if the player is near the surfboard and false if he isn't.
Example:
IsPlayerAtAnySurfboard
Checks if player is near any surfboard.
@playerid = The ID of the player.
returns ID of the surfboard which stars with 0 if player is near any surfboard and -1 is he's not.
Example:
Defines:
MAX_SURFBOARDS - The maximum amount of surfboards allowed for script to load on the server.
MAX_SURFBOARD_SPEED - The maximum speed of the surfboard. It shouldn't be too big, because you'll fall of from the surfboard if you'll surf with big speed.
How to get coordinates for surfboards?
Just launch the server or join one and go to the sea position where you want to have the surfboard. Then use the /save command and when you're done go to the savedpositions.txt file and get your coordinates (you only need x and y, it's best if you set the z coordinate to 0.0 - sea level).
Set the x rotation to 270.0 and y rotation to 0.0. The z rotation is the rotation of the surfboard.
Download:
http://www.solidfiles.com/d/b46b5b6b2b
Other:
If you want to start with the surfing, then get near the surfboard and use the "/surf" command. If you want to stop with the surfing, then use the "/surf" command once again.
Use arrow keys (UP, DOWN, LEFT and RIGHT) to control the surfboard's movement.
When you delete the last surfboard then the timer will stop so you don't have to do anything, and when you add the first surfboard then it will start again.
If you fall of from the surfboard, then the surfboard will automatically re-spawn. It will also automatically re-spawn if you surf into the object (example - mountain).
Hope you like it,
Correlli
This is a script which allows you to surf on the surf-objects. It can be useful if you want to have some fun.
Video:
https://*****.com/45751015
Credits:
- ****** for foreach & GetXYInFrontOfPlayer functions,
- ZeeX for zcmd command processor.
How to install?
It's easy and simple - download and put the surfboard.inc into the \pawno\include\ folder and do the same thing with the foreach.inc and zcmd.inc file.
Open your script and put this:
pawn Код:
#include <foreach>
#include <zcmd>
#include <surfboard>
pawn Код:
#include <a_samp>
Example:
pawn Код:
/*
CreateSurfboard(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz = 0.0);
*/
CreateSurfboard(1, 548.57208252, -1910.07702637, 0.0, 270.0, 0.0, 180.0);
CreateSurfboard(2, 546.25457764, -1909.92712402, 0.0, 270.0, 0.0, 180.0);
CreateSurfboard(3, 543.55535889, -1909.75854492, 0.0, 270.0, 0.0, 180.0);
CreateSurfboard(1, 540.91290283, -1909.6159668, 0.0, 270.0, 0.0, 180.0);
CreateSurfboard(3, 538.32940674, -1908.54333496, 0.0, 270.0, 0.0, 180.0);
pawn Код:
542.57208252, -1912.07702637, 2.0
Functions:
CreateSurfboard
Adds the surfboard to the server.
@modelid = Model-ID of the surfboard - valid model-IDs are 1, 2 and 3.
@Float: x = Surfboard spawn X position.
@Float: y = Surfboard spawn Y position.
@Float: z = Surfboard spawn Z position.
@Float: rx = Surfboard spawn X rotation.
@Float: ry = Surfboard spawn Y rotation.
@Float: rz = Surfboard spawn Z rotation.
returns the surfboard ID which starts with 0. If you exceed the MAX_SURFBOARDS define then it will return the invalid ID which is -1.
Example:
pawn Код:
new
gSurfboard = -1;
public OnGameModeInit()
{
gSurfboard = CreateSurfboard(1, 548.57208252, -1910.07702637, 0.0, 270.0, 0.0, 180.0);
return true;
}
Deletes the surfboard from the server.
@sbid = The surfboard ID.
returns true if the surfboard is valid and false if it's not.
Example:
pawn Код:
DestroySurfboard(gSurfboard);
Checks if surfboard is created.
@sbid = The surfboard ID.
returns true if the surfboard is valid and false if it's not.
Example:
pawn Код:
if(IsSurfboardCreated(gSurfboard)) printf("Surfboard is created.");
else printf("Surfboard is NOT created.");
Stops the surfboard.
@sbid = The surfboard ID.
returns true if the surfboard is valid and false if it's not.
Example:
pawn Код:
StopSurfboard(gSurfboard);
Re-spawns the surfboard.
@sbid = The surfboard ID.
returns true if the surfboard is valid and false if it's not.
Example:
pawn Код:
RespawnSurfboard(gSurfboard);
Sets the speed of the surfboard.
@sbid = The surfboard ID.
@surfspeed = The speed to set for the surfboard.
returns true if the surfboard is valid and false if it's not.
If the you set the speed which is higher than MAX_SURFBOARD_SPEED, then the function will automatically set it to the MAX_SURFBOARD_SPEED.
Example:
This will set the speed of the surfboard to 3.5:
pawn Код:
SetSurfboardSpeed(gSurfboard, 3.5);
pawn Код:
SetSurfboardSpeed(gSurfboard);
Checks if player is near the surfboard.
@playerid = The ID of the player.
@sbid = The surfboard ID.
returns true if the player is near the surfboard and false if he isn't.
Example:
pawn Код:
if(IsPlayerAtSurfboard(playerid, gSurfboard)) printf("Player is near the surfboard with ID %i.", gSurfboard);
else printf("Player is NOT near the surfboard with ID %i.", gSurfboard);
Checks if player is near any surfboard.
@playerid = The ID of the player.
returns ID of the surfboard which stars with 0 if player is near any surfboard and -1 is he's not.
Example:
pawn Код:
new
gSurfboard = IsPlayerAtAnySurfboard(playerid);
if(gSurfboard != -1) printf("Player is near the surfboard with ID %i.", gSurfboard);
else printf("Player is NOT near any surfboard.");
Defines:
pawn Код:
#define MAX_SURFBOARDS (5)
#define MAX_SURFBOARD_SPEED (5.0)
MAX_SURFBOARD_SPEED - The maximum speed of the surfboard. It shouldn't be too big, because you'll fall of from the surfboard if you'll surf with big speed.
How to get coordinates for surfboards?
Just launch the server or join one and go to the sea position where you want to have the surfboard. Then use the /save command and when you're done go to the savedpositions.txt file and get your coordinates (you only need x and y, it's best if you set the z coordinate to 0.0 - sea level).
Set the x rotation to 270.0 and y rotation to 0.0. The z rotation is the rotation of the surfboard.
Download:
http://www.solidfiles.com/d/b46b5b6b2b
Other:
If you want to start with the surfing, then get near the surfboard and use the "/surf" command. If you want to stop with the surfing, then use the "/surf" command once again.
Use arrow keys (UP, DOWN, LEFT and RIGHT) to control the surfboard's movement.
When you delete the last surfboard then the timer will stop so you don't have to do anything, and when you add the first surfboard then it will start again.
If you fall of from the surfboard, then the surfboard will automatically re-spawn. It will also automatically re-spawn if you surf into the object (example - mountain).
Hope you like it,
Correlli