06.10.2013, 21:10
Hey guys, here I created the controllable ship, it's simple but very unique.
Usage is very simple aswell, you just do /commandship and you're the captain of the ship. It's very stable, you can stand on the ship, this is very useful for TDM or DM, this can bring unique idea's to such servers. Enjoy it!
Images:
Code:
Usage is very simple aswell, you just do /commandship and you're the captain of the ship. It's very stable, you can stand on the ship, this is very useful for TDM or DM, this can bring unique idea's to such servers. Enjoy it!
Images:
Code:
pawn Код:
//Pirate Ship by TonyII
#include <a_samp>
#include <zcmd>
new PirateObject,
PirateFence,
PirateRopes,
PirateShip;
new Camera;
new ControllingShip[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Pirate Ship by TonyII is running");
print("--------------------------------------\n");
PirateObject = CreateObject(8493,0,0,-100,0,0,0);
PirateFence = CreateObject(9159,0,0,-100,0,0,0);
PirateRopes = CreateObject(8981,0,0,-100,0,0,0);
PirateShip = AddStaticVehicleEx(454, 723.6520, -1890.7867, -0.0164, 180.0000, -1, -1, -1);
AttachObjectToVehicle(PirateObject, PirateShip, 0.809999, 1.439998, 16.650209, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(PirateRopes, PirateShip, 0.294999, -4.665059, 16.250276, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(PirateFence, PirateShip, 0.784999, 1.439998, 16.655208, 0.000000, 0.000000, 0.000000);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_SECONDARY_ATTACK)
{
if(ControllingShip[playerid] == 1)
{
ControllingShip[playerid] = 0;
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
SetPlayerPos(playerid, X,Y+2,Z+6);
SetCameraBehindPlayer(playerid);
DestroyObject(Camera);
}
}
return 1;
}
CMD:commandship(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(ControllingShip[i] == 1) return SendClientMessage(playerid, -1,"The ship is being held in command by someone else.");
}
Camera = CreateObject(0, 0,0,0,0,0,0);
AttachObjectToVehicle(Camera, PirateShip,0,-35,23,0.000000,0.000000,0.0);
PutPlayerInVehicle(playerid, PirateShip, 0);
AttachCameraToObject(playerid, Camera);
ControllingShip[playerid] = 1;
SendClientMessage(playerid, -1,"Type /quitship or press 'F' if you want to stop commanding this ship.");
return 1;
}
CMD:quitship(playerid, params[])
{
if(ControllingShip[playerid] == 0) return SendClientMessage(playerid, -1,"You do not command the ship.");
ControllingShip[playerid] = 0;
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
SetPlayerPos(playerid, X,Y+2,Z+6);
SetCameraBehindPlayer(playerid);
DestroyObject(Camera);
return 1;
}