#include // This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blank Filterscript by your name here"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n----------------------------------"); print(" Blank Gamemode by your name here"); print("----------------------------------\n"); } #endif #define Type8(%0,%1,%2,%3,%4,%5,%6) \ (((%0 - %3) * (%0 - %3)) + ((%1 - %4) * (%1 - %4)) + ((%2 - %5) * (%2 - %5)) <= %6 * %6) public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); new time0, time1, time2, time3, time4, time5, time6, time7, time8, Float:x = 10.0, Float:y = 20.0, Float:z = 30.0, Float:dist = 70.0, Float:pos[1][3] = {{40.0, 50.0, 60.0}}; #define LOOPS 1000000 time0 = GetTickCount(); for (new i = 0; i < LOOPS; i++) { Type1(x, y, z, pos[0][0], pos[0][1], pos[0][2], dist); } time1 = GetTickCount(); for (new i = 0; i < LOOPS; i++) { Type2(x, y, z, pos[0][0], pos[0][1], pos[0][2], dist); } time2 = GetTickCount(); for (new i = 0; i < LOOPS; i++) { Type3(x, y, z, pos[0][0], pos[0][1], pos[0][2], dist); } time3 = GetTickCount(); for (new i = 0; i < LOOPS; i++) { Type4(x, y, z, pos[0][0], pos[0][1], pos[0][2], dist); } time4 = GetTickCount(); for (new i = 0; i < LOOPS; i++) { Type5(x, y, z, pos[0][0], pos[0][1], pos[0][2], dist); } time5 = GetTickCount(); for (new i = 0; i < LOOPS; i++) { Type6(x, y, z, pos[0][0], pos[0][1], pos[0][2], dist); } time6 = GetTickCount(); for (new i = 0; i < LOOPS; i++) { Type7(x, y, z, pos[0][0], pos[0][1], pos[0][2], dist); } time7 = GetTickCount(); for (new i = 0; i < LOOPS; i++) { Type8(x, y, z, pos[0][0], pos[0][1], pos[0][2], dist); } time8 = GetTickCount(); printf("%d %d %d %d %d %d %d %d %d", time1 - time0, time2 - time1, time3 - time2, time4 - time3, time5 - time4, time6 - time5, time7 - time6, time8 - time7); return 1; } Type1(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:dist) { x1 = (x1 > x2) ? x1 - x2 : x2 - x1; if (x1 > dist) return false; y1 = (y1 > y2) ? y1 - y2 : y2 - y1; if (y1 > dist) return false; z1 = (z1 > z2) ? z1 - z2 : z2 - z1; if (z1 > dist) return false; return true; } Type2(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:dist) { dist *= dist; x1 -= x2; x1 *= x1; if (x1 > dist) return false; y1 -= y2; y1 *= y1; if (y1 > dist) return false; z1 -= z2; z1 *= z1; if (z1 > dist) return false; return true; } Type3(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:dist) { x1 -= x2; x1 *= x1; y1 -= y2; y1 *= y1; z1 -= z2; z1 *= z1; return (x1 + y1 + z1 <= dist * dist); } Type4(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:dist) { x1 -= x2; y1 -= y2; z1 -= z2; return ((x1 * x1) + (y1 * y1) + (z1 * z1) <= dist * dist); } Type5(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:dist) { return (((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)) + ((z1 - z2) * (z1 - z2)) <= dist * dist); } Type6(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:dist) { dist *= dist; x1 -= x2; if (x1 * x1 > dist) return false; y1 -= y2; if (y1 * y1 > dist) return false; z1 -= z2; if (z1 * z1 > dist) return false; return true; } Type7(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:dist) { dist *= dist; if ((x1 - x2) * (x1 - x2) > dist) return false; if ((y1 - y2) * (y1 - y2) > dist) return false; if ((z1 - z2) * (z1 - z2) > dist) return false; return true; } 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) { return 1; } public OnPlayerSpawn(playerid) { 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; } 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; }