Public feed #603313

Something

public text v1 · immutable
Raw Edit
·published 2007-07-04 18:21 UTC
rendered paste body
#include <a_samp>
#define VEHICLES 7
#define COLOR_RED 0xFF00008A
#define COLOR_GREEN 0x00FF008A
#define COLOR_YELLOW 0xFFFF80A
#define COLOR_WHITE 0xFFFFFFA
#define COLOR_GRAY 0x888888A

new gatesOpened = false;
new gatesAnimationStep = 0;
new gatesAnimationStepMax = 16;
new gatesInAnimation = false;
new gatesL;
new gatesR;

forward checkGates();
SetTimer( "checkGates", 1000, true );

main()
{
	print("\n----------------------------------");
	print("        Chillosophy's Mansion");
	print("----------------------------------\n");
}

public checkGates()
{
    new Float:x, Float:y, Float:z;
    for (new a = 0; a < MAX_PLAYERS; a++)
    {
        if (IsPlayerConnected(a))
        {
            GetPlayerPos(a, x, y, z);
            if (x > 209 && y > 2985 && z > 8 && x < 232 && y < 3032 && z < 20 )
            {
                if( gatesOpened == false && gatesInAnimation == false )
                {
                    new gatesTimer = SetTimer("openGates", 50, true);
				}
            else
                if( gatesOpened = true && gatesInAnimation == false )
                {
                    new gatesTimer = SetTimer("closeGates", 50, true);
                }
            }
        }
    }
    return 1;
}

public openGates()
{
	if( gatesAnimationStep < gatesAnimationStepMax )
	{
	    gatesInAnimation = true;
		GetObjectRot( fenceL, x, y, z );
		SetObjectRot( fenceL, x - 4, y, z);
	} else {
		KillTimer( gatesTimer );
		gatesOpened = true;
	    gatesInAnimation = false;
	}
}

