pirateship command help
#1

Код:
//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;
}
please help i need to set it so that the player can only use the command if the player is within a set range of the vehicle
i have tried hard please help
Reply


Messages In This Thread
pirateship command help - by PSYCHOBABYKILLA - 26.03.2015, 11:24
Re: [HELP]pirateship command help - by CalvinC - 26.03.2015, 11:27
Re: [HELP]pirateship command help - by Aly - 26.03.2015, 11:31
Re: pirateship command help - by PSYCHOBABYKILLA - 26.03.2015, 21:53
Re: pirateship command help - by Pottus - 26.03.2015, 21:55
Re: pirateship command help - by PSYCHOBABYKILLA - 26.03.2015, 22:05
Re: pirateship command help - by Pottus - 26.03.2015, 22:09
Re: pirateship command help - by PSYCHOBABYKILLA - 26.03.2015, 23:22
Re: pirateship command help - by PSYCHOBABYKILLA - 27.03.2015, 02:34
Re: pirateship command help - by CalvinC - 27.03.2015, 05:42

Forum Jump:


Users browsing this thread: 6 Guest(s)