All pastes #215329 Raw Edit

Object Viewer

public text v1 · immutable
#215329 ·published 2006-10-22 15:37 UTC
rendered paste body
#include <a_samp>

#define dcmd(%1,%2) if ((strcmp(cmdtext, "/%1", true, %2 + 1) == 0) && (((cmdtext[%2 + 1] == 0) && (dcmd_%1(playerid, ""))) || ((cmdtext[%2 + 1] == 32) && (dcmd_%1(playerid, cmdtext[%2 + 2]))))) return 1

//#define FILTERSCRIPT
#define X_POS(%1) (float(%1) * 50.0) - 2500.0

new gInSel[MAX_PLAYERS];
new curobj[MAX_PLAYERS];

forward SelLoop();

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n====================================");
	print("|                                  |");
	print("|       Blank Filter Script!       |");
	print("|      ----------------------      |");
	print("|                                  |");
	print("| By Alex \"Y_Less\" Cole - (c) 2006 |");
	print("|                                  |");
	print("====================================\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n====================================");
	print("|                                  |");
	print("|      Blank Gamemode Script!      |");
	print("|     ------------------------     |");
	print("|                                  |");
	print("| By Alex \"Y_Less\" Cole - (c) 2006 |");
	print("|                                  |");
	print("====================================\n");
}

#endif

public OnGameModeInit()
{
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	SetTimer("SelLoop", 200, 1);
	return 1;
}

public SelLoop()
{
	static lastcall[MAX_PLAYERS];
	static dir2[MAX_PLAYERS];
	static playerobj[MAX_PLAYERS];
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
		if (gInSel[i] && IsPlayerConnected(i))
		{
			new key = GetPlayerKeys(i);
			new dir; // = dir2[i];
			//new pause = 0;
			switch (key)
			{
				case KEY_CROUCH:
				{
					dir = -1;
				}
				case KEY_JUMP:
				{
					dir = 1;
				}
				case KEY_ACTION:
				{
					// Exit
					TogglePlayerControllable(i, 1);
					gInSel[i] = 0;
					SetCameraBehindPlayer(i);
				}
				case KEY_FIRE:
				{
					// Make the object
					dir = 0;
				}
				/*case KEY_SPRINT:
				{
					pause = 1;
				}*/
				default:
				{
					dir = dir2[i];
				}
			}
			//if (!pause)
			//{
			if (GetTickCount() - lastcall[i] < 1000) return;
			//}
			lastcall[i] = GetTickCount();
			if (dir)
			{
				new obj = curobj[i];
				do
				{
					obj += dir;
					if (obj >= 19000) obj = 0;
					if (obj <= -1) obj = 19000;
				}
				while (!IsValidModel(obj));
				if (IsValidObject(playerobj[i]))
				{
					DestroyObject(playerobj[i]);
					playerobj[i] = 0;
				}
				playerobj[i] = CreateObject(obj, X_POS(i), 0.0, 5000.0, 0.0, 0.0, 0.0);
				new str[16];
				format(str, sizeof (str), "Modelid: %d", obj);
				GameTextForPlayer(i, str, 20001, 3);
				curobj[i] = obj;
				dir2[i] = dir;
			}
		}
	}
}

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)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	gInSel[playerid] = 0;
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(entersel, 8);
	dcmd(setobj, 6);
	dcmd(zoom, 4);
	return 0;
}

dcmd_zoom(playerid, text[])
{
	#pragma unused text
	if (gInSel[playerid])
	{
		SetPlayerCameraPos(playerid, X_POS(playerid), -5.0, 5000.0);
		SetPlayerCameraLookAt(playerid, X_POS(playerid), 0.0, 5000.0);
	}
	else
	{
		SendClientMessage(playerid, 0xFF0000AA, "You must be in object selection mode to use this");
	}
	return 1;
}

dcmd_setobj(playerid, text[])
{
	curobj[playerid] = strval(text);
	return 1;
}

dcmd_entersel(playerid, text[])
{
	#pragma unused text
	//TogglePlayerControllable(playerid, 0);
	gInSel[playerid] = 1;
	SetPlayerCameraPos(playerid, X_POS(playerid), 0.0, 5050.0);
	SetPlayerCameraLookAt(playerid, X_POS(playerid), 0.0, 5000.0);
	return 1;
}

IsValidModel(modelid)
{
	static modeldat[] =
	{
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -128,
		-515899393, -134217729, -1, -1, 33554431, -1, -1, -1, -14337, -1, -33,
		127, 0, 0, 0, 0, 0, -8388608, -1, -1, -1, -16385, -1, -1, -1, -1, -1,
		-1, -1, -33, -1, -771751937, -1, -9, -1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, 33554431, -25, -1, -1, -1, -1, -1, -1,
		-1073676289, -2147483648, 34079999, 2113536, -4825600, -5, -1, -3145729,
		-1, -16777217, -63, -1, -1, -1, -1, -201326593, -1, -1, -1, -1, -1,
		-257, -1, 1073741823, -133122, -1, -1, -65, -1, -1, -1, -1, -1, -1,
		-2146435073, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1073741823, -64, -1,
		-1, -1, -1, -2635777, 134086663, 0, -64, -1, -1, -1, -1, -1, -1, -1,
		-536870927, -131069, -1, -1, -1, -1, -1, -1, -1, -1, -16384, -1,
		-33554433, -1, -1, -1, -1, -1, -1610612737, 524285, -128, -1,
		2080309247, -1, -1, -1114113, -1, -1, -1, 66977343, -524288, -1, -1, -1,
		-1, -2031617, -1, 114687, -256, -1, -4097, -1, -4097, -1, -1,
		1010827263, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -32768, -1, -1, -1, -1, -1,
		2147483647, -33554434, -1, -1, -49153, -1148191169, 2147483647,
		-100781080, -262145, -57, 134217727, -8388608, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1048577, -1, -449, -1017, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1835009, -2049, -1, -1, -1, -1, -1, -1,
		-8193, -1, -536870913, -1, -1, -1, -1, -1, -87041, -1, -1, -1, -1, -1,
		-1, -209860, -1023, -8388609, -2096897, -1, -1048577, -1, -1, -1, -1,
		-1, -1, -897, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1610612737,
		-3073, -28673, -1, -1, -1, -1537, -1, -1, -13, -1, -1, -1, -1, -1985,
		-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1056964609, -1, -1, -1,
		-1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
		-236716037, -1, -1, -1, -1, -1, -1, -1, -536870913, 3, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -2097153, -2109441, -1, 201326591, -4194304, -1, -1,
		-241, -1, -1, -1, -1, -1, -1, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, -32768, -1, -1, -1, -2, -671096835, -1, -8388609, -66323585, -13,
		-1793, -32257, -247809, -1, -1, -513, 16252911, 0, 0, 0, -131072,
		33554383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8356095, 0, 0, 0, 0, 0,
		0, -256, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
		-268435449, -1, -1, -2049, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
		92274627, -65536, -2097153, -268435457, 591191935, 1, 0, -16777216, -1,
		-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127
	};
	if ((modelid >= 0) && ((modelid / 32) < sizeof (modeldat)) && (modeldat[modelid / 32] & (1 << (modelid % 32))))
	{
	    return 1;
	}
	return 0;
}