public closeGates()
{
	if( gatesAnimationStep > 0 )
	{
	    gatesInAnimation = true;
		GetObjectRot( fenceL, x, y, z );
		SetObjectRot( fenceL, x - 4, y, z);
	} else {
		KillTimer( gatesTimer );
		gatesOpened = false;
	    gatesInAnimation = false;
	}

}

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Chillosophy's Mansion");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

	AddStaticVehicle(522, 215.881989, 3065.279053, 14.417618, 360,0,0);
	AddStaticVehicle(522, 216.881989, 3065.279053, 14.417618, 360,0,0);
	AddStaticVehicle(522, 217.881989, 3065.279053, 14.417618, 360,0,0);
	AddStaticVehicle(447, 259.037933, 3066.670898, 17.494267, 18.0812,0,0);
	AddStaticVehicle(559, 168.474930, 3070.118652, 15.260443, 286,0,0);
	AddStaticVehicle(522, 172.293396, 3055.150146, 15.257240, 286,0,0);
	AddStaticVehicle(446, 282.1247, 3012.2231, -1.9318, 286.4644,0,0);
	CreateObject(5184,236.433762,3041.327881,32.614983, 0, 0, 18);
	CreateObject(5184,179.858780,3068.351807,32.640053, 0, 0, 290);
	CreateObject(5184,206.433273,3122.939209,32.539970, 0, 0, 198);
	CreateObject(5184,263.033325,3095.731201,32.565002, 0, 0, 109);
	CreateObject(3753,280.446136,3025.257080,4.405696, 0, 0, 199);
	CreateObject(18256,240.320862,2998.805176,2.596467, 0, 353, 115);
	CreateObject(18256,257.620605,2951.724121,-3.653532, 0, 353, 115);
	CreateObject(3749,226.751160,3016.339844,19.615654, 0, 0, 18);
	CreateObject(8150,162.321442,3062.359619,16.858269, 0, 0, 109);
	CreateObject(8150,281.655731,3102.536621,16.833195, 0, 0, 109);
	CreateObject(8150,200.556183,3141.232910,16.808195, 0, 0, 18);
	// 985, 986: hekken
	gatesL = CreateObject(985,223.056152,3014.989746,15.467908, 0, 0, 199);
	gatesR = CreateObject(986,230.514771,3017.677246,15.467908, 0, 0, 200);
	CreateObject(987,183.348251,3002.933350,13.757240, 0, 0, 19);
	CreateObject(987,194.548325,3006.956299,13.757240, 0, 0, 19);
	CreateObject(987,205.823563,3011.006104,13.757240, 0, 0, 19);
	CreateObject(987,235.517044,3021.205322,13.757240, 0, 0, 18);
	CreateObject(987,246.791611,3025.027100,13.757240, 0, 0, 18);
	CreateObject(987,258.141602,3028.727295,13.757240, 0, 0, 18);
	CreateObject(987,269.541321,3032.451416,13.757240, 0, 0, 18);
	CreateObject(987,291.241333,3039.678467,13.757240, 0, 0, 18);
	CreateObject(986,284.649811,3037.415283,15.342839, 0, 0, 197);
	CreateObject(3799,289.346008,3040.471436,13.617179, 0, 0, 17);
	CreateObject(3799,289.346008,3040.471436,15.767185, 0, 0, 17);
	CreateObject(3799,289.346008,3040.471436,17.942190, 0, 0, 17);
	CreateObject(5184,237.334213,3041.482178,32.640053, 0, 0, 18);
	CreateObject(6522,238.162354,3122.424805,21.957750, 0, 0, 18);
	CreateObject(1481,251.384521,3147.922363,18.328064, 0, 0, 0);
	CreateObject(941,247.511948,3147.100830,18.124651, 0, 0, 21);
	CreateObject(1646,260.238708,3115.484619,17.962368, 0, 0, 107);
	CreateObject(1646,259.588745,3117.188721,17.937368, 0, 0, 107);
	CreateObject(1518,248.218613,3147.378418,18.880302, 0, 0, 0);
	CreateObject(1364,227.106125,3113.256104,14.466311, 0, 0, 292);
	CreateObject(1364,223.381363,3123.500244,14.466311, 0, 0, 292);
	CreateObject(1597,263.651276,3123.167725,20.307322, 0, 0, 19);
	CreateObject(1597,258.776306,3137.690674,20.282322, 0, 0, 19);
	CreateObject(3509,216.919312,3140.968018,13.674498, 0, 0, 0);
	CreateObject(3509,233.253967,3090.184814,13.674498, 0, 0, 0);
	CreateObject(3743,265.026733,3099.775391,15.691349, 0, 0, 200);
	CreateObject(1598,256.935028,3125.457764,17.979939, 0, 0, 0);
	CreateObject(5400,173.409958,3076.709229,14.090876, 0, 0, 290);
	CreateObject(9241,259.474091,3066.798584,15.166142, 0, 0, 289);
	CreateObject(8251,176.277634,3064.804443,17.685055, 0, 0, 18);
	CreateObject(620,186.956039,3007.334229,13.824398, 0, 0, 0);
	CreateObject(621,144.053711,3118.979492,13.660656, 0, 0, 0);
	CreateObject(624,299.349426,3044.467285,13.121725, 0, 0, 0);
	CreateObject(2100,247.490631,3142.100098,17.699133, 0, 0, 107);
	CreateObject(14651,255.079147,3133.632324,19.941402, 0, 0, 21);
	CreateObject(14791,169.891846,3062.936768,15.802301, 0, 0, 18);
	CreateObject(13592,160.685669,3098.497314,23.752851, 0, 0, 300);
	CreateObject(13592,167.535828,3101.194580,23.752851, 0, 0, 300);
	CreateObject(13592,174.460785,3103.872803,23.752851, 0, 0, 300);
	CreateObject(13592,181.410919,3106.596924,23.752851, 0, 0, 300);
	CreateObject(13592,188.361053,3109.346924,23.752851, 0, 0, 300);


	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	new PlayerName[30], str[256], strt[256];
	GetPlayerName(playerid, PlayerName, 30);
	format(str, 256, "Welcome to Chillosophy's mansion, %s!", PlayerName);
	format(strt, 256, "*** %s has joined the server", PlayerName);
	SendClientMessageToAll(COLOR_GRAY, strt);
	SendClientMessage(playerid, COLOR_GREEN, str);
	SendClientMessage(playerid, COLOR_WHITE, "Type /commands for a list of commands");
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new PlayerName[30], str[256];
	GetPlayerName(playerid, PlayerName, 30);
	format(str, 256, "*** %s has left the server (%s)", PlayerName, reason);
	SendClientMessageToAll(COLOR_GRAY, str);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	SetPlayerPos( playerid, 213.881989, 3065.279053, 14.417618 );
	GivePlayerWeapon( playerid, 26, 500 );
	GivePlayerWeapon( playerid, 28, 500 );
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	if (strcmp("/cargod", cmdtext, true) == 0)
	{
	    for (new b = 1; b <= VEHICLES; b++)
	    {
	        SetVehicleHealth(b, 99999.9);
	    }
	    return 1;
	}
	if (strcmp("/commands", cmdtext, true) == 0)
	{
	    SendClientMessage(playerid, COLOR_YELLOW, "Usuk!");
		return 1;
	}
	if (strcmp(cmdtext, "/coord", true)==0)
		{
		new t = playerid;
		new Float:Pos[MAX_PLAYERS][4];
	    new str[256];
		GetPlayerPos(t,Pos[t][0],Pos[t][1],Pos[t][2]);
		GetPlayerFacingAngle(t,Pos[t][3]);
		format(str, 256,"x= %.4f y= %.4f z= %.4f a= %.4f",Pos[t][0],Pos[t][1],Pos[t][2],Pos[t][3]);
		SendClientMessage(playerid, COLOR_WHITE, str);
		return 1;
	}
	return 0;
}

public OnPlayerInfoChange(playerid)
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}