08.08.2012, 21:25
(
Последний раз редактировалось Correlli; 14.09.2012 в 22:01.
)
What is this?
This is a script which allows you to drive on the "dog cart" objects. It can be useful if you want to have some fun. Unfortunately, there is no horse-object in SA:MP as far as I know, so I was forced to use cow-object.
Pictures:
/imageshack/img411/1172/13346910.png
/imageshack/img560/862/25598101.png
/imageshack/img685/4417/79315373.png
/imageshack/img28/5204/86170747.png
/imageshack/img341/2150/11596993.png
/imageshack/img690/6373/82492909.png
Credits:
- ****** for foreach & GetXYInFrontOfPlayer functions,
- ZeeX for zcmd command processor.
How to install?
It's easy and simple - download and put the dc.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 carts in the OnGameModeInit callback.
Example:
These 3 carts are located at the Los Santos Unity train station. Here are the spawn coordinates:
Functions:
CreateDogCart
Adds the dog cart to the server.
@Float: x = Cart spawn X position.
@Float: y = Cart spawn Y position.
@Float: z = Cart spawn Z position.
@Float: rz = Cart spawn Z rotation.
returns the cart ID which starts with 0. If you exceed the MAX_DOG_CARTS define then it will return the invalid ID which is -1.
Example:
DestroyDogCart
Deletes the dog cart from the server.
@dcid = The cart ID.
returns true if the cart is valid and false if it's not.
Example:
IsDogCartCreated
Checks if dog cart is created.
@dcid = The cart ID.
returns true if the cart is valid and false if it's not.
Example:
StopDogCart
Stops the dog cart.
@dcid = The cart ID.
returns true if the cart is valid and false if it's not.
Example:
RespawnDogCart
Re-spawns the dog cart.
@dcid = The cart ID.
returns true if the cart is valid and false if it's not.
Example:
SetDogCartSpeed
Sets the speed of the dog cart.
@dcid = The cart ID.
@cartspeed = The speed to set for the cart.
returns true if the cart is valid and false if it's not.
If the you set the speed which is higher than MAX_DOG_CART_SPEED, then the function will automatically set it to the MAX_DOG_CART_SPEED.
Example:
This will set the speed of the cart to 3.5:
This will set the speed of the cart to the maximum (which is defined with MAX_DOG_CART_SPEED):
IsPlayerAtDogCart
Checks if player is near the dog cart.
@playerid = The ID of the player.
@dcid = The cart ID.
returns true if the player is near the cart and false if he isn't.
Example:
IsPlayerAtAnyDogCart
Checks if player is near any dog cart.
@playerid = The ID of the player.
returns ID of the cart which stars with 0 if player is near any cart and -1 is he's not.
Example:
Defines:
MAX_DOG_CARTS - The maximum amount of carts allowed for script to load on the server.
MAX_DOG_CART_SPEED - The maximum speed of the cart. It shouldn't be too big.
How to get coordinates for carts?
I myself am using JernejL's REAL Map Editor, in which I place the dog cart objects (ID 3585 for "cart") where I want to have them. This Map Editor is not for people with weak computers, so if you have a weak computer, you can use any other Map Editor. The z rotation is the rotation of the cart.
Download:
http://www.solidfiles.com/d/d18f52287c
Other:
If you want to start with the driving, then get near the cart (jump inside of it or on it) and use the "/cart" command. If you want to stop with the driving, then use the "/cart" command once again.
Use arrow keys (UP, DOWN, LEFT and RIGHT) to control the cart's movement:
arrow UP = forward
arrow DOWN = stopping
arrow LEFT = turn left
arrow RIGHT = turn right
When you delete the last cart then the timer will stop so you don't have to do anything, and when you add the first cart then it will start again.
If you fall of from the cart, then the cart will automatically re-spawn. It will also automatically re-spawn if you drive into the object (example - mountain).
I didn't use MapAndreas (plugin / include) or anything similar, you can't control the cart's height, so there is a "bug" where you can drive / fly over parts (objects) on map which have the lower height than cart.
This is a script which allows you to drive on the "dog cart" objects. It can be useful if you want to have some fun. Unfortunately, there is no horse-object in SA:MP as far as I know, so I was forced to use cow-object.
Pictures:
/imageshack/img411/1172/13346910.png
/imageshack/img560/862/25598101.png
/imageshack/img685/4417/79315373.png
/imageshack/img28/5204/86170747.png
/imageshack/img341/2150/11596993.png
/imageshack/img690/6373/82492909.png
Credits:
- ****** for foreach & GetXYInFrontOfPlayer functions,
- ZeeX for zcmd command processor.
How to install?
It's easy and simple - download and put the dc.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 <dc>
pawn Код:
#include <a_samp>
Example:
pawn Код:
/*
CreateDogCart(Float:x, Float:y, Float:z, Float:rz = 0.0);
*/
CreateDogCart(1777.5, -1930.4, 13.975, 270.0);
CreateDogCart(1782.5, -1930.4, 13.975, 270.0);
CreateDogCart(1787.5, -1930.4, 13.975, 270.0);
pawn Код:
1772.5, -1916.4, 13.5527
Functions:
CreateDogCart
Adds the dog cart to the server.
@Float: x = Cart spawn X position.
@Float: y = Cart spawn Y position.
@Float: z = Cart spawn Z position.
@Float: rz = Cart spawn Z rotation.
returns the cart ID which starts with 0. If you exceed the MAX_DOG_CARTS define then it will return the invalid ID which is -1.
Example:
pawn Код:
new
gCart = -1;
public OnGameModeInit()
{
gCart = CreateDogCart(1777.5, -1930.4, 13.975, 270.0);
return true;
}
Deletes the dog cart from the server.
@dcid = The cart ID.
returns true if the cart is valid and false if it's not.
Example:
pawn Код:
DestroyDogCart(gCart);
Checks if dog cart is created.
@dcid = The cart ID.
returns true if the cart is valid and false if it's not.
Example:
pawn Код:
if(IsDogCartCreated(gCart)) printf("Cart is created.");
else printf("Cart is NOT created.");
Stops the dog cart.
@dcid = The cart ID.
returns true if the cart is valid and false if it's not.
Example:
pawn Код:
StopDogCart(gCart);
Re-spawns the dog cart.
@dcid = The cart ID.
returns true if the cart is valid and false if it's not.
Example:
pawn Код:
RespawnDogCart(gCart);
Sets the speed of the dog cart.
@dcid = The cart ID.
@cartspeed = The speed to set for the cart.
returns true if the cart is valid and false if it's not.
If the you set the speed which is higher than MAX_DOG_CART_SPEED, then the function will automatically set it to the MAX_DOG_CART_SPEED.
Example:
This will set the speed of the cart to 3.5:
pawn Код:
SetDogCartSpeed(gCart, 3.5);
pawn Код:
SetDogCartSpeed(gCart);
Checks if player is near the dog cart.
@playerid = The ID of the player.
@dcid = The cart ID.
returns true if the player is near the cart and false if he isn't.
Example:
pawn Код:
if(IsPlayerAtDogCart(playerid, gCart)) printf("Player is near the cart with ID %i.", gCart);
else printf("Player is NOT near the cart with ID %i.", gCart);
Checks if player is near any dog cart.
@playerid = The ID of the player.
returns ID of the cart which stars with 0 if player is near any cart and -1 is he's not.
Example:
pawn Код:
new
gCart = IsPlayerAtAnyDogCart(playerid);
if(gCart != -1) printf("Player is near the cart with ID %i.", gCart);
else printf("Player is NOT near any cart.");
Defines:
pawn Код:
#define MAX_DOG_CARTS (5)
#define MAX_DOG_CART_SPEED (10.0)
MAX_DOG_CART_SPEED - The maximum speed of the cart. It shouldn't be too big.
How to get coordinates for carts?
I myself am using JernejL's REAL Map Editor, in which I place the dog cart objects (ID 3585 for "cart") where I want to have them. This Map Editor is not for people with weak computers, so if you have a weak computer, you can use any other Map Editor. The z rotation is the rotation of the cart.
Download:
http://www.solidfiles.com/d/d18f52287c
Other:
If you want to start with the driving, then get near the cart (jump inside of it or on it) and use the "/cart" command. If you want to stop with the driving, then use the "/cart" command once again.
Use arrow keys (UP, DOWN, LEFT and RIGHT) to control the cart's movement:
arrow UP = forward
arrow DOWN = stopping
arrow LEFT = turn left
arrow RIGHT = turn right
When you delete the last cart then the timer will stop so you don't have to do anything, and when you add the first cart then it will start again.
If you fall of from the cart, then the cart will automatically re-spawn. It will also automatically re-spawn if you drive into the object (example - mountain).
I didn't use MapAndreas (plugin / include) or anything similar, you can't control the cart's height, so there is a "bug" where you can drive / fly over parts (objects) on map which have the lower height than cart.