commit a113c2d258c9814fa736cb514e6c6aa5f4f02e6a Author: Niels Peretzke Date: Sun Aug 18 00:34:04 2019 +0200 initial commit diff --git a/.gitignore.txt b/.gitignore.txt new file mode 100644 index 0000000..3e87dc4 --- /dev/null +++ b/.gitignore.txt @@ -0,0 +1,3 @@ +*.exe +samp-license.txt +server-readme.txt \ No newline at end of file diff --git a/announce.exe b/announce.exe new file mode 100644 index 0000000..22db845 Binary files /dev/null and b/announce.exe differ diff --git a/filterscripts/a51_base.amx b/filterscripts/a51_base.amx new file mode 100644 index 0000000..327d6dd Binary files /dev/null and b/filterscripts/a51_base.amx differ diff --git a/filterscripts/a51_base.pwn b/filterscripts/a51_base.pwn new file mode 100644 index 0000000..239efc2 --- /dev/null +++ b/filterscripts/a51_base.pwn @@ -0,0 +1,422 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the Area 51 (69) Base Objects +// ------------------------------------------------------ +// By Matite in March 2015 +// +// +// This script removes the existing GTASA Area 51 (69) land section, fence and +// buildings. It then replaces the land section and buildings with the new +// enterable versions. It also replaces the perimeter fence and adds two +// gates that can be opened or closed. +// +// Warning... +// This script uses a total of: +// * 11 objects = 1 for the replacement land object, 7 for the replacement +// building objects, 1 for the outer fence and 2 for the gates +// * Enables the /a51 command to teleport the player to the Area 51 (69) Base +// * 2 3D Text Labels = 1 on each gate +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + +// For PlaySoundForPlayersInRange() +#include "../include/gl_common.inc" + + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Used for messages sent to the player +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + +// Used for the northern and eastern A51 (69) gates status flags +#define GATES_CLOSED 0 +#define GATES_CLOSING 1 +#define GATES_OPEN 2 +#define GATES_OPENING 3 + + +// ----------------------------------------------------------------------------- +// Constants +// --------- + +// Gate names for the 3D text labels +static GateNames[2][] = +{ + "Northern Gate", + "Eastern Gate" +}; + +// ----------------------------------------------------------------------------- +// Variables +// --------- + +// Stores the created object numbers of the replacement Area 51 (69) land object, +// buildings and fence so they can be destroyed when the filterscript is unloaded +new A51LandObject; // Land object +new A51Buildings[7]; // Building object +new A51Fence; // Fence +new A51NorthernGate; // Northern Gate +new A51EasternGate; // Eastern Gate + +// Stores a reference to the 3D text labels used on each set of gates so they +// can be destroyed when the filterscript is unloaded +new Text3D:LabelGates[2]; + +// Stores the current status of the northern gate +new NorthernGateStatus = GATES_CLOSED; + +// Stores the current status of the eastern gate +new EasternGateStatus = GATES_CLOSED; + + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/a51", cmdtext, true, 4) == 0) + { + // Set the interior (outside) + SetPlayerInterior(playerid, 0); + + // Set player position and facing angle (outside the northern gate) + SetPlayerPos(playerid, 135.20, 1948.51, 19.74); + SetPlayerFacingAngle(playerid, 180); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Area 51 (69) Base!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- Area 51 (69) Building Objects Filterscript"); + print(" |-- Script v1.01"); + print(" |-- 28th March 2015"); + print(" |---------------------------------------------------"); + + // Create the A51 Land object + A51LandObject = CreateObject(11692, 199.344, 1943.79, 18.2031, 0, 0, 0); + + // Display information in the Server Console + print(" |-- Area 51 (69) Land object created"); + + // Create the A51 Fence object + A51Fence = CreateObject(19312, 191.141, 1870.04, 21.4766, 0, 0, 0); + + // Display information in the Server Console + print(" |-- Area 51 (69) Fence object created"); + + // Create the A51 Building objects + A51Buildings[0] = CreateObject(19905, 206.798950, 1931.643432, 16.450595, 0, 0, 0); + A51Buildings[1] = CreateObject(19905, 188.208908, 1835.033569, 16.450595, 0, 0, 0); + A51Buildings[2] = CreateObject(19905, 230.378875, 1835.033569, 16.450595, 0, 0, 0); + A51Buildings[3] = CreateObject(19907, 142.013977, 1902.538085, 17.633581, 0, 0, 270.0); + A51Buildings[4] = CreateObject(19907, 146.854003, 1846.008056, 16.533580, 0, 0, 0); + A51Buildings[5] = CreateObject(19909, 137.900390, 1875.024291, 16.836734, 0, 0, 270.0); + A51Buildings[6] = CreateObject(19909, 118.170387, 1875.184326, 16.846735, 0, 0, 0); + + + // Display information in the Server Console + print(" |-- Area 51 (69) Building objects created"); + + // Create the Northern gate object + A51NorthernGate = CreateObject(19313, 134.545074, 1941.527709, 21.691408, 0, 0, 180.0); + + // Create the Eastern gate object + A51EasternGate = CreateObject(19313, 286.008666, 1822.744628, 20.010623, 0, 0, 90.0); + + // Display information in the Server Console + print(" |-- Area 51 (69) Gate objects created"); + + // Create variable + new string[192]; + + // Create 3D Text Label at the prisons eastern gates + format(string, sizeof(string), "{CCCCCC}[%s]\n{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to open or close the gate", GateNames[0]); + LabelGates[0] = Create3DTextLabel(string, 0xCCCCCCAA, 135.09, 1942.37, 19.82, 10.5, 0, 0); + + // Create 3D Text Label at the prisons eastern gates + format(string, sizeof(string), "{CCCCCC}[%s]\n{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to open or close the gate", GateNames[1]); + LabelGates[1] = Create3DTextLabel(string, 0xCCCCCCAA, 287.12, 1821.51, 18.14, 10.5, 0, 0); + + // Display information in the Server Console + print(" |-- Area 51 (69) Gates 3D Text Labels created"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove default GTASA Area 51 (69) land and buildings for the player + // (so any player currently ingame does not have to rejoin for them to + // be removed when this filterscript is loaded) + RemoveBuildingForPlayer(i, 16203, 199.344, 1943.79, 18.2031, 250.0); // Land + RemoveBuildingForPlayer(i, 16590, 199.344, 1943.79, 18.2031, 250.0); // Land LOD + RemoveBuildingForPlayer(i, 16323, 199.336, 1943.88, 18.2031, 250.0); // Buildings + RemoveBuildingForPlayer(i, 16619, 199.336, 1943.88, 18.2031, 250.0); // Buildings LOD + RemoveBuildingForPlayer(i, 1697, 228.797, 1835.34, 23.2344, 250.0); // Solar Panels (they poke through the roof inside) + RemoveBuildingForPlayer(i, 16094, 191.141, 1870.04, 21.4766, 250.0); // Outer Fence + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Check for valid object + if (IsValidObject(A51LandObject)) + { + // Destroy the A51 land object + DestroyObject(A51LandObject); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Area 51 (69) Land object destroyed"); + } + + // Check for valid object + if (IsValidObject(A51Fence)) + { + // Destroy the A51 fence object + DestroyObject(A51Fence); + + // Display information in the Server Console + print(" |-- Area 51 (69) Fence object destroyed"); + } + + // Check for valid object + if (IsValidObject(A51NorthernGate)) + { + // Destroy the A51 northern gate object + DestroyObject(A51NorthernGate); + + // Display information in the Server Console + print(" |-- Area 51 (69) Northern Gate object destroyed"); + } + + // Check for valid object + if (IsValidObject(A51EasternGate)) + { + // Destroy the A51 eastern gate object + DestroyObject(A51EasternGate); + + // Display information in the Server Console + print(" |-- Area 51 (69) Eastern Gate object destroyed"); + } + + // Loop + for (new i = 0; i < sizeof(A51Buildings); i++) + { + // Check for valid object + if (IsValidObject(A51Buildings[i])) + { + // Destroy the A51 building object + DestroyObject(A51Buildings[i]); + + // Display information in the Server Console + printf(" |-- Area 51 (69) Building object %d destroyed", i + 1); + } + } + + // Destroy 3D Text Labels on the northern and eastern gates + Delete3DTextLabel(LabelGates[0]); + Delete3DTextLabel(LabelGates[1]); + + // Display information in the Server Console + print(" |-- Deleted the 3D Text Labels on the Area 51 (69) Gates"); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Area 51 (69) Base Objects Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove default GTASA Area 51 (69) land and buildings for the player + RemoveBuildingForPlayer(playerid, 16203, 199.344, 1943.79, 18.2031, 250.0); // Land + RemoveBuildingForPlayer(playerid, 16590, 199.344, 1943.79, 18.2031, 250.0); // Land LOD + RemoveBuildingForPlayer(playerid, 16323, 199.336, 1943.88, 18.2031, 250.0); // Buildings + RemoveBuildingForPlayer(playerid, 16619, 199.336, 1943.88, 18.2031, 250.0); // Buildings LOD + RemoveBuildingForPlayer(playerid, 1697, 228.797, 1835.34, 23.2344, 250.0); // Solar Panels (they poke through the roof inside) + RemoveBuildingForPlayer(playerid, 16094, 191.141, 1870.04, 21.4766, 250.0); // Outer Fence + + // Exit here (return 1 so this callback is handled in other scripts too) + return 1; +} + +public OnObjectMoved(objectid) +{ + // Check if the object that moved was the northern gate + if (objectid == A51NorthernGate) + { + // Check if the northern gate was closing + if (NorthernGateStatus == GATES_CLOSING) + { + // Set status flag for northern gates + NorthernGateStatus = GATES_CLOSED; + } + else + { + // Set status flag for northern gates + NorthernGateStatus = GATES_OPEN; + } + } + // Check if the object that moved was the eastern gate + else if (objectid == A51EasternGate) + { + // Check if the eastern gate was closing + if (EasternGateStatus == GATES_CLOSING) + { + // Set status flag for eastern gate + EasternGateStatus = GATES_CLOSED; + } + else + { + // Set status flag for eastern gate + EasternGateStatus = GATES_OPEN; + } + } + + // Exit here + return 1; +} + +public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) +{ + // Check if the player pressed the conversation yes key (normally the Y key) + if (newkeys & KEY_YES) + { + // Check if the player is near the eastern A51 gate + if (IsPlayerInRangeOfPoint(playerid, 10.0, 287.12, 1821.51, 18.14)) + { + // Debug + //printf("-->Player ID %d within 10m of the Eastern A51 Gate", playerid); + + // Check if the eastern gate is currently opening (ie moving) + if (EasternGateStatus == GATES_OPENING) + { + // Send chat text message and exit here + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must wait for the eastern gate to fully open first."); + return 1; + } + // Check if the eastern gate is currently closing (ie moving) + else if (EasternGateStatus == GATES_CLOSING) + { + // Send chat text message and exit here + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must wait for the eastern gate to fully close first."); + return 1; + } + + // Play gate opening sound + PlaySoundForPlayersInRange(1035, 50.0, 287.12, 1821.51, 18.14); + + // Check if the eastern gate is currently closed + if (EasternGateStatus == GATES_CLOSED) + { + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Eastern Gate Opening!", 3000, 3); + + // Animate the eastern gate opening + MoveObject(A51EasternGate, 286.008666, 1833.744628, 20.010623, 1.1, 0, 0, 90); + + // Set status flag for eastern gate + EasternGateStatus = GATES_OPENING; + } + else + { + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Eastern Gate Closing!", 3000, 3); + + // Animate the eastern gates closing + MoveObject(A51EasternGate, 286.008666, 1822.744628, 20.010623, 1.1, 0, 0, 90); + + // Set status flag for eastern gate + EasternGateStatus = GATES_CLOSING; + } + } + // Check if the player is near the northern A51 gate + else if (IsPlayerInRangeOfPoint(playerid, 10.0, 135.09, 1942.37, 19.82)) + { + // Debug + //printf("-->Player ID %d within 10m of the Northern A51 Gate", playerid); + + // Check if the northern gate is currently opening (ie moving) + if (NorthernGateStatus == GATES_OPENING) + { + // Send chat text message and exit here + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must wait for the northern gate to fully open first."); + return 1; + } + // Check if the northern gates is currently closing (ie moving) + else if (NorthernGateStatus == GATES_CLOSING) + { + // Send chat text message and exit here + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must wait for the northern gate to fully close first."); + return 1; + } + + // Play gate opening sound + PlaySoundForPlayersInRange(1035, 50.0, 135.09, 1942.37, 19.82); + + // Check if the northern gate is currently closed + if (NorthernGateStatus == GATES_CLOSED) + { + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Northern Gate Opening!", 3000, 3); + + // Animate the northern gates opening + MoveObject(A51NorthernGate, 121.545074, 1941.527709, 21.691408, 1.3, 0, 0, 180); + + // Set status flag for northern gates + NorthernGateStatus = GATES_OPENING; + } + else + { + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Northern Gate Closing!", 3000, 3); + + // Animate the northern gates closing + MoveObject(A51NorthernGate, 134.545074, 1941.527709, 21.691408, 1.3, 0, 0, 180); + + // Set status flag for northern gates + NorthernGateStatus = GATES_CLOSING; + } + } + } + + // Exit here (return 1 so this callback is handled in other scripts too) + return 1; +} + diff --git a/filterscripts/adminspec.amx b/filterscripts/adminspec.amx new file mode 100644 index 0000000..5e8a1ff Binary files /dev/null and b/filterscripts/adminspec.amx differ diff --git a/filterscripts/adminspec.pwn b/filterscripts/adminspec.pwn new file mode 100644 index 0000000..fda238e --- /dev/null +++ b/filterscripts/adminspec.pwn @@ -0,0 +1,121 @@ +// +// ADMIN SPECTATE FILTER SCRIPT +// kye 2007 +// + +#pragma tabsize 0 +#include +#include +#include + +#include "../include/gl_common.inc" + +#define COLOR_GREY 0xAFAFAFAA +#define COLOR_GREEN 0x33AA33AA +#define COLOR_RED 0xAA3333AA +#define COLOR_YELLOW 0xFFFF00AA +#define COLOR_WHITE 0xFFFFFFFF + +//------------------------------------------------------------------------------------------------------ + +#define ADMIN_SPEC_TYPE_NONE 0 +#define ADMIN_SPEC_TYPE_PLAYER 1 +#define ADMIN_SPEC_TYPE_VEHICLE 2 + +new gSpectateID[MAX_PLAYERS]; +new gSpectateType[MAX_PLAYERS]; + +//------------------------------------------------------------------------------------------------------ + +public OnFilterScriptInit() +{ +} + +//------------------------------------------------------------------------------------------------------ + +public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) +{ + // IF ANYONE IS SPECTATING THIS PLAYER, WE'LL ALSO HAVE + // TO CHANGE THEIR INTERIOR ID TO MATCH + new x = 0; + while(x!=MAX_PLAYERS) { + if( IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING && + gSpectateID[x] == playerid && gSpectateType[x] == ADMIN_SPEC_TYPE_PLAYER ) + { + SetPlayerInterior(x,newinteriorid); + } + x++; + } +} + +//------------------------------------------------------------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256]; + new specplayerid, specvehicleid, idx; + + // WE ONLY DEAL WITH COMMANDS FROM ADMINS IN THIS FILTERSCRIPT + if(!IsPlayerAdmin(playerid)) return 0; + + cmd = strtok(cmdtext, idx); + + // SPECTATE A PLAYER + if(strcmp(cmd, "/specplayer", true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext, idx); + + if(!strlen(tmp)) { + SendClientMessage(playerid, COLOR_WHITE, "USAGE: /specplayer [playerid]"); + return 1; + } + specplayerid = strval(tmp); + + if(!IsPlayerConnected(specplayerid)) { + SendClientMessage(playerid, COLOR_RED, "specplayer: that player isn't active."); + return 1; + } + + TogglePlayerSpectating(playerid, 1); + PlayerSpectatePlayer(playerid, specplayerid); + SetPlayerInterior(playerid,GetPlayerInterior(specplayerid)); + gSpectateID[playerid] = specplayerid; + gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER; + + return 1; + } + + // SPECTATE A VEHICLE + if(strcmp(cmd, "/specvehicle", true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext, idx); + + if(!strlen(tmp)) { + SendClientMessage(playerid, COLOR_WHITE, "USAGE: /specvehicle [vehicleid]"); + return 1; + } + specvehicleid = strval(tmp); + + if(specvehicleid < MAX_VEHICLES) { + TogglePlayerSpectating(playerid, 1); + PlayerSpectateVehicle(playerid, specvehicleid); + gSpectateID[playerid] = specvehicleid; + gSpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE; + } + return 1; + } + + // STOP SPECTATING + if(strcmp(cmd, "/specoff", true) == 0) { + TogglePlayerSpectating(playerid, 0); + gSpectateID[playerid] = INVALID_PLAYER_ID; + gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE; + return 1; + } + + return 0; +} + +//------------------------------------------------------------------------------------------------------ + + diff --git a/filterscripts/attachments.amx b/filterscripts/attachments.amx new file mode 100644 index 0000000..7ec3cf0 Binary files /dev/null and b/filterscripts/attachments.amx differ diff --git a/filterscripts/attachments.pwn b/filterscripts/attachments.pwn new file mode 100644 index 0000000..cfc85e4 --- /dev/null +++ b/filterscripts/attachments.pwn @@ -0,0 +1,383 @@ +//------------------------------------------------- +// +// This is an example of using the EditAttachedObject functions +// to allow the player to customize their character. +// +// h02 2012 +// +// SA-MP 0.3e and above +// +//------------------------------------------------- + +#include + +#define DIALOG_ATTACH_INDEX 13500 +#define DIALOG_ATTACH_INDEX_SELECTION DIALOG_ATTACH_INDEX+1 +#define DIALOG_ATTACH_EDITREPLACE DIALOG_ATTACH_INDEX+2 +#define DIALOG_ATTACH_MODEL_SELECTION DIALOG_ATTACH_INDEX+3 +#define DIALOG_ATTACH_BONE_SELECTION DIALOG_ATTACH_INDEX+4 + +enum AttachmentEnum +{ + attachmodel, + attachname[24] +} + +new AttachmentObjects[][AttachmentEnum] = { +{18632, "FishingRod"}, +{18633, "GTASAWrench1"}, +{18634, "GTASACrowbar1"}, +{18635, "GTASAHammer1"}, +{18636, "PoliceCap1"}, +{18637, "PoliceShield1"}, +{18638, "HardHat1"}, +{18639, "BlackHat1"}, +{18640, "Hair1"}, +{18975, "Hair2"}, +{19136, "Hair4"}, +{19274, "Hair5"}, +{18641, "Flashlight1"}, +{18642, "Taser1"}, +{18643, "LaserPointer1"}, +{19080, "LaserPointer2"}, +{19081, "LaserPointer3"}, +{19082, "LaserPointer4"}, +{19083, "LaserPointer5"}, +{19084, "LaserPointer6"}, +{18644, "Screwdriver1"}, +{18645, "MotorcycleHelmet1"}, +{18865, "MobilePhone1"}, +{18866, "MobilePhone2"}, +{18867, "MobilePhone3"}, +{18868, "MobilePhone4"}, +{18869, "MobilePhone5"}, +{18870, "MobilePhone6"}, +{18871, "MobilePhone7"}, +{18872, "MobilePhone8"}, +{18873, "MobilePhone9"}, +{18874, "MobilePhone10"}, +{18875, "Pager1"}, +{18890, "Rake1"}, +{18891, "Bandana1"}, +{18892, "Bandana2"}, +{18893, "Bandana3"}, +{18894, "Bandana4"}, +{18895, "Bandana5"}, +{18896, "Bandana6"}, +{18897, "Bandana7"}, +{18898, "Bandana8"}, +{18899, "Bandana9"}, +{18900, "Bandana10"}, +{18901, "Bandana11"}, +{18902, "Bandana12"}, +{18903, "Bandana13"}, +{18904, "Bandana14"}, +{18905, "Bandana15"}, +{18906, "Bandana16"}, +{18907, "Bandana17"}, +{18908, "Bandana18"}, +{18909, "Bandana19"}, +{18910, "Bandana20"}, +{18911, "Mask1"}, +{18912, "Mask2"}, +{18913, "Mask3"}, +{18914, "Mask4"}, +{18915, "Mask5"}, +{18916, "Mask6"}, +{18917, "Mask7"}, +{18918, "Mask8"}, +{18919, "Mask9"}, +{18920, "Mask10"}, +{18921, "Beret1"}, +{18922, "Beret2"}, +{18923, "Beret3"}, +{18924, "Beret4"}, +{18925, "Beret5"}, +{18926, "Hat1"}, +{18927, "Hat2"}, +{18928, "Hat3"}, +{18929, "Hat4"}, +{18930, "Hat5"}, +{18931, "Hat6"}, +{18932, "Hat7"}, +{18933, "Hat8"}, +{18934, "Hat9"}, +{18935, "Hat10"}, +{18936, "Helmet1"}, +{18937, "Helmet2"}, +{18938, "Helmet3"}, +{18939, "CapBack1"}, +{18940, "CapBack2"}, +{18941, "CapBack3"}, +{18942, "CapBack4"}, +{18943, "CapBack5"}, +{18944, "HatBoater1"}, +{18945, "HatBoater2"}, +{18946, "HatBoater3"}, +{18947, "HatBowler1"}, +{18948, "HatBowler2"}, +{18949, "HatBowler3"}, +{18950, "HatBowler4"}, +{18951, "HatBowler5"}, +{18952, "BoxingHelmet1"}, +{18953, "CapKnit1"}, +{18954, "CapKnit2"}, +{18955, "CapOverEye1"}, +{18956, "CapOverEye2"}, +{18957, "CapOverEye3"}, +{18958, "CapOverEye4"}, +{18959, "CapOverEye5"}, +{18960, "CapRimUp1"}, +{18961, "CapTrucker1"}, +{18962, "CowboyHat2"}, +{18963, "CJElvisHead"}, +{18964, "SkullyCap1"}, +{18965, "SkullyCap2"}, +{18966, "SkullyCap3"}, +{18967, "HatMan1"}, +{18968, "HatMan2"}, +{18969, "HatMan3"}, +{18970, "HatTiger1"}, +{18971, "HatCool1"}, +{18972, "HatCool2"}, +{18973, "HatCool3"}, +{18974, "MaskZorro1"}, +{18976, "MotorcycleHelmet2"}, +{18977, "MotorcycleHelmet3"}, +{18978, "MotorcycleHelmet4"}, +{18979, "MotorcycleHelmet5"}, +{19006, "GlassesType1"}, +{19007, "GlassesType2"}, +{19008, "GlassesType3"}, +{19009, "GlassesType4"}, +{19010, "GlassesType5"}, +{19011, "GlassesType6"}, +{19012, "GlassesType7"}, +{19013, "GlassesType8"}, +{19014, "GlassesType9"}, +{19015, "GlassesType10"}, +{19016, "GlassesType11"}, +{19017, "GlassesType12"}, +{19018, "GlassesType13"}, +{19019, "GlassesType14"}, +{19020, "GlassesType15"}, +{19021, "GlassesType16"}, +{19022, "GlassesType17"}, +{19023, "GlassesType18"}, +{19024, "GlassesType19"}, +{19025, "GlassesType20"}, +{19026, "GlassesType21"}, +{19027, "GlassesType22"}, +{19028, "GlassesType23"}, +{19029, "GlassesType24"}, +{19030, "GlassesType25"}, +{19031, "GlassesType26"}, +{19032, "GlassesType27"}, +{19033, "GlassesType28"}, +{19034, "GlassesType29"}, +{19035, "GlassesType30"}, +{19036, "HockeyMask1"}, +{19037, "HockeyMask2"}, +{19038, "HockeyMask3"}, +{19039, "WatchType1"}, +{19040, "WatchType2"}, +{19041, "WatchType3"}, +{19042, "WatchType4"}, +{19043, "WatchType5"}, +{19044, "WatchType6"}, +{19045, "WatchType7"}, +{19046, "WatchType8"}, +{19047, "WatchType9"}, +{19048, "WatchType10"}, +{19049, "WatchType11"}, +{19050, "WatchType12"}, +{19051, "WatchType13"}, +{19052, "WatchType14"}, +{19053, "WatchType15"}, +{19085, "EyePatch1"}, +{19086, "ChainsawDildo1"}, +{19090, "PomPomBlue"}, +{19091, "PomPomRed"}, +{19092, "PomPomGreen"}, +{19093, "HardHat2"}, +{19094, "BurgerShotHat1"}, +{19095, "CowboyHat1"}, +{19096, "CowboyHat3"}, +{19097, "CowboyHat4"}, +{19098, "CowboyHat5"}, +{19099, "PoliceCap2"}, +{19100, "PoliceCap3"}, +{19101, "ArmyHelmet1"}, +{19102, "ArmyHelmet2"}, +{19103, "ArmyHelmet3"}, +{19104, "ArmyHelmet4"}, +{19105, "ArmyHelmet5"}, +{19106, "ArmyHelmet6"}, +{19107, "ArmyHelmet7"}, +{19108, "ArmyHelmet8"}, +{19109, "ArmyHelmet9"}, +{19110, "ArmyHelmet10"}, +{19111, "ArmyHelmet11"}, +{19112, "ArmyHelmet12"}, +{19113, "SillyHelmet1"}, +{19114, "SillyHelmet2"}, +{19115, "SillyHelmet3"}, +{19116, "PlainHelmet1"}, +{19117, "PlainHelmet2"}, +{19118, "PlainHelmet3"}, +{19119, "PlainHelmet4"}, +{19120, "PlainHelmet5"}, +{19137, "CluckinBellHat1"}, +{19138, "PoliceGlasses1"}, +{19139, "PoliceGlasses2"}, +{19140, "PoliceGlasses3"}, +{19141, "SWATHelmet1"}, +{19142, "SWATArmour1"}, +{19160, "HardHat3"}, +{19161, "PoliceHat1"}, +{19162, "PoliceHat2"}, +{19163, "GimpMask1"}, +{19317, "bassguitar01"}, +{19318, "flyingv01"}, +{19319, "warlock01"}, +{19330, "fire_hat01"}, +{19331, "fire_hat02"}, +{19346, "hotdog01"}, +{19347, "badge01"}, +{19348, "cane01"}, +{19349, "monocle01"}, +{19350, "moustache01"}, +{19351, "moustache02"}, +{19352, "tophat01"}, +{19487, "tophat02"}, +{19488, "HatBowler6"}, +{19513, "whitephone"}, +{19578, "Banana"}, +{19418, "HandCuff"} +}; + +new AttachmentBones[][24] = { +{"Spine"}, +{"Head"}, +{"Left upper arm"}, +{"Right upper arm"}, +{"Left hand"}, +{"Right hand"}, +{"Left thigh"}, +{"Right thigh"}, +{"Left foot"}, +{"Right foot"}, +{"Right calf"}, +{"Left calf"}, +{"Left forearm"}, +{"Right forearm"}, +{"Left clavicle"}, +{"Right clavicle"}, +{"Neck"}, +{"Jaw"} +}; + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if(!strcmp(cmdtext, "/attachments", true)) + { + new string[128]; + for(new x;x +#include "../include/gl_common.inc" + +#define ADMINFS_MESSAGE_COLOR 0xFF444499 +#define PM_INCOMING_COLOR 0xFFFF22AA +#define PM_OUTGOING_COLOR 0xFFCC2299 + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--Base FS loaded.\n"); + return 1; +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256]; + new tmp[256]; + new Message[256]; + new gMessage[256]; + new pName[MAX_PLAYER_NAME+1]; + new iName[MAX_PLAYER_NAME+1]; + new idx; + + cmd = strtok(cmdtext, idx); + + // PM Command + if(strcmp("/pm", cmd, true) == 0) + { + tmp = strtok(cmdtext,idx); + + if(!strlen(tmp) || strlen(tmp) > 5) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)"); + return 1; + } + + new id = strval(tmp); + gMessage = strrest(cmdtext,idx); + + if(!strlen(gMessage)) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)"); + return 1; + } + + if(!IsPlayerConnected(id)) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Bad player ID"); + return 1; + } + + if(playerid != id) { + GetPlayerName(id,iName,sizeof(iName)); + GetPlayerName(playerid,pName,sizeof(pName)); + format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage); + SendClientMessage(playerid,PM_OUTGOING_COLOR,Message); + format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage); + SendClientMessage(id,PM_INCOMING_COLOR,Message); + PlayerPlaySound(id,1085,0.0,0.0,0.0); + + printf("PM: %s",Message); + + } + else { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"You cannot PM yourself"); + } + return 1; + } + + //Kick Command + if(strcmp("/kick", cmd, true) == 0) + { + if(IsPlayerAdmin(playerid)) { + tmp = strtok(cmdtext,idx); + if(!strlen(tmp) || strlen(tmp) > 5) { + return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /kick (id) [reason]"); + } + + new id = strval(tmp); + + if(!IsPlayerConnected(id)) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : Bad player ID"); + return 1; + } + + gMessage = strrest(cmdtext,idx); + + GetPlayerName(id,iName,sizeof(iName)); + SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been kicked from the server."); + + if(strlen(gMessage) > 0) { + format(Message,sizeof(Message),"Reason: %s",gMessage); + SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message); + } + + format(Message,sizeof(Message),">> %s(%d) has been kicked.",iName,id); + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message); + + Kick(id); + return 1; + } else { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : You are not an admin"); + return 1; + } + } + + //Ban Command + if(strcmp("/ban", cmd, true) == 0) + { + if(IsPlayerAdmin(playerid)) { + tmp = strtok(cmdtext,idx); + if(!strlen(tmp) || strlen(tmp) > 5) { + return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /ban (id) [reason]"); + } + + new id = strval(tmp); + + if(!IsPlayerConnected(id)) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : Bad player ID"); + return 1; + } + + gMessage = strrest(cmdtext,idx); + + GetPlayerName(id,iName,sizeof(iName)); + SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been banned from the server."); + + if(strlen(gMessage) > 0) { + format(Message,sizeof(Message),"Reason: %s",gMessage); + SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message); + } + + format(Message,sizeof(Message),">> %s(%d) has been banned.",iName,id); + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message); + + Ban(id); + return 1; + } else { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : You are not an admin"); + return 1; + } + } + + return 0; +} diff --git a/filterscripts/baseaf.amx b/filterscripts/baseaf.amx new file mode 100644 index 0000000..9e5337d Binary files /dev/null and b/filterscripts/baseaf.amx differ diff --git a/filterscripts/baseaf.pwn b/filterscripts/baseaf.pwn new file mode 100644 index 0000000..97f9091 --- /dev/null +++ b/filterscripts/baseaf.pwn @@ -0,0 +1,234 @@ +// +// Base FS for Sanandreas Multiplayer 0.3 +// Contains /pm /kick /ban commands - it also features +// a basic anti flood system, and admin chatting for rcon admins +// using # + +#include +#include "../include/gl_common.inc" + +#define ADMINFS_MESSAGE_COLOR 0xFF444499 +#define PM_INCOMING_COLOR 0xFFFF22AA +#define PM_OUTGOING_COLOR 0xFFCC2299 + +static iPlayerChatTime[MAX_PLAYERS]; +static szPlayerChatMsg[MAX_PLAYERS][128]; + +//------------------------------------------------ + +stock IsPlayerFlooding(playerid) +{ + if(GetTickCount() - iPlayerChatTime[playerid] < 2000) + return 1; + + return 0; +} + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--Base FS loaded.\n"); + return 1; +} + +//------------------------------------------------ + +public OnPlayerText(playerid, text[]) +{ + // Is the player flooding? + if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid)) + { + SendClientMessage(playerid, 0xFF0000FF, "* You can only send a message once every two seconds."); + return 0; + } + + // Now we handle the admin chat, will be #. + if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1) + { + new str[128]; + new szPlayerName[MAX_PLAYER_NAME]; + GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME); + + if(IsPlayerAdmin(playerid)) + { + format(str, 128, "Admin %s: %s", szPlayerName, text[1]); + + for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++) + { + if(!IsPlayerConnected(iPlayerID)) continue; + if(!IsPlayerAdmin(iPlayerID)) continue; + SendClientMessage(iPlayerID, PM_INCOMING_COLOR, str); + } + } + + return 0; + } + + // Okay, now it's time for anti repeating. + if(!IsPlayerAdmin(playerid)) + { + if(strlen(text) == strlen(szPlayerChatMsg[playerid]) && !strcmp(szPlayerChatMsg[playerid], text, false)) + { + SendClientMessage(playerid, 0xFF0000FF, "* Please do not repeat yourself."); + format(szPlayerChatMsg[playerid], 128, "%s", text); + return 0; + } + } + + format(szPlayerChatMsg[playerid], 128, "%s", text); + iPlayerChatTime[playerid] = GetTickCount(); + return 1; +} + +//------------------------------------------------ + +public OnPlayerDisconnect(playerid, reason) +{ + #pragma unused reason + + iPlayerChatTime[playerid] = 0; + szPlayerChatMsg[playerid] = ""; + return 1; +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid)) + { + SendClientMessage(playerid, 0xFF0000FF, "* You can only use commands once every two seconds."); + return 1; + } + + iPlayerChatTime[playerid] = GetTickCount(); + + new cmd[256]; + new tmp[256]; + new Message[256]; + new gMessage[256]; + new pName[MAX_PLAYER_NAME+1]; + new iName[MAX_PLAYER_NAME+1]; + new idx; + + cmd = strtok(cmdtext, idx); + + // PM Command + if(strcmp("/pm", cmd, true) == 0) + { + tmp = strtok(cmdtext,idx); + + if(!strlen(tmp) || strlen(tmp) > 5) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)"); + return 1; + } + + new id = strval(tmp); + gMessage = strrest(cmdtext,idx); + + if(!strlen(gMessage)) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)"); + return 1; + } + + if(!IsPlayerConnected(id)) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Bad player ID"); + } + + if(playerid != id) { + GetPlayerName(id,iName,sizeof(iName)); + GetPlayerName(playerid,pName,sizeof(pName)); + format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage); + SendClientMessage(playerid,PM_OUTGOING_COLOR,Message); + format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage); + SendClientMessage(id,PM_INCOMING_COLOR,Message); + PlayerPlaySound(id,1085,0.0,0.0,0.0); + + printf("PM: %s",Message); + + } + else { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"You cannot PM yourself"); + } + return 1; + } + + //Kick Command + if(strcmp("/kick", cmd, true) == 0) + { + if(IsPlayerAdmin(playerid)) { + tmp = strtok(cmdtext,idx); + if(!strlen(tmp) || strlen(tmp) > 5) { + return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /kick (id) [reason]"); + } + + new id = strval(tmp); + + if(!IsPlayerConnected(id)) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : Bad player ID"); + return 1; + } + + gMessage = strrest(cmdtext,idx); + + GetPlayerName(id,iName,sizeof(iName)); + SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been kicked from the server."); + + if(strlen(gMessage) > 0) { + format(Message,sizeof(Message),"Reason: %s",gMessage); + SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message); + } + + format(Message,sizeof(Message),">> %s(%d) has been kicked.",iName,id); + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message); + + Kick(id); + return 1; + } else { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : You are not an admin"); + return 1; + } + } + + //Ban Command + if(strcmp("/ban", cmd, true) == 0) + { + if(IsPlayerAdmin(playerid)) { + tmp = strtok(cmdtext,idx); + if(!strlen(tmp) || strlen(tmp) > 5) { + return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /ban (id) [reason]"); + } + + new id = strval(tmp); + + if(!IsPlayerConnected(id)) { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : Bad player ID"); + return 1; + } + + gMessage = strrest(cmdtext,idx); + + GetPlayerName(id,iName,sizeof(iName)); + SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been banned from the server."); + + if(strlen(gMessage) > 0) { + format(Message,sizeof(Message),"Reason: %s",gMessage); + SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message); + } + + format(Message,sizeof(Message),">> %s(%d) has been banned.",iName,id); + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message); + + Ban(id); + return 1; + } else { + SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : You are not an admin"); + return 1; + } + } + + return 0; +} + +//----------------------------------------------- diff --git a/filterscripts/cargoship.amx b/filterscripts/cargoship.amx new file mode 100644 index 0000000..b2121ba Binary files /dev/null and b/filterscripts/cargoship.amx differ diff --git a/filterscripts/cargoship.pwn b/filterscripts/cargoship.pwn new file mode 100644 index 0000000..da84eef --- /dev/null +++ b/filterscripts/cargoship.pwn @@ -0,0 +1,216 @@ +// +// Used for testing interpolated rotations with MoveObject +// Also used to test AttachObjectToObject +// A cargo ship goes around and visits some route points +// +// SA-MP 0.3d and above +// +// - Kye 2011 +// + +#include +#include "../include/gl_common.inc" // for PlaySoundForPlayersInRange() + +#define NUM_SHIP_ROUTE_POINTS 25 +#define SHIP_HULL_ID 9585 // massive cargo ship's hull. This is used as the main object +#define SHIP_MOVE_SPEED 10.0 +#define SHIP_DRAW_DISTANCE 300.0 + +#define NUM_SHIP_ATTACHMENTS 10 + +new Float:gShipHullOrigin[3] = +{ -2409.8438, 1544.9453, 7.0000 }; // so we can convert world space to model space for attachment positions + +new gShipAttachmentModelIds[NUM_SHIP_ATTACHMENTS] = { +9586, // Ship main platform +9761, // Ship rails +9584, // Bridge exterior +9698, // Bridge interior +9821, // Bridge interior doors +9818, // Bridge radio desk +9819, // Captain's desk +9822, // Captain's seat +9820, // Bridge ducts and lights +9590 // Cargo bay area +}; + +new Float:gShipAttachmentPos[NUM_SHIP_ATTACHMENTS][3] = { +// these are world space positions used on the original cargo ship in the game +// they will be converted to model space before attaching +{-2412.1250, 1544.9453, 17.0469}, +{-2411.3906, 1544.9453, 27.0781}, +{-2485.0781, 1544.9453, 26.1953}, +{-2473.5859, 1543.7734, 29.0781}, +{-2474.3594, 1547.2422, 24.7500}, +{-2470.2656, 1544.9609, 33.8672}, +{-2470.4531, 1551.1172, 33.1406}, +{-2470.9375, 1550.7500, 32.9063}, +{-2474.6250, 1545.0859, 33.0625}, +{-2403.5078, 1544.9453, 8.7188} +}; + +// Pirate ship route points (position/rotation) +new Float:gShipRoutePoints[NUM_SHIP_ROUTE_POINTS][6] = { +{-1982.57, 2052.56, 0.00, 0.00, 0.00, 144.84}, +{-2178.63, 2103.67, 0.00, 0.00, 0.00, 189.24}, +{-2366.64, 2020.28, 0.00, 0.00, 0.00, 215.22}, +{-2539.06, 1892.52, 0.00, 0.00, 0.00, 215.22}, +{-2722.79, 1787.85, 0.00, 0.00, 0.00, 205.62}, +{-2918.51, 1729.60, 0.00, 0.00, 0.00, 190.50}, +{-3124.70, 1758.03, 0.00, 0.00, 0.00, 156.36}, +{-3316.51, 1850.08, 0.00, 0.00, 0.00, 153.36}, +{-3541.12, 1977.99, 0.00, 0.00, 0.00, 145.74}, +{-3772.54, 2140.70, 0.00, 0.00, 0.00, 144.96}, +{-4078.78, 2272.93, 0.00, 0.00, 0.00, 167.52}, +{-4382.22, 2222.52, 0.00, 0.36, 0.06, 206.70}, +{-4578.11, 2013.70, 0.00, 0.36, 0.54, 244.80}, +{-4603.54, 1718.89, 0.00, 1.92, -0.36, 283.26}, +{-4463.49, 1504.50, 0.00, 0.92, -0.36, 316.32}, +{-4228.00, 1380.52, 0.00, 0.92, -0.36, 342.54}, +{-3950.14, 1346.96, 0.00, 0.02, -0.06, 359.64}, +{-3646.69, 1344.57, 0.00, 0.02, -0.06, 359.64}, +{-3350.01, 1410.39, 0.00, 0.02, -0.06, 384.48}, +{-2854.63, 1651.56, 0.00, 0.02, -0.06, 378.54}, +{-2590.84, 1667.61, 0.00, 0.02, -0.06, 356.28}, +{-2345.84, 1633.19, 0.00, 0.02, -0.06, 350.28}, +{-2106.14, 1639.23, 0.00, 0.02, -0.06, 378.36}, +{-1943.63, 1743.98, 0.00, 0.02, -0.06, 411.42}, +{-1891.39, 1907.57, 0.00, 0.02, -0.06, 457.14} +}; + + +new gShipCurrentPoint = 1; // current route point the ship is at. We start at route 1 + +// SA-MP objects +new gMainShipObjectId; +new gShipsAttachments[NUM_SHIP_ROUTE_POINTS]; + +forward StartMovingTimer(); + +//------------------------------------------------- + +public StartMovingTimer() +{ + MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0], + gShipRoutePoints[gShipCurrentPoint][1], + gShipRoutePoints[gShipCurrentPoint][2], + SHIP_MOVE_SPEED / 2.0, // slower for the first route + gShipRoutePoints[gShipCurrentPoint][3], + gShipRoutePoints[gShipCurrentPoint][4], + gShipRoutePoints[gShipCurrentPoint][5]); +} + +//------------------------------------------------- + +public OnFilterScriptInit() +{ + gMainShipObjectId = CreateObject(SHIP_HULL_ID, gShipRoutePoints[0][0], gShipRoutePoints[0][1], gShipRoutePoints[0][2], + gShipRoutePoints[0][3], gShipRoutePoints[0][4], gShipRoutePoints[0][5], SHIP_DRAW_DISTANCE); + + new x=0; + while(x != NUM_SHIP_ATTACHMENTS) { + gShipsAttachments[x] = CreateObject(gShipAttachmentModelIds[x], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE); + AttachObjectToObject(gShipsAttachments[x], gMainShipObjectId, + gShipAttachmentPos[x][0] - gShipHullOrigin[0], + gShipAttachmentPos[x][1] - gShipHullOrigin[1], + gShipAttachmentPos[x][2] - gShipHullOrigin[2], + 0.0, 0.0, 0.0); + x++; + } + + SetTimer("StartMovingTimer",30*1000,0); // pause at route 0 for 30 seconds + + return 1; +} + +//------------------------------------------------- + +public OnFilterScriptExit() +{ + DestroyObject(gMainShipObjectId); + new x=0; + while(x != NUM_SHIP_ATTACHMENTS) { + DestroyObject(gShipsAttachments[x]); + x++; + } + return 1; +} + +//------------------------------------------------- + +public OnObjectMoved(objectid) +{ + if(objectid != gMainShipObjectId) return 0; + + if(gShipCurrentPoint > 0 && !(gShipCurrentPoint % 5)) { + // play some seagulls audio every 5 points + PlaySoundForPlayersInRange(6200, 200.0, gShipRoutePoints[gShipCurrentPoint][0], + gShipRoutePoints[gShipCurrentPoint][1], + gShipRoutePoints[gShipCurrentPoint][2]); + } + + gShipCurrentPoint++; + + if(gShipCurrentPoint == NUM_SHIP_ROUTE_POINTS) { + gShipCurrentPoint = 0; + + MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0], + gShipRoutePoints[gShipCurrentPoint][1], + gShipRoutePoints[gShipCurrentPoint][2], + SHIP_MOVE_SPEED / 2.0, // slower for the last route + gShipRoutePoints[gShipCurrentPoint][3], + gShipRoutePoints[gShipCurrentPoint][4], + gShipRoutePoints[gShipCurrentPoint][5]); + return 1; + } + + if(gShipCurrentPoint == 1) { + // Before heading to the first route we should wait a bit + SetTimer("StartMovingTimer",30*1000,0); // pause at route 0 for 30 seconds + return 1; + } + + /* + new tempdebug[256+1]; + format(tempdebug,256,"The ship is at route: %d", gShipCurrentPoint); + SendClientMessageToAll(0xFFFFFFFF,tempdebug);*/ + + MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0], + gShipRoutePoints[gShipCurrentPoint][1], + gShipRoutePoints[gShipCurrentPoint][2], + SHIP_MOVE_SPEED, + gShipRoutePoints[gShipCurrentPoint][3], + gShipRoutePoints[gShipCurrentPoint][4], + gShipRoutePoints[gShipCurrentPoint][5]); + + return 1; +} + +//------------------------------------------------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256]; + new idx; + cmd = strtok(cmdtext, idx); + + if(strcmp(cmd, "/boardship", true) == 0) { + if(gShipCurrentPoint != 1) { + SendClientMessage(playerid, 0xFFFF0000, "The ship can't be boarded right now"); + return 1; + } + SetPlayerPos(playerid,-1937.7816,2017.7969,16.6640); + return 1; + } + + if(strcmp(cmd, "/stopship", true) == 0) { + StopObject(gMainShipObjectId); + return 1; + } + + return 0; +} + +//------------------------------------------------- + + diff --git a/filterscripts/dillimore_gas.amx b/filterscripts/dillimore_gas.amx new file mode 100644 index 0000000..4fcc134 Binary files /dev/null and b/filterscripts/dillimore_gas.amx differ diff --git a/filterscripts/dillimore_gas.pwn b/filterscripts/dillimore_gas.pwn new file mode 100644 index 0000000..434a4f0 --- /dev/null +++ b/filterscripts/dillimore_gas.pwn @@ -0,0 +1,161 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the Dillimore Gas Station Objects +// ---------------------------------------------------------- +// By Matite in March 2015 +// +// +// This script creates the edited Dillimore Gas Station Building objects and +// removes the existing GTASA building objects. +// +// Warning... +// This script uses a total of: +// * 2 objects = 1 for the replacement building exterior object and 1 for the +// the replacement building interior object +// * Enables the /dgs command to teleport the player to the Dillimore Gas Station +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Used for messages sent to the player +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + + +// ----------------------------------------------------------------------------- +// Variables +// --------- + +// Stores the created object numbers of the replacement building objects so +// they can be destroyed when the filterscript is unloaded +new DillimoreGasObject1; // Building exterior object +new DillimoreGasObject2; // Building interior object + + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/dgs", cmdtext, true, 4) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 0); + + // Set player position and facing angle + SetPlayerPos(playerid, 658.37, -573.90, 16.8); + SetPlayerFacingAngle(playerid, 280); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Dillimore Gas Station!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- Dillimore Gas Station Filterscript"); + print(" |-- Script v1.01"); + print(" |-- 3rd March 2015"); + print(" |---------------------------------------------------"); + + // Create the Dillimore Gas Station exterior object + DillimoreGasObject1 = CreateObject(19876, 666.711, -565.133, 17.3359, 0, 0, 0); + + // Display information in the Server Console + print(" |-- Dillimore Gas Station exterior object created"); + + // Create the Dillimore Gas Station interior object + DillimoreGasObject2 = CreateObject(19877, 666.492, -571.18, 17.3125, 0, 0, 0); + + // Display information in the Server Console + print(" |-- Dillimore Gas Station interior object created"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove default GTASA Dillimore Gas Station Building exterior, interior + // and LOD map objects for the player + // (so any player currently ingame does not have to rejoin for them + // to be removed when this filterscript is loaded) + RemoveBuildingForPlayer(i, 12853, 666.711, -565.133, 17.3359, 250.0); // Building exterior + RemoveBuildingForPlayer(i, 12854, 666.492, -571.18, 17.3125, 250.0); // Building interior + RemoveBuildingForPlayer(i, 13245, 666.711, -565.133, 17.3359, 250.0); // LOD + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Check for valid object + if (IsValidObject(DillimoreGasObject1)) + { + // Destroy the Dillimore Gas Station exterior object + DestroyObject(DillimoreGasObject1); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Dillimore Gas Station exterior object destroyed"); + } + + // Check for valid object + if (IsValidObject(DillimoreGasObject2)) + { + // Destroy the Dillimore Gas Station interior object + DestroyObject(DillimoreGasObject2); + + // Display information in the Server Console + print(" |-- Dillimore Gas Station interior object destroyed"); + } + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Dillimore Gas Station Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove default GTASA Dillimore Gas Station Building exterior, interior + // and LOD map objects for the player + RemoveBuildingForPlayer(playerid, 12853, 666.711, -565.133, 17.3359, 250.0); // Building exterior + RemoveBuildingForPlayer(playerid, 12854, 666.492, -571.18, 17.3125, 250.0); // Building interior + RemoveBuildingForPlayer(playerid, 13245, 666.711, -565.133, 17.3359, 250.0); // LOD + + // Exit here (return 1 so this callback is handled in other scripts too) + return 1; +} + diff --git a/filterscripts/ferriswheel.amx b/filterscripts/ferriswheel.amx new file mode 100644 index 0000000..479720a Binary files /dev/null and b/filterscripts/ferriswheel.amx differ diff --git a/filterscripts/ferriswheel.pwn b/filterscripts/ferriswheel.pwn new file mode 100644 index 0000000..d0e95d9 --- /dev/null +++ b/filterscripts/ferriswheel.pwn @@ -0,0 +1,135 @@ +// +// Used for testing interpolated rotations with MoveObject +// Also used to test AttachObjectToObject +// The other ferris wheel (that actually spins!) +// Located on the opposite peer at LS +// +// SA-MP 0.3d and above +// +// - Kye 2011 +// + +#include +#include "../include/gl_common.inc" // for PlaySoundForPlayersInRange() + +#define NUM_FERRIS_CAGES 10 +#define FERRIS_WHEEL_ID 18877 +#define FERRIS_CAGE_ID 18879 +#define FERRIS_BASE_ID 18878 +#define FERRIS_DRAW_DISTANCE 300.0 +#define FERRIS_WHEEL_SPEED 0.01 + +#define FERRIS_WHEEL_Z_ANGLE -90.0 // This is the heading the entire ferris wheel is at (beware of gimbal lock) + +new Float:gFerrisOrigin[3] = {832.8393, -2046.1990, 27.0900}; + +// Cage offsets for attaching to the main wheel +new Float:gFerrisCageOffsets[NUM_FERRIS_CAGES][3] = { +{0.0699, 0.0600, -11.7500}, +{-6.9100, -0.0899, -9.5000}, +{11.1600, 0.0000, -3.6300}, +{-11.1600, -0.0399, 3.6499}, +{-6.9100, -0.0899, 9.4799}, +{0.0699, 0.0600, 11.7500}, +{6.9599, 0.0100, -9.5000}, +{-11.1600, -0.0399, -3.6300}, +{11.1600, 0.0000, 3.6499}, +{7.0399, -0.0200, 9.3600} +}; + +// SA-MP objects +new gFerrisWheel; +new gFerrisBase; +new gFerrisCages[NUM_FERRIS_CAGES]; + +forward RotateWheel(); + +//------------------------------------------------- + +new Float:gCurrentTargetYAngle = 0.0; // Angle of the Y axis of the wheel to rotate to. +new gWheelTransAlternate = 0; // Since MoveObject requires some translation target to intepolate + // rotation, the world pos target is alternated by a small amount. + +UpdateWheelTarget() +{ + gCurrentTargetYAngle += 36.0; // There are 10 carts, so 360 / 10 + if(gCurrentTargetYAngle >= 360.0) { + gCurrentTargetYAngle = 0.0; + } + if(gWheelTransAlternate) gWheelTransAlternate = 0; + else gWheelTransAlternate = 1; +} + +//------------------------------------------------- + +public RotateWheel() +{ + UpdateWheelTarget(); + + new Float:fModifyWheelZPos = 0.0; + if(gWheelTransAlternate) fModifyWheelZPos = 0.05; + + MoveObject( gFerrisWheel, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2]+fModifyWheelZPos, + FERRIS_WHEEL_SPEED, 0.0, gCurrentTargetYAngle, FERRIS_WHEEL_Z_ANGLE ); +} + +//------------------------------------------------- + +public OnFilterScriptInit() +{ + gFerrisWheel = CreateObject( FERRIS_WHEEL_ID, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2], + 0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, FERRIS_DRAW_DISTANCE ); + + gFerrisBase = CreateObject( FERRIS_BASE_ID, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2], + 0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, FERRIS_DRAW_DISTANCE ); + + new x=0; + while(x != NUM_FERRIS_CAGES) { + gFerrisCages[x] = CreateObject( FERRIS_CAGE_ID, gFerrisOrigin[0], gFerrisOrigin[1], gFerrisOrigin[2], + 0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, FERRIS_DRAW_DISTANCE ); + + AttachObjectToObject( gFerrisCages[x], gFerrisWheel, + gFerrisCageOffsets[x][0], + gFerrisCageOffsets[x][1], + gFerrisCageOffsets[x][2], + 0.0, 0.0, FERRIS_WHEEL_Z_ANGLE, 0 ); + + x++; + } + + SetTimer("RotateWheel",3*1000,0); + + return 1; +} + +//------------------------------------------------- + +public OnFilterScriptExit() +{ + new x=0; + + DestroyObject(gFerrisWheel); + DestroyObject(gFerrisBase); + + x=0; + while(x != NUM_FERRIS_CAGES) { + DestroyObject(gFerrisCages[x]); + x++; + } + + return 1; +} + +//------------------------------------------------- + +public OnObjectMoved(objectid) +{ + if(objectid != gFerrisWheel) return 0; + + SetTimer("RotateWheel",3*1000,0); + return 1; +} + +//------------------------------------------------- + + diff --git a/filterscripts/flymode.amx b/filterscripts/flymode.amx new file mode 100644 index 0000000..e8579c8 Binary files /dev/null and b/filterscripts/flymode.amx differ diff --git a/filterscripts/flymode.pwn b/filterscripts/flymode.pwn new file mode 100644 index 0000000..96c5658 --- /dev/null +++ b/filterscripts/flymode.pwn @@ -0,0 +1,265 @@ +//------------------------------------------------- +// +// This is an example of using the AttachCameraToObject function +// to create a no-clip flying camera. +// +// h02 2012 +// +// SA-MP 0.3e and above +// +//------------------------------------------------- + +#include + +// Players Move Speed +#define MOVE_SPEED 100.0 +#define ACCEL_RATE 0.03 + +// Players Mode +#define CAMERA_MODE_NONE 0 +#define CAMERA_MODE_FLY 1 + +// Key state definitions +#define MOVE_FORWARD 1 +#define MOVE_BACK 2 +#define MOVE_LEFT 3 +#define MOVE_RIGHT 4 +#define MOVE_FORWARD_LEFT 5 +#define MOVE_FORWARD_RIGHT 6 +#define MOVE_BACK_LEFT 7 +#define MOVE_BACK_RIGHT 8 + +// Enumeration for storing data about the player +enum noclipenum +{ + cameramode, + flyobject, + mode, + lrold, + udold, + lastmove, + Float:accelmul +} +new noclipdata[MAX_PLAYERS][noclipenum]; + +//-------------------------------------------------- + +public OnFilterScriptExit() +{ + // If any players are still in edit mode, boot them out before the filterscript unloads + for(new x; x 100)) + { + // If the last move was > 100ms ago, process moving the object the players camera is attached to + MoveCamera(playerid); + } + + // Is the players current key state different than their last keystate? + if(noclipdata[playerid][udold] != ud || noclipdata[playerid][lrold] != lr) + { + if((noclipdata[playerid][udold] != 0 || noclipdata[playerid][lrold] != 0) && ud == 0 && lr == 0) + { // All keys have been released, stop the object the camera is attached to and reset the acceleration multiplier + StopPlayerObject(playerid, noclipdata[playerid][flyobject]); + noclipdata[playerid][mode] = 0; + noclipdata[playerid][accelmul] = 0.0; + } + else + { // Indicates a new key has been pressed + + // Get the direction the player wants to move as indicated by the keys + noclipdata[playerid][mode] = GetMoveDirectionFromKeys(ud, lr); + + // Process moving the object the players camera is attached to + MoveCamera(playerid); + } + } + noclipdata[playerid][udold] = ud; noclipdata[playerid][lrold] = lr; // Store current keys pressed for comparison next update + return 0; + } + return 1; +} + +//-------------------------------------------------- + +stock GetMoveDirectionFromKeys(ud, lr) +{ + new direction = 0; + + if(lr < 0) + { + if(ud < 0) direction = MOVE_FORWARD_LEFT; // Up & Left key pressed + else if(ud > 0) direction = MOVE_BACK_LEFT; // Back & Left key pressed + else direction = MOVE_LEFT; // Left key pressed + } + else if(lr > 0) // Right pressed + { + if(ud < 0) direction = MOVE_FORWARD_RIGHT; // Up & Right key pressed + else if(ud > 0) direction = MOVE_BACK_RIGHT; // Back & Right key pressed + else direction = MOVE_RIGHT; // Right key pressed + } + else if(ud < 0) direction = MOVE_FORWARD; // Up key pressed + else if(ud > 0) direction = MOVE_BACK; // Down key pressed + + return direction; +} + +//-------------------------------------------------- + +stock MoveCamera(playerid) +{ + new Float:FV[3], Float:CP[3]; + GetPlayerCameraPos(playerid, CP[0], CP[1], CP[2]); // Cameras position in space + GetPlayerCameraFrontVector(playerid, FV[0], FV[1], FV[2]); // Where the camera is looking at + + // Increases the acceleration multiplier the longer the key is held + if(noclipdata[playerid][accelmul] <= 1) noclipdata[playerid][accelmul] += ACCEL_RATE; + + // Determine the speed to move the camera based on the acceleration multiplier + new Float:speed = MOVE_SPEED * noclipdata[playerid][accelmul]; + + // Calculate the cameras next position based on their current position and the direction their camera is facing + new Float:X, Float:Y, Float:Z; + GetNextCameraPosition(noclipdata[playerid][mode], CP, FV, X, Y, Z); + MovePlayerObject(playerid, noclipdata[playerid][flyobject], X, Y, Z, speed); + + // Store the last time the camera was moved as now + noclipdata[playerid][lastmove] = GetTickCount(); + return 1; +} + +//-------------------------------------------------- + +stock GetNextCameraPosition(move_mode, Float:CP[3], Float:FV[3], &Float:X, &Float:Y, &Float:Z) +{ + // Calculate the cameras next position based on their current position and the direction their camera is facing + #define OFFSET_X (FV[0]*6000.0) + #define OFFSET_Y (FV[1]*6000.0) + #define OFFSET_Z (FV[2]*6000.0) + switch(move_mode) + { + case MOVE_FORWARD: + { + X = CP[0]+OFFSET_X; + Y = CP[1]+OFFSET_Y; + Z = CP[2]+OFFSET_Z; + } + case MOVE_BACK: + { + X = CP[0]-OFFSET_X; + Y = CP[1]-OFFSET_Y; + Z = CP[2]-OFFSET_Z; + } + case MOVE_LEFT: + { + X = CP[0]-OFFSET_Y; + Y = CP[1]+OFFSET_X; + Z = CP[2]; + } + case MOVE_RIGHT: + { + X = CP[0]+OFFSET_Y; + Y = CP[1]-OFFSET_X; + Z = CP[2]; + } + case MOVE_BACK_LEFT: + { + X = CP[0]+(-OFFSET_X - OFFSET_Y); + Y = CP[1]+(-OFFSET_Y + OFFSET_X); + Z = CP[2]-OFFSET_Z; + } + case MOVE_BACK_RIGHT: + { + X = CP[0]+(-OFFSET_X + OFFSET_Y); + Y = CP[1]+(-OFFSET_Y - OFFSET_X); + Z = CP[2]-OFFSET_Z; + } + case MOVE_FORWARD_LEFT: + { + X = CP[0]+(OFFSET_X - OFFSET_Y); + Y = CP[1]+(OFFSET_Y + OFFSET_X); + Z = CP[2]+OFFSET_Z; + } + case MOVE_FORWARD_RIGHT: + { + X = CP[0]+(OFFSET_X + OFFSET_Y); + Y = CP[1]+(OFFSET_Y - OFFSET_X); + Z = CP[2]+OFFSET_Z; + } + } +} +//-------------------------------------------------- + +stock CancelFlyMode(playerid) +{ + DeletePVar(playerid, "FlyMode"); + CancelEdit(playerid); + TogglePlayerSpectating(playerid, false); + + DestroyPlayerObject(playerid, noclipdata[playerid][flyobject]); + noclipdata[playerid][cameramode] = CAMERA_MODE_NONE; + return 1; +} + +//-------------------------------------------------- + +stock FlyMode(playerid) +{ + // Create an invisible object for the players camera to be attached to + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + noclipdata[playerid][flyobject] = CreatePlayerObject(playerid, 19300, X, Y, Z, 0.0, 0.0, 0.0); + + // Place the player in spectating mode so objects will be streamed based on camera location + TogglePlayerSpectating(playerid, true); + // Attach the players camera to the created object + AttachCameraToPlayerObject(playerid, noclipdata[playerid][flyobject]); + + SetPVarInt(playerid, "FlyMode", 1); + noclipdata[playerid][cameramode] = CAMERA_MODE_FLY; + return 1; +} + +//-------------------------------------------------- diff --git a/filterscripts/fsdebug.amx b/filterscripts/fsdebug.amx new file mode 100644 index 0000000..349ae3d Binary files /dev/null and b/filterscripts/fsdebug.amx differ diff --git a/filterscripts/fsdebug.pwn b/filterscripts/fsdebug.pwn new file mode 100644 index 0000000..b74780c --- /dev/null +++ b/filterscripts/fsdebug.pwn @@ -0,0 +1,2108 @@ +/* SA:MP PAWN Debug - + * Debugging filterscript used + * for creation of gamemode. + * + * Simon Campbell + * 10/03/2007, 6:31pm + * + * 17/11/2011 + * Updated to 0.5d which supports SA:MP 0.3d +*/ + +//============================================================================== + +#include + +#undef KEY_UP +#undef KEY_DOWN +#undef KEY_LEFT +#undef KEY_RIGHT + +#define KEY_UP 65408 +#define KEY_DOWN 128 +#define KEY_LEFT 65408 +#define KEY_RIGHT 128 + +#define DEBUG_VERSION "0.5d" + +#define SKIN_SELECT true +#define VEHI_SELECT true +#define WORL_SELECT true +#define CAME_SELECT true +#define OBJE_SELECT true + +#define MISCEL_CMDS true +#define ADMINS_ONLY false + +#define SKIN_SEL_STAT 1 +#define VEHI_SEL_STAT 2 +#define WORL_SEL_STAT 3 +#define CAME_SEL_STAT 4 +#define OBJE_SEL_STAT 5 + +#define COLOR_RED 0xFF4040FF +#define COLOR_GREEN 0x40FF40FF +#define COLOR_BLUE 0x4040FFFF + +#define COLOR_CYAN 0x40FFFFFF +#define COLOR_PINK 0xFF40FFFF +#define COLOR_YELLOW 0xFFFF40FF + +#define COLOR_WHITE 0xFFFFFFFF +#define COLOR_BLACK 0x000000FF +#define COLOR_NONE 0x00000000 + +#define MIN_SKIN_ID 0 +#define MAX_SKIN_ID 299 + +#define MIN_VEHI_ID 400 +#define MAX_VEHI_ID 611 + +#define MIN_TIME_ID 0 +#define MAX_TIME_ID 23 + +#define MIN_WEAT_ID 0 +#define MAX_WEAT_ID 45 + +#define MIN_OBJE_ID 615 +#define MAX_OBJE_ID 13563 + +#define DEFAULT_GRA 0.008 + +#define VEHI_DIS 5.0 +#define OBJE_DIS 10.0 + +#define CMODE_A 0 +#define CMODE_B 1 + +#define O_MODE_SELECTOR 0 +#define O_MODE_MOVER 1 +#define O_MODE_ROTATOR 2 + +#define PI 3.14159265 + +#define CAMERA_TIME 40 + +#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 + +//============================================================================== + +new gPlayerStatus[MAX_PLAYERS]; // Player Status +new gPlayerTimers[MAX_PLAYERS]; // Player TimerID's for keypresses +new gWorldStatus[3] = {12, 4}; // Time, Weather + +new curPlayerSkin[MAX_PLAYERS] = {MIN_SKIN_ID, ...}; // Current Player Skin ID +new curPlayerVehM[MAX_PLAYERS] = {MIN_VEHI_ID, ...}; // Current Player Vehicle ID +new curPlayerVehI[MAX_PLAYERS] = {-1, ...}; + +enum E_OBJECT +{ + OBJ_MOD, + OBJ_MDL, + Float:OBJ_X, + Float:OBJ_Y, + Float:OBJ_Z, + Float:OBJ_RX, + Float:OBJ_RY, + Float:OBJ_RZ +} + +enum E_OBJ_RATE +{ + Float:OBJ_RATE_ROT, + Float:OBJ_RATE_MOVE +} + +new pObjectRate[ MAX_PLAYERS ][ E_OBJ_RATE ]; +new curPlayerObjM[ MAX_PLAYERS ][ E_OBJECT ]; +new curPlayerObjI[ MAX_PLAYERS ] = {-1, ...}; + +enum P_CAMERA_D { + CMODE, + Float:RATE, + Float:CPOS_X, + Float:CPOS_Y, + Float:CPOS_Z, + Float:CLOO_X, + Float:CLOO_Y, + Float:CLOO_Z +}; + +new curPlayerCamD[MAX_PLAYERS][P_CAMERA_D]; + +enum CURVEHICLE { + bool:spawn, + vmodel, + vInt +}; + +new curServerVehP[MAX_VEHICLES][CURVEHICLE]; + +new aSelNames[5][] = { // Menu selection names + {"SkinSelect"}, + {"VehicleSelect"}, + {"WeatherSelect"}, + {"CameraSelect"}, + {"ObjectSelect"} +}; + +new aWeaponNames[][32] = { + {"Unarmed (Fist)"}, // 0 + {"Brass Knuckles"}, // 1 + {"Golf Club"}, // 2 + {"Night Stick"}, // 3 + {"Knife"}, // 4 + {"Baseball Bat"}, // 5 + {"Shovel"}, // 6 + {"Pool Cue"}, // 7 + {"Katana"}, // 8 + {"Chainsaw"}, // 9 + {"Purple Dildo"}, // 10 + {"Big White Vibrator"}, // 11 + {"Medium White Vibrator"}, // 12 + {"Small White Vibrator"}, // 13 + {"Flowers"}, // 14 + {"Cane"}, // 15 + {"Grenade"}, // 16 + {"Teargas"}, // 17 + {"Molotov"}, // 18 + {" "}, // 19 + {" "}, // 20 + {" "}, // 21 + {"Colt 45"}, // 22 + {"Colt 45 (Silenced)"}, // 23 + {"Desert Eagle"}, // 24 + {"Normal Shotgun"}, // 25 + {"Sawnoff Shotgun"}, // 26 + {"Combat Shotgun"}, // 27 + {"Micro Uzi (Mac 10)"}, // 28 + {"MP5"}, // 29 + {"AK47"}, // 30 + {"M4"}, // 31 + {"Tec9"}, // 32 + {"Country Rifle"}, // 33 + {"Sniper Rifle"}, // 34 + {"Rocket Launcher"}, // 35 + {"Heat-Seeking Rocket Launcher"}, // 36 + {"Flamethrower"}, // 37 + {"Minigun"}, // 38 + {"Satchel Charge"}, // 39 + {"Detonator"}, // 40 + {"Spray Can"}, // 41 + {"Fire Extinguisher"}, // 42 + {"Camera"}, // 43 + {"Night Vision Goggles"}, // 44 + {"Infrared Vision Goggles"}, // 45 + {"Parachute"}, // 46 + {"Fake Pistol"} // 47 +}; + + +new aVehicleNames[212][] = { // Vehicle Names - Betamaster + {"Landstalker"}, + {"Bravura"}, + {"Buffalo"}, + {"Linerunner"}, + {"Perrenial"}, + {"Sentinel"}, + {"Dumper"}, + {"Firetruck"}, + {"Trashmaster"}, + {"Stretch"}, + {"Manana"}, + {"Infernus"}, + {"Voodoo"}, + {"Pony"}, + {"Mule"}, + {"Cheetah"}, + {"Ambulance"}, + {"Leviathan"}, + {"Moonbeam"}, + {"Esperanto"}, + {"Taxi"}, + {"Washington"}, + {"Bobcat"}, + {"Mr Whoopee"}, + {"BF Injection"}, + {"Hunter"}, + {"Premier"}, + {"Enforcer"}, + {"Securicar"}, + {"Banshee"}, + {"Predator"}, + {"Bus"}, + {"Rhino"}, + {"Barracks"}, + {"Hotknife"}, + {"Trailer 1"}, //artict1 + {"Previon"}, + {"Coach"}, + {"Cabbie"}, + {"Stallion"}, + {"Rumpo"}, + {"RC Bandit"}, + {"Romero"}, + {"Packer"}, + {"Monster"}, + {"Admiral"}, + {"Squalo"}, + {"Seasparrow"}, + {"Pizzaboy"}, + {"Tram"}, + {"Trailer 2"}, //artict2 + {"Turismo"}, + {"Speeder"}, + {"Reefer"}, + {"Tropic"}, + {"Flatbed"}, + {"Yankee"}, + {"Caddy"}, + {"Solair"}, + {"Berkley's RC Van"}, + {"Skimmer"}, + {"PCJ-600"}, + {"Faggio"}, + {"Freeway"}, + {"RC Baron"}, + {"RC Raider"}, + {"Glendale"}, + {"Oceanic"}, + {"Sanchez"}, + {"Sparrow"}, + {"Patriot"}, + {"Quad"}, + {"Coastguard"}, + {"Dinghy"}, + {"Hermes"}, + {"Sabre"}, + {"Rustler"}, + {"ZR-350"}, + {"Walton"}, + {"Regina"}, + {"Comet"}, + {"BMX"}, + {"Burrito"}, + {"Camper"}, + {"Marquis"}, + {"Baggage"}, + {"Dozer"}, + {"Maverick"}, + {"News Chopper"}, + {"Rancher"}, + {"FBI Rancher"}, + {"Virgo"}, + {"Greenwood"}, + {"Jetmax"}, + {"Hotring"}, + {"Sandking"}, + {"Blista Compact"}, + {"Police Maverick"}, + {"Boxville"}, + {"Benson"}, + {"Mesa"}, + {"RC Goblin"}, + {"Hotring Racer A"}, //hotrina + {"Hotring Racer B"}, //hotrinb + {"Bloodring Banger"}, + {"Rancher"}, + {"Super GT"}, + {"Elegant"}, + {"Journey"}, + {"Bike"}, + {"Mountain Bike"}, + {"Beagle"}, + {"Cropdust"}, + {"Stunt"}, + {"Tanker"}, //petro + {"Roadtrain"}, + {"Nebula"}, + {"Majestic"}, + {"Buccaneer"}, + {"Shamal"}, + {"Hydra"}, + {"FCR-900"}, + {"NRG-500"}, + {"HPV1000"}, + {"Cement Truck"}, + {"Tow Truck"}, + {"Fortune"}, + {"Cadrona"}, + {"FBI Truck"}, + {"Willard"}, + {"Forklift"}, + {"Tractor"}, + {"Combine"}, + {"Feltzer"}, + {"Remington"}, + {"Slamvan"}, + {"Blade"}, + {"Freight"}, + {"Streak"}, + {"Vortex"}, + {"Vincent"}, + {"Bullet"}, + {"Clover"}, + {"Sadler"}, + {"Firetruck LA"}, //firela + {"Hustler"}, + {"Intruder"}, + {"Primo"}, + {"Cargobob"}, + {"Tampa"}, + {"Sunrise"}, + {"Merit"}, + {"Utility"}, + {"Nevada"}, + {"Yosemite"}, + {"Windsor"}, + {"Monster A"}, //monstera + {"Monster B"}, //monsterb + {"Uranus"}, + {"Jester"}, + {"Sultan"}, + {"Stratum"}, + {"Elegy"}, + {"Raindance"}, + {"RC Tiger"}, + {"Flash"}, + {"Tahoma"}, + {"Savanna"}, + {"Bandito"}, + {"Freight Flat"}, //freiflat + {"Streak Carriage"}, //streakc + {"Kart"}, + {"Mower"}, + {"Duneride"}, + {"Sweeper"}, + {"Broadway"}, + {"Tornado"}, + {"AT-400"}, + {"DFT-30"}, + {"Huntley"}, + {"Stafford"}, + {"BF-400"}, + {"Newsvan"}, + {"Tug"}, + {"Trailer 3"}, //petrotr + {"Emperor"}, + {"Wayfarer"}, + {"Euros"}, + {"Hotdog"}, + {"Club"}, + {"Freight Carriage"}, //freibox + {"Trailer 3"}, //artict3 + {"Andromada"}, + {"Dodo"}, + {"RC Cam"}, + {"Launch"}, + {"Police Car (LSPD)"}, + {"Police Car (SFPD)"}, + {"Police Car (LVPD)"}, + {"Police Ranger"}, + {"Picador"}, + {"S.W.A.T. Van"}, + {"Alpha"}, + {"Phoenix"}, + {"Glendale"}, + {"Sadler"}, + {"Luggage Trailer A"}, //bagboxa + {"Luggage Trailer B"}, //bagboxb + {"Stair Trailer"}, //tugstair + {"Boxville"}, + {"Farm Plow"}, //farmtr1 + {"Utility Trailer"} //utiltr1 +}; + +//============================================================================== + +forward SkinSelect(playerid); +forward VehicleSelect(playerid); +forward WorldSelect(playerid); +forward CameraSelect(playerid); +forward ObjectSelect( playerid ); + +//============================================================================== + +dcmd_debug(playerid, params[]) { + if(strcmp(params, "help", true, 4) == 0) { + SendClientMessage(playerid, COLOR_BLUE, "[DEBUG]: Debug Mode 0.2 - HELP"); + SendClientMessage(playerid, COLOR_CYAN, "[DEBUG]: Debug Mode 0.2 is a filterscript which allows scripters"); + SendClientMessage(playerid, COLOR_CYAN, "[DEBUG]: or people who wish to explore SA:MP 0.2\'s features to have access"); + SendClientMessage(playerid, COLOR_CYAN, "[DEBUG]: to many commands and \"menu\'s\"."); + SendClientMessage(playerid, COLOR_YELLOW, "[DEBUG]: This filterscript was designed for SA:MP version 0.2"); + SendClientMessage(playerid, COLOR_PINK, "[DEBUG]: For the command list type \"/debug commands\""); + + return true; + } + if(strcmp(params, "commands", true, 8) == 0) { + SendClientMessage(playerid, COLOR_BLUE, "[DEBUG]: Debug Mode 0.2 - COMMANDS"); + SendClientMessage(playerid, COLOR_CYAN, "[WORLD]: /w, /weather, /t, /time, /wsel, /g, /gravity"); + SendClientMessage(playerid, COLOR_CYAN, "[VEHICLES]: /v, /vehicle, /vsel"); + SendClientMessage(playerid, COLOR_CYAN, "[PLAYER]: /s, /skin, /ssel, /weapon, /w2"); + SendClientMessage(playerid, COLOR_CYAN, "[PLAYER]: /goto, /warpto, /bring, /setloc"); + SendClientMessage(playerid, COLOR_CYAN, "[CAMERA]: /camera, /csel"); + + return true; + } + + if(strcmp(params, "dump", true, 4) == 0) { + SendClientMessage(playerid, COLOR_GREEN, "[SUCCESS]: All current server data dumped to a file."); + new File:F_DUMP = fopen("DEBUG-DUMP.txt", io_append); + if(F_DUMP) { + new h, m, s, Y, M, D, cString[256]; + + getdate(Y, M, D); + gettime(h, m, s); + + format(cString, 256, "// %d-%d-%d @ %d:%d:%d\r\n", D, M, Y, h, m, s); + fwrite(F_DUMP, cString); + + for(new i = 0; i < MAX_VEHICLES; i++) { + if(curServerVehP[i][spawn] == true) { + new Float:vx, Float:vy, Float:vz, Float:va; + GetVehiclePos(i, vx, vy, vz); + GetVehicleZAngle(i, va); + format(cString, 256, "CreateVehicle(%d, %f, %f, %f, %f, -1, -1, 5000); // Interior(%d), %s\r\n", curServerVehP[i][vmodel], vx, vy, vz, va, curServerVehP[i][vInt], aVehicleNames[curServerVehP[i][vmodel] - MIN_VEHI_ID]); + fwrite(F_DUMP, cString); + } + } + print("** Dumped current server information."); + fclose(F_DUMP); + } + else { + print("** Failed to create the file \"DEBUG-DUMP.txt\".\n"); + } + return true; + } + return false; +} + +#if CAME_SELECT == true + +dcmd_object(playerid, params[]) +{ + new cString[ 128 ], idx; + cString = strtok( params, idx ); + + if ( !strlen( cString ) || !strlen( params[ idx + 1 ] ) ) + { + SendClientMessage( playerid, COLOR_WHITE, "[USAGE]: /object [RRATE/MRATE/CAMERA] [RATE/ID]"); + + return 1; + } + + if ( strcmp( cString, "rrate", true ) == 0 ) + { + pObjectRate[ playerid ][ OBJ_RATE_ROT ] = floatstr( params[ idx + 1 ] ); + + format( cString, 128, "[SUCCESS]: Object rotation rate changed to %f.", pObjectRate[ playerid ][ OBJ_RATE_ROT ] ); + SendClientMessage( playerid, COLOR_GREEN, cString ); + + return 1; + } + + if ( strcmp( cString, "mrate", true ) == 0 ) + { + pObjectRate[ playerid ][ OBJ_RATE_MOVE ] = floatstr( params[ idx + 1 ] ); + + format( cString, 128, "[SUCCESS]: Object movement rate changed to %f.", pObjectRate[ playerid ][ OBJ_RATE_MOVE ] ); + SendClientMessage( playerid, COLOR_GREEN, cString ); + + return 1; + } + + if ( strcmp( cString, "mode", true ) == 0 ) + { + new fuck = strval( params[ idx + 1 ] ); + + if ( fuck >= O_MODE_SELECTOR || fuck <= O_MODE_ROTATOR ) + { + curPlayerObjM[ playerid ][ OBJ_MOD ] = fuck; + + switch ( fuck ) + { + case O_MODE_SELECTOR: SendClientMessage( playerid, COLOR_GREEN, "[SUCCESS]: Object mode changed to Object Selection." ); + case O_MODE_MOVER: SendClientMessage( playerid, COLOR_GREEN, "[SUCCESS]: Object mode changed to Object Mover." ); + case O_MODE_ROTATOR: SendClientMessage( playerid, COLOR_GREEN, "[SUCCESS]: Object mode changed to Object Rotator." ); + } + + return 1; + } + else + { + SendClientMessage( playerid, COLOR_RED, "[ERROR]: Invalid modeid." ); + + return 1; + } + } + + if ( strcmp( cString, "focus", true ) == 0 ) + { + new objectid = strval( params[ idx + 1 ] ); + + if ( !IsValidObject( objectid ) ) + { + SendClientMessage( playerid, COLOR_RED, "[ERROR]: Enter a valid objectid." ); + + return 1; + } + + else + { + curPlayerObjI[ playerid ] = objectid; + + GetObjectPos( objectid, curPlayerObjM[ playerid ][ OBJ_X ], curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ] ); + GetObjectRot( objectid, curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ] ); + + curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] + 5.0; + curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] - 20.0; + curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_Z ] + 30.0; + + curPlayerCamD[playerid][CLOO_X] = curPlayerObjM[ playerid ][ OBJ_X ]; + curPlayerCamD[playerid][CLOO_Y] = curPlayerObjM[ playerid ][ OBJ_Y ]; + curPlayerCamD[playerid][CLOO_Z] = curPlayerObjM[ playerid ][ OBJ_Z ]; + + if ( gPlayerStatus[ playerid ] == OBJE_SEL_STAT ) + { + SetPlayerCameraPos( playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z] ); + SetPlayerCameraLookAt( playerid, curPlayerObjM[ playerid ][ OBJ_X ], curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ] ); + } + + return 1; + } + } + + if ( strcmp( cString, "camera", true ) == 0 ) + { + new cameraid = strval( params[ idx + 1 ] ); + + if ( cameraid >= 0 && cameraid < 4 ) + { + switch ( cameraid ) + { + case 0: + { + curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] + 7.0; + curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] - 20.0; + curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_Z ] + 30.0; + } + + case 1: + { + curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] + 7.0; + curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] + 15.0; + curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_X ] + 15.0; + } + + case 2: + { + curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] - 20.0; + curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] + 20.0; + curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_X ] + 20.0; + } + + case 3: + { + curPlayerCamD[playerid][CPOS_X] = curPlayerObjM[ playerid ][ OBJ_X ] - 10.0; + curPlayerCamD[playerid][CPOS_Y] = curPlayerObjM[ playerid ][ OBJ_Y ] + 25.0; + curPlayerCamD[playerid][CPOS_Z] = curPlayerObjM[ playerid ][ OBJ_X ] + 15.0; + } + } + + SetPlayerCameraPos( playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z] ); + SetPlayerCameraLookAt( playerid, curPlayerObjM[ playerid ][ OBJ_X ], curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ] ); + + return 1; + } + else + { + SendClientMessage( playerid, COLOR_RED, "[ERROR]: Invalid object camera id."); + + return 1; + } + } + return 0; +} + +dcmd_osel(playerid, params[]) +{ + #pragma unused params + + new cString[ 128 ]; + + if ( gPlayerStatus[ playerid ] != 0 ) + { + format( cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[ gPlayerStatus[ playerid ] - 1 ] ); + SendClientMessage(playerid, COLOR_RED, cString); + + return 1; + } + + new Float:a; + + gPlayerStatus[playerid] = OBJE_SEL_STAT; + + GetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + curPlayerCamD[playerid][CPOS_Z] += 5.0; + SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + + GetXYInFrontOfPlayer(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], OBJE_DIS); + + curPlayerCamD[playerid][CLOO_Z] = curPlayerCamD[playerid][CPOS_Z] - 5.0; + + SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]); + + TogglePlayerControllable(playerid, 0); + + GetPlayerFacingAngle(playerid, a); + + curPlayerObjM[ playerid ][ OBJ_X ] = curPlayerCamD[playerid][CLOO_X]; + curPlayerObjM[ playerid ][ OBJ_Y ] = curPlayerCamD[playerid][CLOO_Y]; + curPlayerObjM[ playerid ][ OBJ_Z ] = curPlayerCamD[playerid][CLOO_Z]; + curPlayerObjM[ playerid ][ OBJ_RX ] = 0.0; + curPlayerObjM[ playerid ][ OBJ_RY ] = 0.0; + curPlayerObjM[ playerid ][ OBJ_RZ ] = 0.0; + + curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ], + curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ], + curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ] + ); + + gPlayerTimers[ playerid ] = SetTimerEx("ObjectSelect", 200, 1, "i", playerid); + + return 1; +} + +dcmd_camera(playerid, params[]) { + new idx; new cString[128]; + + cString = strtok(params, idx); + + if (!strlen(cString)) { + SendClientMessage(playerid, COLOR_RED, "[USAGE]: /camera [RATE/MODE] [RATE/MODEID]"); + + return true; + } + + if (strcmp(cString, "rate", true, 4) == 0) { + curPlayerCamD[playerid][RATE] = floatstr(params[idx+1]); + + return true; + } + + if (strcmp(cString, "mode", true, 4) == 0) { + curPlayerCamD[playerid][CMODE] = strval(params[idx+1]); + + return true; + } + + return true; +} + +dcmd_csel(playerid, params[]) { + #pragma unused params + + new cString[128]; + + if (gPlayerStatus[playerid] != 0) { + format(cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]); + SendClientMessage(playerid, COLOR_RED, cString); + + return true; + } + + gPlayerStatus[playerid] = CAME_SEL_STAT; + + TogglePlayerControllable(playerid, 0); + + GetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + GetXYInFrontOfPlayer(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], 5.0); + + curPlayerCamD[playerid][CLOO_Z] = curPlayerCamD[playerid][CPOS_Z]; + + gPlayerTimers[playerid] = SetTimerEx("CameraSelect", 200, 1, "i", playerid); + + return true; +} + +#endif + +#if WORL_SELECT == true +dcmd_g(playerid, params[]) { + new cString[128]; + + if (!strlen(params[0])) + { + SendClientMessage(playerid, COLOR_RED, "[USAGE]: /g GRAVITY or /gravity GRAVITY"); + return true; + } + + new Float:grav = floatstr(params[0]); + + SetGravity(grav); + + format(cString, 128, "[SUCCESS]: World gravity changed to %f", grav); + SendClientMessage(playerid, COLOR_GREEN, cString); + + return true; +} + +dcmd_gravity(playerid, params[]) + return dcmd_g(playerid, params); + +dcmd_w(playerid, params[]) { + new idx, iString[128]; + iString = strtok(params, idx); + + if (!strlen(iString)) { + SendClientMessage(playerid, COLOR_RED, "[USAGE]: /w WEATHERID or /weather WEATHERID"); + return true; + } + + idx = strval(iString); + + if (idx < MIN_WEAT_ID || idx > MAX_WEAT_ID) { + SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid WEATHERID"); + return true; + } + + gWorldStatus[1] = idx; + + SetWeather(idx); + + format(iString, 128, "[SUCCESS]: Weather has changed to WEATHERID %d", idx); + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; +} + +dcmd_weather(playerid, params[]) + return dcmd_w(playerid, params); + +dcmd_t(playerid, params[]) { + new idx, iString[128]; + iString = strtok(params, idx); + + if (!strlen(iString)) { + SendClientMessage(playerid, COLOR_RED, "[USAGE]: /t HOUR or /time HOUR"); + return true; + } + + idx = strval(iString); + + if (idx < MIN_TIME_ID || idx > MAX_TIME_ID) { + SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid HOUR"); + return true; + } + + gWorldStatus[0] = idx; + + SetWorldTime(idx); + + format(iString, 128, "[SUCCESS]: Time has changed to HOUR %d", idx); + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; +} + +dcmd_time(playerid, params[]) + return dcmd_t(playerid, params); + +dcmd_wsel(playerid, params[]) { + #pragma unused params + + new cString[128]; + + if (gPlayerStatus[playerid] != 0) { + format(cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]); + SendClientMessage(playerid, COLOR_RED, cString); + return true; + } + + new Float:x, Float:y, Float:z; + + gPlayerStatus[playerid] = WORL_SEL_STAT; + + GetPlayerPos(playerid, x, y, z); + SetPlayerCameraPos(playerid, x, y, z + 40.0); + + GetXYInFrontOfPlayer(playerid, x, y, 100.0); + + SetPlayerCameraLookAt(playerid, x, y, z + 5.0); + + TogglePlayerControllable(playerid, 0); + + gPlayerTimers[playerid] = SetTimerEx("WorldSelect", 200, 1, "i", playerid); + + GameTextForPlayer(playerid, "WorldSelect", 1500, 3); + + return true; +} +#endif + +#if VEHI_SELECT == true + +dcmd_v(playerid, params[]) +{ + new + idx, + iString[ 128 ]; + + if ( gPlayerStatus[ playerid ] != 0 ) + { + format ( iString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[ gPlayerStatus[ playerid ] - 1 ] ); + SendClientMessage ( playerid, COLOR_RED, iString ); + + return true; + } + + if ( params[ 0 ] == '\0' ) // Same effect as a !strlen check. + return SendClientMessage( playerid, COLOR_RED, "[USAGE]: /v MODELID/NAME or /vehicle MODELID/NAME" ); + + //*************** + // Fix by Mike! * + //*************** + + idx = GetVehicleModelIDFromName( params ); + + if( idx == -1 ) + { + idx = strval(iString); + + if ( idx < MIN_VEHI_ID || idx > MAX_VEHI_ID ) + return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid MODELID/NAME"); + } + + new + Float:x, + Float:y, + Float:z, + Float:a; + + GetPlayerPos(playerid, x, y, z); + GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS); + GetPlayerFacingAngle(playerid, a); + + curPlayerVehM[playerid] = idx; + + curPlayerVehI[playerid] = CreateVehicle(idx, x, y, z + 2.0, a + 90.0, -1, -1, 5000); + LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid)); + + curServerVehP[curPlayerVehI[playerid]][spawn] = true; + curServerVehP[curPlayerVehI[playerid]][vmodel] = idx; + curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid); + + format(iString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", aVehicleNames[idx - MIN_VEHI_ID], idx, curPlayerVehI[playerid]); + + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; +} + +dcmd_vehicle(playerid, params[]) + return dcmd_v(playerid, params); + +dcmd_vsel(playerid, params[]) +{ + // /vsel allows players to select a vehicle using playerkeys. + #pragma unused params + + new cString[128]; + + if (gPlayerStatus[playerid] != 0) { + format(cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]); + SendClientMessage(playerid, COLOR_RED, cString); + return true; + } + + new Float:x, Float:y, Float:z, Float:a; + + gPlayerStatus[playerid] = VEHI_SEL_STAT; + + GetPlayerPos(playerid, x, y, z); + SetPlayerCameraPos(playerid, x, y, z + 3.0); + + GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS); + SetPlayerCameraLookAt(playerid, x, y, z); + + TogglePlayerControllable(playerid, 0); + + GetPlayerFacingAngle(playerid, a); + + curPlayerVehI[playerid] = CreateVehicle(curPlayerVehM[playerid], x, y, z + 2.0, a + 90.0, -1, -1, 5000); + printf( "vsel vehicle start id = %d", curPlayerVehI[playerid] ); + + LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid)); + + curServerVehP[curPlayerVehI[playerid]][spawn] = true; + curServerVehP[curPlayerVehI[playerid]][vmodel] = curPlayerVehM[playerid]; + curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid); + + gPlayerTimers[playerid] = SetTimerEx("VehicleSelect", 200, 1, "i", playerid); + + return true; +} + +#endif + +#if SKIN_SELECT == true + +dcmd_ssel(playerid, params[]) +{ + // /ssel allows players to select a skin using playerkeys. + #pragma unused params + + new cString[128]; + + if (gPlayerStatus[playerid] != 0) { + format(cString, 128, "[ERROR]: You are already using \"%s\".", aSelNames[gPlayerStatus[playerid] - 1]); + SendClientMessage(playerid, COLOR_RED, cString); + return true; + } + + new Float:x, Float:y, Float:z; + + gPlayerStatus[playerid] = SKIN_SEL_STAT; + + GetPlayerPos(playerid, x, y, z); + SetPlayerCameraLookAt(playerid, x, y, z); + + GetXYInFrontOfPlayer(playerid, x, y, 3.5); + SetPlayerCameraPos(playerid, x, y, z); + + TogglePlayerControllable(playerid, 0); + + gPlayerTimers[playerid] = SetTimerEx("SkinSelect", 200, 1, "i", playerid); + + return true; +} + +dcmd_s(playerid, params[]) +{ + // /s SKINID allows players to directly select a skin using it's ID. + new idx, iString[128]; + iString = strtok(params, idx); + + if (!strlen(iString)) { + SendClientMessage(playerid, COLOR_RED, "[USAGE]: /s SKINID"); + return true; + } + + idx = strval(iString); + + if (IsInvalidSkin(idx) || idx < MIN_SKIN_ID || idx > MAX_SKIN_ID) { + SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid SKINID"); + return true; + } + + SetPlayerSkin(playerid, idx); + curPlayerSkin[playerid] = idx; + format(iString, 128, "[SUCCESS]: Changed skin to SKINID %d", idx); + + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; +} + +dcmd_skin(playerid, params[]) +{ + dcmd_s(playerid, params); + + return true; +} + +#endif + +#if MISCEL_CMDS == true +dcmd_goto(playerid, params[]) +{ + new idx, iString[128]; + iString = strtok(params, idx); + + if (!strlen(iString)) { + SendClientMessage(playerid, COLOR_RED, "[USAGE]: /goto PLAYERID (X_OFFSET Y_OFFSET Z_OFFSET)"); + return true; + } + + new ID = strval(iString); + + if (!IsPlayerConnected(ID)) { + SendClientMessage(playerid, COLOR_RED, "[ERROR]: Not connected PLAYERID."); + return true; + } + + new Float:X, Float:Y, Float:Z; + new Interior = GetPlayerInterior(ID); + + GetPlayerPos(ID, X, Y, Z); + + iString = strtok(params, idx); + + if (!strlen(iString)) { + GetXYInFrontOfPlayer(ID, X, Y, 1.5); + SetPlayerInterior(playerid, Interior); + SetPlayerPos(playerid, X, Y, Z); + + GetPlayerName(ID, iString, 128); + format(iString, 128, "[SUCCESS]: You have warped to %s (ID: %d).", iString, ID); + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; + } + + X += floatstr(iString); + iString = strtok(params, idx); + + if (!strlen(iString)) { + goto fwarpto; + } + + Y += floatstr(iString); + iString = strtok(params, idx); + + if (!strlen(iString)) { + goto fwarpto; + } + + Z += floatstr(iString); + + fwarpto: + + new pVID = GetPlayerVehicleID( playerid ); + + if ( pVID ) + { + SetVehiclePos( pVID, X, Y, Z ); + LinkVehicleToInterior( pVID, Interior ); + } + else + { + SetPlayerPos( playerid, X, Y, Z); + } + + SetPlayerInterior( playerid, Interior); + + GetPlayerName(ID, iString, 128); + format(iString, 128, "[SUCCESS]: You have warped to %s (ID: %d).", iString, ID); + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; +} + +dcmd_warpto(playerid, params[]) +{ + dcmd_goto(playerid, params); + + return true; +} + +dcmd_setloc(playerid, params[]) +{ + new idx, iString[128]; + iString = strtok(params, idx); + + if (!strlen(iString)) { + SendClientMessage(playerid, COLOR_RED, "[USAGE]: /setloc X Y Z INTERIOR"); + return true; + } + + new Float:X, Float:Y, Float:Z; + new Interior; + + X = floatstr(iString); + Y = floatstr(strtok(params,idx)); + Z = floatstr(strtok(params,idx)); + Interior = strval(strtok(params,idx)); + + new pVID = GetPlayerVehicleID( playerid ); + + if ( pVID ) + { + SetVehiclePos( pVID, X, Y, Z ); + LinkVehicleToInterior( pVID, Interior ); + } + else + { + SetPlayerPos( playerid, X, Y, Z ); + } + + SetPlayerInterior(playerid, Interior); + + return true; + + +} + +dcmd_bring(playerid, params[]) +{ + new idx, iString[128]; + iString = strtok(params, idx); + + if (!strlen(iString)) { + SendClientMessage(playerid, COLOR_RED, "[USAGE]: /bring PLAYERID (X_OFFSET Y_OFFSET Z_OFFSET)"); + return true; + } + + new ID = strval(iString); + + if (!IsPlayerConnected(ID)) { + SendClientMessage(playerid, COLOR_RED, "[ERROR]: Not connected PLAYERID."); + return true; + } + + new Float:X, Float:Y, Float:Z; + new Interior = GetPlayerInterior(playerid); + + GetPlayerPos(playerid, X, Y, Z); + + iString = strtok(params, idx); + + if (!strlen(iString)) { + GetXYInFrontOfPlayer(playerid, X, Y, 1.5); + SetPlayerInterior(ID, Interior); + SetPlayerPos(ID, X, Y, Z); + + GetPlayerName(ID, iString, 128); + format(iString, 128, "[SUCCESS]: You have brought %s (ID: %d) to you.", iString, ID); + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; + } + + X += floatstr(iString); + iString = strtok(params, idx); + + if (!strlen(iString)) { + goto fbring; + } + + Y += floatstr(iString); + iString = strtok(params, idx); + + if (!strlen(iString)) { + goto fbring; + } + + Z += floatstr(iString); + + fbring: + + new pVID = GetPlayerVehicleID( ID ); + + if ( pVID ) + { + SetVehiclePos( pVID, X, Y, Z ); + LinkVehicleToInterior( pVID, Interior ); + } + else + { + SetPlayerPos( ID, X, Y, Z ); + } + + SetPlayerInterior(ID, Interior); + + GetPlayerName(ID, iString, 128); + format(iString, 128, "[SUCCESS]: You have brought %s (ID: %d) to you.", iString, ID); + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; +} + +dcmd_weapon(playerid, params[]) +{ + dcmd_w2(playerid, params); + + return true; +} + +dcmd_w2(playerid, params[]) +{ + new idx, iString[128]; + iString = strtok(params, idx); + + if (!strlen(iString)) { + SendClientMessage(playerid, COLOR_RED, "[USAGE]: /w2 WEAPONID/NAME (AMMO) or /weapon WEAPONID/NAME (AMMO)"); + return true; + } + + new weaponid = GetWeaponModelIDFromName(iString); + + if (weaponid == -1) { + weaponid = strval(iString); + if (weaponid < 0 || weaponid > 47) { + SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid WEAPONID/NAME"); + return true; + } + } + + if (!strlen(params[idx+1])) { + GivePlayerWeapon(playerid, weaponid, 500); + + format(iString, 128, "[SUCCESS]: You were given weapon %s (ID: %d) with 500 ammo.", aWeaponNames[weaponid], weaponid); + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; + } + + idx = strval(params[idx+1]); + + GivePlayerWeapon(playerid, weaponid, idx); + + format(iString, 128, "[SUCCESS]: You were given weapon %s (ID: %d) with %d ammo.", aWeaponNames[weaponid], weaponid, idx); + SendClientMessage(playerid, COLOR_GREEN, iString); + + return true; +} +#endif + +public OnFilterScriptInit() +{ + print("\n *********************\n * SA:MP DEBUG 0.2 *"); + print(" * By Simon Campbell *\n *********************"); + printf(" * Version: %s *\n *********************", DEBUG_VERSION); + print(" * -- LOADED *\n *********************\n"); + + for ( new i = 0; i < MAX_PLAYERS; i++ ) + { + curPlayerObjM[ i ][ OBJ_MDL ] = MIN_OBJE_ID; + pObjectRate[ i ][ OBJ_RATE_ROT ] = 1.0; + pObjectRate[ i ][ OBJ_RATE_MOVE ] = 1.0; + } + +} + +public OnFilterScriptExit() +{ + print("\n *********************\n * SA:MP DEBUG 0.2 *"); + print(" * -- SHUTDOWN *\n *********************\n"); +} + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + #if ADMINS_ONLY == true + if(IsPlayerAdmin(playerid)) { + #endif + + #if SKIN_SELECT == true + dcmd(s, 1, cmdtext); + dcmd(ssel, 4, cmdtext); + dcmd(skin, 4, cmdtext); + #endif + + #if VEHI_SELECT == true + dcmd(v, 1, cmdtext); + dcmd(vsel, 4, cmdtext); + dcmd(vehicle, 7, cmdtext); + #endif + + #if WORL_SELECT == true + dcmd(w, 1, cmdtext); + dcmd(t, 1, cmdtext); + dcmd(g, 1, cmdtext); + dcmd(wsel, 4, cmdtext); + dcmd(time, 4, cmdtext); + dcmd(weather, 7, cmdtext); + dcmd(gravity, 7, cmdtext); + #endif + + #if MISCEL_CMDS == true + dcmd(w2, 2, cmdtext); + dcmd(goto, 4, cmdtext); + dcmd(bring, 5, cmdtext); + dcmd(warpto, 6, cmdtext); + dcmd(weapon, 6, cmdtext); + dcmd(setloc, 6, cmdtext); + #endif + + #if CAME_SELECT == true + dcmd(csel, 4, cmdtext); + dcmd(camera, 6, cmdtext); + #endif + + dcmd(osel, 4, cmdtext); + dcmd(object, 6, cmdtext); + dcmd(debug, 5, cmdtext); + + #if ADMINS_ONLY == true + } + #endif + + return 0; +} + +public OnPlayerDisconnect(playerid,reason) +{ + KillTimer(gPlayerTimers[playerid]); + + gPlayerStatus[playerid] = 0; + gPlayerTimers[playerid] = 0; + + curPlayerSkin[playerid] = MIN_SKIN_ID; // Current Player Skin ID + curPlayerVehM[playerid] = MIN_VEHI_ID; // Current Player Vehicle ID + curPlayerVehI[playerid] = -1; + + return 0; +} + +public OnPlayerConnect(playerid) +{ + curPlayerCamD[playerid][CMODE] = CMODE_A; + curPlayerCamD[playerid][RATE] = 2.0; + + return 0; +} + +public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ) { + #if ADMINS_ONLY == true + if (IsPlayerAdmin(playerid)) { + #endif + SetPlayerPosFindZ(playerid, fX, fY, fZ); + #if ADMINS_ONLY == true + } + #endif +} + + +//============================================================================== + +#if WORL_SELECT == true +public WorldSelect(playerid) +{ // Created by Simon + /* + // Make sure the player is not in world selection before continuing + if (gPlayerStatus[playerid] != WORL_SEL_STAT) { + KillTimer(skinTimerID[playerid]); + return; + } + */ + + new keys, updown, leftright; + + GetPlayerKeys(playerid, keys, updown, leftright); + + new cString[128]; + + // Right key increases World Time + if (leftright == KEY_RIGHT) { + if(gWorldStatus[0] == MAX_TIME_ID) { + gWorldStatus[0] = MIN_TIME_ID; + } + else { + gWorldStatus[0]++; + } + format(cString, 128, "World Time: %d~n~Weather ID: %d", gWorldStatus[0], gWorldStatus[1]); + GameTextForPlayer(playerid, cString, 1500, 3); + SetWorldTime(gWorldStatus[0]); + } + + // Left key decreases World Time + if (leftright == KEY_LEFT) { + if(gWorldStatus[0] == MIN_TIME_ID) { + gWorldStatus[0] = MAX_TIME_ID; + } + else { + gWorldStatus[0]--; + } + format(cString, 128, "World Time: %d~n~Weather ID: %d", gWorldStatus[0], gWorldStatus[1]); + GameTextForPlayer(playerid, cString, 1500, 3); + SetWorldTime(gWorldStatus[0]); + } + + // Up key increases Weather ID + if(updown == KEY_UP) { + if(gWorldStatus[1] == MAX_WEAT_ID) { + gWorldStatus[1] = MIN_WEAT_ID; + } + else { + gWorldStatus[1]++; + } + format(cString, 128, "World Time: %d~n~Weather ID: %d", gWorldStatus[0], gWorldStatus[1]); + GameTextForPlayer(playerid, cString, 1500, 3); + SetWeather(gWorldStatus[1]); + } + + // Down key decreases Weather ID + if(updown == KEY_DOWN) { + if(gWorldStatus[1] == MIN_WEAT_ID) { + gWorldStatus[1] = MAX_WEAT_ID; + } + else { + gWorldStatus[1]--; + } + format(cString, 128, "World Time: %d~n~Weather ID: %d", gWorldStatus[0], gWorldStatus[1]); + GameTextForPlayer(playerid, cString, 1500, 3); + SetWeather(gWorldStatus[1]); + } + + // Action key exits WorldSelection + if(keys & KEY_ACTION) { + SetCameraBehindPlayer(playerid); + TogglePlayerControllable(playerid, 1); + + format(cString, 128, "[SUCCESS]: Time changed to %d hours and weather changed to WEATHERID %d", gWorldStatus[0], gWorldStatus[1]); + SendClientMessage(playerid, COLOR_GREEN, cString); + + new File:F_WORLD = fopen("TIME-WEATHER.txt", io_append); + + if(F_WORLD) { + new h, m, s, Y, M, D; + + getdate(Y, M, D); + gettime(h, m, s); + + format(cString, 128, "// %d-%d-%d @ %d:%d:%d\r\nSetWeather(%d);\r\nSetWorldTime(%d);\r\n", D, M, Y, h, m, s); + + fwrite(F_WORLD, cString); + fclose(F_WORLD); + printf("\n%s\n",cString); + } + else { + print("Failed to create the file \"TIME-WEATHER.txt\".\n"); + } + + gPlayerStatus[playerid] = 0; + KillTimer(gPlayerTimers[playerid]); + + return; + } +} + +#endif + +#if SKIN_SELECT == true +public SkinSelect(playerid) +{ // Created by Simon + /* + // Make sure the player is not in skin selection before continuing + if (gPlayerStatus[playerid] != SKIN_SEL_STAT) { + KillTimer(skinTimerID[playerid]); + return; + } + */ + + new keys, updown, leftright; + + GetPlayerKeys(playerid, keys, updown, leftright); + + new cString[128]; + + // Right key increases Skin ID + if (leftright == KEY_RIGHT) { + if(curPlayerSkin[playerid] == MAX_SKIN_ID) { + curPlayerSkin[playerid] = MIN_SKIN_ID; + } + else { + curPlayerSkin[playerid]++; + } + while(IsInvalidSkin(curPlayerSkin[playerid])) { + curPlayerSkin[playerid]++; + } + + format(cString, 128, "Skin ID: %d", curPlayerSkin[playerid]); + GameTextForPlayer(playerid, cString, 1500, 3); + SetPlayerSkin(playerid, curPlayerSkin[playerid]); + } + + // Left key decreases Skin ID + if(leftright == KEY_LEFT) { + if(curPlayerSkin[playerid] == MIN_SKIN_ID) { + curPlayerSkin[playerid] = MAX_SKIN_ID; + } + else { + curPlayerSkin[playerid]--; + } + while(IsInvalidSkin(curPlayerSkin[playerid])) { + curPlayerSkin[playerid]--; + } + + format(cString, 128, "Skin ID: %d", curPlayerSkin[playerid]); + GameTextForPlayer(playerid, cString, 1500, 3); + SetPlayerSkin(playerid, curPlayerSkin[playerid]); + } + + // Action key exits skin selection + if(keys & KEY_ACTION) + { + SetCameraBehindPlayer(playerid); + TogglePlayerControllable(playerid, 1); + + format(cString, 128, "[SUCCESS]: You have changed to SKINID %d", curPlayerSkin[playerid]); + SendClientMessage(playerid, COLOR_GREEN, cString); + + gPlayerStatus[playerid] = 0; + KillTimer(gPlayerTimers[playerid]); + } +} +#endif + +#if CAME_SELECT == true +public CameraSelect(playerid) +{ + // CMODE_A 0 Up/Down = IncreaseZ/DecreaseZ; Left/Right = IncreaseX/DecreaseX; Num4/Num6 = IncreaseY/DecreaseY + // CMODE_B 1 Up/Down = Rotate Up/Down; Left/Right = Rotate Left/Right; Num4/Num6 = Move Left/Right + + new keys, updown, leftright; + + GetPlayerKeys(playerid, keys, updown, leftright); + + printf("Player (%d) keys = %d, updown = %d, leftright = %d", playerid, keys, updown, leftright); + + if (curPlayerCamD[playerid][CMODE] == CMODE_A) + { + if (leftright == KEY_RIGHT) { + curPlayerCamD[playerid][CPOS_X] += curPlayerCamD[playerid][RATE]; + curPlayerCamD[playerid][CLOO_X] += curPlayerCamD[playerid][RATE]; + + SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + + SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]); + } + + if (leftright == KEY_LEFT) { + curPlayerCamD[playerid][CPOS_X] -= curPlayerCamD[playerid][RATE]; + curPlayerCamD[playerid][CLOO_X] -= curPlayerCamD[playerid][RATE]; + + SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + + SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]); + } + + if (updown == KEY_UP) { + curPlayerCamD[playerid][CPOS_Z] += curPlayerCamD[playerid][RATE]; + curPlayerCamD[playerid][CLOO_Z] += curPlayerCamD[playerid][RATE]; + + SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + + SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]); + } + + if (updown == KEY_DOWN) { + curPlayerCamD[playerid][CPOS_Z] -= curPlayerCamD[playerid][RATE]; + curPlayerCamD[playerid][CLOO_Z] -= curPlayerCamD[playerid][RATE]; + + SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + + SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]); + } + + if (keys & KEY_ANALOG_RIGHT) { + curPlayerCamD[playerid][CPOS_Y] += curPlayerCamD[playerid][RATE]; + curPlayerCamD[playerid][CLOO_Y] += curPlayerCamD[playerid][RATE]; + + SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + + SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]); + } + + + if (keys & KEY_ANALOG_LEFT) { + curPlayerCamD[playerid][CPOS_Y] -= curPlayerCamD[playerid][RATE]; + curPlayerCamD[playerid][CLOO_Y] -= curPlayerCamD[playerid][RATE]; + + SetPlayerPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + + SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]); + } + } + + + if(curPlayerCamD[playerid][CMODE] == CMODE_B) + { + if (leftright == KEY_RIGHT) { + // Rotate Y + + } + + if (leftright == KEY_LEFT) { + // Rotate Y - + } + + if (updown == KEY_UP) { + // Rotate X + + } + + if (updown == KEY_DOWN) { + // Rotate X - + } + + if (keys & KEY_ANALOG_RIGHT) { + // Rotate Z + + } + + if (keys & KEY_ANALOG_LEFT) { + // Rotate Z - + } + } + + if (keys & KEY_ACTION) + { + SetCameraBehindPlayer(playerid); + + new + File:F_CAMERA = fopen("CAMERA.txt", io_append); + + if( F_CAMERA ) + { + new + cString[512], h, m, s, Y, M, D; + + getdate(Y, M, D); + gettime(h, m, s); + + format(cString, sizeof( cString ), "// %d-%d-%d @ %d:%d:%d\r\nSetPlayerCameraPos(playerid, %f, %f, %f);\r\nSetPlayerCameraLookAt(playerid, %f, %f, %f);\r\n", D, M, Y, h, m, s,curPlayerCamD[playerid][CPOS_X],curPlayerCamD[playerid][CPOS_Y],curPlayerCamD[playerid][CPOS_Z],curPlayerCamD[playerid][CLOO_X],curPlayerCamD[playerid][CLOO_Y],curPlayerCamD[playerid][CLOO_Z]); + + fwrite(F_CAMERA, cString); + fclose(F_CAMERA); + + printf("\n%s\n",cString); + + SendClientMessage( playerid, COLOR_GREEN, "Current camera data saved to 'CAMERA.txt'" ); + } + else + print("Failed to create the file \"CAMERA.txt\".\n"); + + TogglePlayerControllable(playerid, 1); + + KillTimer(gPlayerTimers[playerid]); + + gPlayerStatus[playerid] = 0; + } +} + +#endif + +#if VEHI_SELECT == true +public VehicleSelect(playerid) +{ + /* + // Make sure the player is not in skin selection before continuing + if (gPlayerStatus[playerid] != VEHI_SEL_STAT) { + KillTimer(skinTimerID[playerid]); + return; + } + */ + + new keys, updown, leftright; + + GetPlayerKeys(playerid, keys, updown, leftright); + + new cString[128]; + + // Right key increases Vehicle MODELID + if (leftright == KEY_RIGHT) { + if(curPlayerVehM[playerid] == MAX_VEHI_ID) { + curPlayerVehM[playerid] = MIN_VEHI_ID; + } + else { + curPlayerVehM[playerid]++; + } + + format(cString, 128, "Model ID: %d~n~Vehicle Name: %s", curPlayerVehM, aVehicleNames[curPlayerVehM[playerid] - MIN_VEHI_ID]); + GameTextForPlayer(playerid, cString, 1500, 3); + + new Float:x, Float:y, Float:z, Float:a; + + GetPlayerPos(playerid, x, y, z); + GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS); + GetPlayerFacingAngle(playerid, a); + + DestroyVehicle(curPlayerVehI[playerid]); + curServerVehP[curPlayerVehI[playerid]][spawn] = false; + + curPlayerVehI[playerid] = CreateVehicle(curPlayerVehM[playerid], x, y, z + 2.0, a + 90.0, -1, -1, 5000); + printf( "vsel vehicle select id = %d", curPlayerVehI[playerid] ); + + LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid)); + + curServerVehP[curPlayerVehI[playerid]][spawn] = true; + curServerVehP[curPlayerVehI[playerid]][vmodel] = curPlayerVehM[playerid]; + curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid); + } + + // Left key decreases Vehicle MODELID + if(leftright == KEY_LEFT) { + if(curPlayerVehM[playerid] == MIN_VEHI_ID) { + curPlayerVehM[playerid] = MAX_VEHI_ID; + } + else { + curPlayerVehM[playerid]--; + } + + format(cString, 128, "Model ID: %d~n~Vehicle Name: %s", curPlayerVehM, aVehicleNames[curPlayerVehM[playerid] - MIN_VEHI_ID]); + GameTextForPlayer(playerid, cString, 1500, 3); + + new Float:x, Float:y, Float:z, Float:a; + + GetPlayerPos(playerid, x, y, z); + GetXYInFrontOfPlayer(playerid, x, y, VEHI_DIS); + GetPlayerFacingAngle(playerid, a); + + DestroyVehicle(curPlayerVehI[playerid]); + curServerVehP[curPlayerVehI[playerid]][spawn] = false; + + curPlayerVehI[playerid] = CreateVehicle(curPlayerVehM[playerid], x, y, z + 2.0, a + 90.0, -1, -1, 5000); + printf( "vsel vehicle select id = %d", curPlayerVehI[playerid] ); + + LinkVehicleToInterior(curPlayerVehI[playerid], GetPlayerInterior(playerid)); + + curServerVehP[curPlayerVehI[playerid]][spawn] = true; + curServerVehP[curPlayerVehI[playerid]][vmodel] = curPlayerVehM[playerid]; + curServerVehP[curPlayerVehI[playerid]][vInt] = GetPlayerInterior(playerid); + } + + // Action key exits vehicle selection + if(keys & KEY_ACTION) + { + SetCameraBehindPlayer(playerid); + TogglePlayerControllable(playerid, 1); + + format(cString, 128, "[SUCCESS]: Spawned a \"%s\" (MODELID: %d, VEHICLEID: %d)", aVehicleNames[curPlayerVehM[playerid] - MIN_VEHI_ID], curPlayerVehM[playerid], curPlayerVehI[playerid]); + SendClientMessage(playerid, COLOR_GREEN, cString); + + gPlayerStatus[playerid] = 0; + KillTimer(gPlayerTimers[playerid]); + } +} +#endif + +#if OBJE_SELECT == true +public ObjectSelect( playerid ) +{ + new keys, updown, leftright; + + GetPlayerKeys( playerid, keys, updown, leftright ); + + new cString[ 128 ]; + + switch ( curPlayerObjM[ playerid ][ OBJ_MOD ] ) + { + case O_MODE_SELECTOR: + { + if ( updown == KEY_UP) + { + curPlayerObjM[ playerid ][ OBJ_MDL ] += 10; + + if ( curPlayerObjM[ playerid ][ OBJ_MDL ] >= MAX_OBJE_ID ) + { + curPlayerObjM[ playerid ][ OBJ_MDL ] = MIN_OBJE_ID; + } + + while ( !IsValidModel( curPlayerObjM[ playerid ][ OBJ_MDL ] ) ) + { + curPlayerObjM[ playerid ][ OBJ_MDL ]++; + } + + DestroyObject( curPlayerObjI[ playerid ] ); + curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ], + curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ], + curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ] + ); + + format( cString, 128, "Model ID: %d", curPlayerObjM[ playerid ][ OBJ_MDL ] ); + GameTextForPlayer(playerid, cString, 1500, 3); + } + + if ( updown == KEY_DOWN) + { + curPlayerObjM[ playerid ][ OBJ_MDL ] -= 10; + + if ( curPlayerObjM[ playerid ][ OBJ_MDL ] <= MIN_OBJE_ID ) + { + curPlayerObjM[ playerid ][ OBJ_MDL ] = MAX_OBJE_ID; + } + + while ( !IsValidModel( curPlayerObjM[ playerid ][ OBJ_MDL ] ) ) + { + curPlayerObjM[ playerid ][ OBJ_MDL ]--; + } + + DestroyObject( curPlayerObjI[ playerid ] ); + curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ], + curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ], + curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ] + ); + + format( cString, 128, "Model ID: %d", curPlayerObjM[ playerid ][ OBJ_MDL ] ); + GameTextForPlayer(playerid, cString, 1500, 3); + } + + if ( leftright == KEY_LEFT) + { + curPlayerObjM[ playerid ][ OBJ_MDL ]--; + + if ( curPlayerObjM[ playerid ][ OBJ_MDL ] <= MIN_OBJE_ID ) + { + curPlayerObjM[ playerid ][ OBJ_MDL ] = MAX_OBJE_ID; + } + + while ( !IsValidModel( curPlayerObjM[ playerid ][ OBJ_MDL ] ) ) + { + curPlayerObjM[ playerid ][ OBJ_MDL ]--; + } + + DestroyObject( curPlayerObjI[ playerid ] ); + curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ], + curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ], + curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ] + ); + + format( cString, 128, "Model ID: %d", curPlayerObjM[ playerid ][ OBJ_MDL ] ); + GameTextForPlayer(playerid, cString, 1500, 3); + } + + if ( leftright == KEY_RIGHT) + { + curPlayerObjM[ playerid ][ OBJ_MDL ]++; + + if ( curPlayerObjM[ playerid ][ OBJ_MDL ] >= MAX_OBJE_ID ) + { + curPlayerObjM[ playerid ][ OBJ_MDL ] = MIN_OBJE_ID; + } + + while ( !IsValidModel( curPlayerObjM[ playerid ][ OBJ_MDL ] ) ) + { + curPlayerObjM[ playerid ][ OBJ_MDL ]++; + } + + DestroyObject( curPlayerObjI[ playerid ] ); + curPlayerObjI[ playerid ] = CreateObject( curPlayerObjM[ playerid ][ OBJ_MDL ], curPlayerObjM[ playerid ][ OBJ_X ], + curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ], + curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ] + ); + + format( cString, 128, "Model ID: %d", curPlayerObjM[ playerid ][ OBJ_MDL ] ); + GameTextForPlayer(playerid, cString, 1500, 3); + } + } + + case O_MODE_MOVER: + { + if ( updown == KEY_UP) + { + curPlayerObjM[ playerid ][ OBJ_Z ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CPOS_Z ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CLOO_Z ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + } + + if ( updown == KEY_DOWN) + { + curPlayerObjM[ playerid ][ OBJ_Z ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CPOS_Z ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CLOO_Z ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + } + + if ( leftright == KEY_LEFT) + { + curPlayerObjM[ playerid ][ OBJ_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CPOS_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CLOO_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + } + + if ( leftright == KEY_RIGHT) + { + curPlayerObjM[ playerid ][ OBJ_Y ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CPOS_Y ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CLOO_Y ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + } + + if ( keys & KEY_ANALOG_LEFT ) + { + curPlayerObjM[ playerid ][ OBJ_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CPOS_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CLOO_Y ] -= pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + } + + if ( keys & KEY_ANALOG_LEFT ) + { + curPlayerObjM[ playerid ][ OBJ_X ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CPOS_X ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + curPlayerCamD[ playerid ][ CLOO_X ] += pObjectRate[ playerid ][ OBJ_RATE_MOVE ]; + } + + SetPlayerPos( playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z] ); + SetObjectPos( curPlayerObjI[ playerid ], curPlayerObjM[ playerid ][ OBJ_X ], curPlayerObjM[ playerid ][ OBJ_Y ], curPlayerObjM[ playerid ][ OBJ_Z ] ); + SetPlayerCameraPos(playerid, curPlayerCamD[playerid][CPOS_X], curPlayerCamD[playerid][CPOS_Y], curPlayerCamD[playerid][CPOS_Z]); + SetPlayerCameraLookAt(playerid, curPlayerCamD[playerid][CLOO_X], curPlayerCamD[playerid][CLOO_Y], curPlayerCamD[playerid][CLOO_Z]); + } + + case O_MODE_ROTATOR: + { + if ( updown == KEY_UP) + { + curPlayerObjM[ playerid ][ OBJ_RZ ] += pObjectRate[ playerid ][ OBJ_RATE_ROT ]; + } + + if ( updown == KEY_DOWN) + { + curPlayerObjM[ playerid ][ OBJ_RZ ] -= pObjectRate[ playerid ][ OBJ_RATE_ROT ]; + + } + + if ( leftright == KEY_LEFT) + { + curPlayerObjM[ playerid ][ OBJ_RY ] -= pObjectRate[ playerid ][ OBJ_RATE_ROT ]; + } + + if ( leftright == KEY_RIGHT) + { + curPlayerObjM[ playerid ][ OBJ_RY ] += pObjectRate[ playerid ][ OBJ_RATE_ROT ]; + } + + if ( keys & KEY_ANALOG_LEFT ) + { + curPlayerObjM[ playerid ][ OBJ_RY ] -= pObjectRate[ playerid ][ OBJ_RATE_ROT ]; + } + + if ( keys & KEY_ANALOG_LEFT ) + { + curPlayerObjM[ playerid ][ OBJ_RX ] += pObjectRate[ playerid ][ OBJ_RATE_ROT ]; + } + + SetObjectRot( curPlayerObjI[ playerid ], curPlayerObjM[ playerid ][ OBJ_RX ], curPlayerObjM[ playerid ][ OBJ_RY ], curPlayerObjM[ playerid ][ OBJ_RZ ] ); + } + } + + if ( keys & KEY_ACTION ) + { + gPlayerStatus[ playerid ] = 0; + TogglePlayerControllable( playerid, 1 ); + SetCameraBehindPlayer( playerid ); + KillTimer( gPlayerTimers[playerid] ); + } + +} +#endif + +IsInvalidSkin(skinid) +{ // Created by Simon + // Checks whether the skinid parsed is crashable or not. + + #define MAX_BAD_SKINS 14 + + new badSkins[MAX_BAD_SKINS] = { + 3, 4, 5, 6, 8, 42, 65, 74, 86, + 119, 149, 208, 273, 289 + }; + + for (new i = 0; i < MAX_BAD_SKINS; i++) { + if (skinid == badSkins[i]) return true; + } + + return false; +} + +GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) +{ // Created by Y_Less + + new Float:a; + + GetPlayerPos(playerid, x, y, a); + GetPlayerFacingAngle(playerid, a); + + if (GetPlayerVehicleID(playerid)) { + GetVehicleZAngle(GetPlayerVehicleID(playerid), a); + } + + x += (distance * floatsin(-a, degrees)); + y += (distance * floatcos(-a, degrees)); +} + +strtok(const string[], &index) +{ // Created by Compuphase + + new length = strlen(string); + while ((index < length) && (string[index] <= ' ')) + { + index++; + } + + new offset = index; + new result[20]; + while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) + { + result[index - offset] = string[index]; + index++; + } + result[index - offset] = EOS; + return result; +} + +GetVehicleModelIDFromName(vname[]) +{ + for(new i = 0; i < 211; i++) + { + if ( strfind(aVehicleNames[i], vname, true) != -1 ) + return i + MIN_VEHI_ID; + } + return -1; +} + +GetWeaponModelIDFromName(wname[]) +{ + for(new i = 0; i < 48; i++) { + if (i == 19 || i == 20 || i == 21) continue; + if (strfind(aWeaponNames[i], wname, true) != -1) { + return i; + } + } + return -1; +} + +IsValidModel(modelid) +{ + // Created by Y_Less. + + 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; +} diff --git a/filterscripts/gl_actions.amx b/filterscripts/gl_actions.amx new file mode 100644 index 0000000..15e7a99 Binary files /dev/null and b/filterscripts/gl_actions.amx differ diff --git a/filterscripts/gl_actions.pwn b/filterscripts/gl_actions.pwn new file mode 100644 index 0000000..1a929dd --- /dev/null +++ b/filterscripts/gl_actions.pwn @@ -0,0 +1,371 @@ +//------------------------------------------------- +// +// Generic Special Actions And Anims +// kyeman 2007 +// +//------------------------------------------------- + +#include +#include +#include +#pragma tabsize 0 + +#include "../include/gl_common.inc" + +new gPlayerUsingLoopingAnim[MAX_PLAYERS]; +new gPlayerAnimLibsPreloaded[MAX_PLAYERS]; + +new Text:txtAnimHelper; + +//------------------------------------------------- + +OnePlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp) +{ + ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp); +} + +//------------------------------------------------- + +LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp) +{ + gPlayerUsingLoopingAnim[playerid] = 1; + ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp); + TextDrawShowForPlayer(playerid,txtAnimHelper); +} + +//------------------------------------------------- + +StopLoopingAnim(playerid) +{ + gPlayerUsingLoopingAnim[playerid] = 0; + ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0); +} + +//------------------------------------------------- + +PreloadAnimLib(playerid, animlib[]) +{ + ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0); +} + +//------------------------------------------------- + +// ********** CALLBACKS ********** + +public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) +{ + if(!gPlayerUsingLoopingAnim[playerid]) return; + + if(IsKeyJustDown(KEY_SPRINT,newkeys,oldkeys)) { + StopLoopingAnim(playerid); + TextDrawHideForPlayer(playerid,txtAnimHelper); + } +} + +//------------------------------------------------ + +public OnPlayerDeath(playerid, killerid, reason) +{ + // if they die whilst performing a looping anim, we should reset the state + if(gPlayerUsingLoopingAnim[playerid]) { + gPlayerUsingLoopingAnim[playerid] = 0; + TextDrawHideForPlayer(playerid,txtAnimHelper); + } + + return 1; +} + +//------------------------------------------------- + +public OnPlayerSpawn(playerid) +{ + if(!gPlayerAnimLibsPreloaded[playerid]) { + PreloadAnimLib(playerid,"BOMBER"); + PreloadAnimLib(playerid,"RAPPING"); + PreloadAnimLib(playerid,"SHOP"); + PreloadAnimLib(playerid,"BEACH"); + PreloadAnimLib(playerid,"SMOKING"); + PreloadAnimLib(playerid,"FOOD"); + PreloadAnimLib(playerid,"ON_LOOKERS"); + PreloadAnimLib(playerid,"DEALER"); + PreloadAnimLib(playerid,"CRACK"); + PreloadAnimLib(playerid,"CARRY"); + PreloadAnimLib(playerid,"COP_AMBIENT"); + PreloadAnimLib(playerid,"PARK"); + PreloadAnimLib(playerid,"INT_HOUSE"); + PreloadAnimLib(playerid,"FOOD"); + gPlayerAnimLibsPreloaded[playerid] = 1; + } + return 1; +} + +//------------------------------------------------- + +public OnPlayerConnect(playerid) +{ + gPlayerUsingLoopingAnim[playerid] = 0; + gPlayerAnimLibsPreloaded[playerid] = 0; + + return 1; +} + +//------------------------------------------------- + +public OnFilterScriptInit() +{ + // Init our text display + txtAnimHelper = TextDrawCreate(610.0, 400.0, + "~r~~k~~PED_SPRINT~ ~w~to stop the animation"); + TextDrawUseBox(txtAnimHelper, 0); + TextDrawFont(txtAnimHelper, 2); + TextDrawSetShadow(txtAnimHelper,0); // no shadow + TextDrawSetOutline(txtAnimHelper,1); // thickness 1 + TextDrawBackgroundColor(txtAnimHelper,0x000000FF); + TextDrawColor(txtAnimHelper,0xFFFFFFFF); + TextDrawAlignment(txtAnimHelper,3); // align right +} + +//------------------------------------------------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256]; + new idx; + new dancestyle; + cmd = strtok(cmdtext, idx); + + if(strcmp(cmd,"/animlist",true)==0) + { + SendClientMessage(playerid,0xAFAFAFAA,"Available Animations:"); + SendClientMessage(playerid,0xAFAFAFAA,"/handsup /drunk /bomb /getarrested /laugh /lookout /robman"); + SendClientMessage(playerid,0xAFAFAFAA,"/crossarms /lay /hide /vomit /eat /wave /taichi"); + SendClientMessage(playerid,0xAFAFAFAA,"/deal /crack /smokem /smokef /groundsit /chat /dance /f**ku"); + } + + if(strcmp(cmd, "/amcuffed", true) == 0) { + // note: the cuffs have not been scaled for all player models + SetPlayerAttachedObject(playerid,8,19418,6,-0.031999,0.024000,-0.024000,-7.900000,-32.000011,-72.299987,1.115998,1.322000,1.406000); + SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED); + return 1; + } + + if(strcmp(cmd, "/uncuffme", true) == 0) { + if(IsPlayerAttachedObjectSlotUsed(playerid, 8)) { + RemovePlayerAttachedObject(playerid, 8); + } + SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); + return 1; + } + + // We don't handle anything else after this that can be used in vehicles + if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) { + return 0; + } + + // HANDSUP + if(strcmp(cmd, "/handsup", true) == 0) { + SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP); + return 1; + } + + // CELLPHONE IN + if(strcmp(cmd, "/cellin", true) == 0) { + SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE); + return 1; + } + + // CELLPHONE OUT + if(strcmp(cmd, "/cellout", true) == 0) { + SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE); + return 1; + } + + // Drunk + if(strcmp(cmd, "/drunk", true) == 0) { + LoopingAnim(playerid,"PED","WALK_DRUNK",4.0,1,1,1,1,0); + return 1; + } + + // Place a Bomb + if (strcmp("/bomb", cmdtext, true) == 0) { + ClearAnimations(playerid); + OnePlayAnim(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0); // Place Bomb + return 1; + } + // Police Arrest + if (strcmp("/getarrested", cmdtext, true, 7) == 0) { + LoopingAnim(playerid,"ped", "ARRESTgun", 4.0, 0, 1, 1, 1, -1); // Gun Arrest + return 1; + } + // Laugh + if (strcmp("/laugh", cmdtext, true) == 0) { + OnePlayAnim(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0); // Laugh + return 1; + } + // Rob Lookout + if (strcmp("/lookout", cmdtext, true) == 0) { + OnePlayAnim(playerid, "SHOP", "ROB_Shifty", 4.0, 0, 0, 0, 0, 0); // Rob Lookout + return 1; + } + // Rob Threat + if (strcmp("/robman", cmdtext, true) == 0) { + LoopingAnim(playerid, "SHOP", "ROB_Loop_Threat", 4.0, 1, 0, 0, 0, 0); // Rob + return 1; + } + // Arms crossed + if (strcmp("/crossarms", cmdtext, true) == 0) { + LoopingAnim(playerid, "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1); // Arms crossed + return 1; + } + // Lay Down + if (strcmp("/lay", cmdtext, true, 6) == 0) { + LoopingAnim(playerid,"BEACH", "bather", 4.0, 1, 0, 0, 0, 0); // Lay down + return 1; + } + // Take Cover + if (strcmp("/hide", cmdtext, true, 3) == 0) { + LoopingAnim(playerid, "ped", "cower", 3.0, 1, 0, 0, 0, 0); // Taking Cover + return 1; + } + // Vomit + if (strcmp("/vomit", cmdtext, true) == 0) { + OnePlayAnim(playerid, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 0); // Vomit BAH! + return 1; + } + // Eat Burger + if (strcmp("/eat", cmdtext, true) == 0) { + OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger + return 1; + } + // Wave + if (strcmp("/wave", cmdtext, true) == 0) { + LoopingAnim(playerid, "ON_LOOKERS", "wave_loop", 4.0, 1, 0, 0, 0, 0); // Wave + return 1; + } + // Slap Ass + if (strcmp("/slapass", cmdtext, true) == 0) { + OnePlayAnim(playerid, "SWEET", "sweet_ass_slap", 4.0, 0, 0, 0, 0, 0); // Ass Slapping + return 1; + } + // Dealer + if (strcmp("/deal", cmdtext, true) == 0) { + OnePlayAnim(playerid, "DEALER", "DEALER_DEAL", 4.0, 0, 0, 0, 0, 0); // Deal Drugs + return 1; + } + // Crack Dieing + if (strcmp("/crack", cmdtext, true, 6) == 0) { + LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); // Dieing of Crack + return 1; + } + // Male Smoking + if (strcmp("/smokem", cmdtext, true, 4) == 0) { + LoopingAnim(playerid,"SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0); // Smoke + return 1; + } + // Female Smoking + if (strcmp("/smokef", cmdtext, true) == 0) { + LoopingAnim(playerid, "SMOKING", "F_smklean_loop", 4.0, 1, 0, 0, 0, 0); // Female Smoking + return 1; + } + // Sit + if (strcmp("/groundsit", cmdtext, true, 4) == 0) { + LoopingAnim(playerid,"BEACH", "ParkSit_M_loop", 4.0, 1, 0, 0, 0, 0); // Sit + return 1; + } + // Idle Chat + if(strcmp(cmd, "/chat", true) == 0) { + OnePlayAnim(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,0); + return 1; + } + // Fucku + if(strcmp(cmd, "/fucku", true) == 0) { + OnePlayAnim(playerid,"PED","fucku",4.0,0,0,0,0,0); + return 1; + } + // TaiChi + if(strcmp(cmd, "/taichi", true) == 0) { + LoopingAnim(playerid,"PARK","Tai_Chi_Loop",4.0,1,0,0,0,0); + return 1; + } + + // ChairSit + if(strcmp(cmd, "/chairsit", true) == 0) { + LoopingAnim(playerid,"BAR","dnk_stndF_loop",4.0,1,0,0,0,0); + return 1; + } + + // Collapse + if(strcmp(cmd, "/collapse", true) == 0) { + LoopingAnim(playerid,"PED","FALL_COLLAPSE",4.0,1,0,0,0,0); + return 1; + } + + // fall + if(strcmp(cmd, "/fallover", true) == 0) { + LoopingAnim(playerid,"PED","FALL_FALL",4.0,1,0,0,0,0); + return 1; + } + + // ko + if(strcmp(cmd, "/ko1", true) == 0) { + LoopingAnim(playerid,"PED","KO_SHOT_STOM",200.0, 0, 1, 1, 1, -1); + return 1; + } + + // ko + if(strcmp(cmd, "/ko2", true) == 0) { + LoopingAnim(playerid,"PED","KO_SHOT_FACE",4.0, 0, 1, 1, 1, -1); + return 1; + } + + if(strcmp(cmd, "/floorhit", true) == 0) { + ApplyAnimation(playerid,"PED", "FLOOR_hit_f", 4.1, 0, 0, 0, 1, 0); + return 1; + } + + /* Would allow people to troll... but would be cool as a script + controlled function + // Bed Sleep R + if(strcmp(cmd, "/inbedright", true) == 0) { + LoopingAnim(playerid,"INT_HOUSE","BED_Loop_R",4.0,1,0,0,0,0); + return 1; + } + // Bed Sleep L + if(strcmp(cmd, "/inbedleft", true) == 0) { + LoopingAnim(playerid,"INT_HOUSE","BED_Loop_L",4.0,1,0,0,0,0); + return 1; + }*/ + + // START DANCING + if(strcmp(cmd, "/dance", true) == 0) { + new tmp[256]; + + // Get the dance style param + tmp = strtok(cmdtext, idx); + if(!strlen(tmp) || strlen(tmp) > 2) { + SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]"); + return 1; + } + + dancestyle = strval(tmp); + if(dancestyle < 1 || dancestyle > 4) { + SendClientMessage(playerid,0xFF0000FF,"USAGE: /dance [style 1-4]"); + return 1; + } + + if(dancestyle == 1) { + SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1); + } else if(dancestyle == 2) { + SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE2); + } else if(dancestyle == 3) { + SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3); + } else if(dancestyle == 4) { + SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE4); + } + return 1; + } + + return 0; +} +//------------------------------------------------- +// EOF diff --git a/filterscripts/gl_chat.amx b/filterscripts/gl_chat.amx new file mode 100644 index 0000000..fae0e30 Binary files /dev/null and b/filterscripts/gl_chat.amx differ diff --git a/filterscripts/gl_chat.pwn b/filterscripts/gl_chat.pwn new file mode 100644 index 0000000..fa947f9 --- /dev/null +++ b/filterscripts/gl_chat.pwn @@ -0,0 +1,293 @@ +// +// +// SA-MP Roleplay style chat module for Grand Larceny +// (c) 2012 SA-MP Team +// All rights reserved +// + +#include +#include "../include/gl_common.inc" +#include "../include/gl_messages.inc" // <- contains all the main text/messaging functions + +//--------------------------------------------- + +stock ProcessChatText(playerid, text[]) +{ + new useindex=1; + + // Handle shouting prefix (!) + if(text[0] == '!' && strlen(text) > 1) { + if(text[1] == ' ') useindex++; + TalkMessage(SHOUT_DISTANCE, playerid, "*shouts*", text[useindex]); + return; + } + + // Handle quiet prefix (#) + if(text[0] == '#' && strlen(text) > 1) { + if(text[1] == ' ') useindex++; + TalkMessage(LOW_DISTANCE, playerid, "*quietly*", text[useindex]); + return; + } + + // Send to other players in range and fade + TalkMessage(TALK_DISTANCE, playerid, "", text); +} + +//--------------------------------------------- + +stock ProcessActionText(playerid, message[], actiontype) +{ + new ActionText[256+1]; + new ActionBubble[MAX_CHATBUBBLE_LENGTH+1]; + new PlayerName[MAX_PLAYER_NAME+1]; + + GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); + + if(actiontype == ACTION_DO) { + format(ActionText, 256, "* %s ((%s))", message, PlayerName); + format(ActionBubble, MAX_CHATBUBBLE_LENGTH, "* (( %s ))", message); + } else { + format(ActionText, 256, "* %s %s", PlayerName, message); + format(ActionBubble, MAX_CHATBUBBLE_LENGTH, "* %s", message); + } + + LocalMessage(ACTION_DISTANCE, playerid, ACTION_COLOR, ActionText); + SetPlayerChatBubble(playerid, ActionBubble, ACTION_COLOR, ACTION_DISTANCE, CHAT_BUBBLE_TIME); +} + +//--------------------------------------------- + +new gOOCDisabled = false; + +stock GlobalOOCMessage(playerid, message[]) +{ + new msg[256+1]; + new PlayerName[MAX_PLAYER_NAME+1]; + + if(gOOCDisabled) { + CmdErrorMessage(playerid, "The OOC channel is not enabled right now"); + return; + } + + GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); + format(msg, 256, "(( %s: %s ))", PlayerName, message); + + for(new i = 0; i < MAX_PLAYERS; i++) { // for every player + if(IsPlayerConnected(i)) { // Todo: check if player accepts occ + PlayerMessage(i, OOC_COLOR, msg); + } + } +} + +//--------------------------------------------- + +stock ToggleOOC(playerid) +{ + if(IsPlayerAdmin(playerid)) { + // toggle it + if(gOOCDisabled) gOOCDisabled = false; + else gOOCDisabled = true; + + if(!gOOCDisabled) { + GlobalMessage(GENERAL_COLOR, "{D0D0D0}[ooc] channel is {80CC80}enabled"); + } else { + GlobalMessage(GENERAL_COLOR, "{D0D0D0}[ooc] channel is {CC8080}disabled"); + } + } else { + CmdErrorMessage(playerid, "Your admin level isn't high enough to change this"); + } +} + +//--------------------------------------------- + +stock ProcessLocalOOC(playerid, message[]) +{ + new new_message[256+1]; + new PlayerName[MAX_PLAYER_NAME+1]; + GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); + format(new_message, 256, "%s (( %s ))", PlayerName, message); + LocalMessage(TALK_DISTANCE, playerid, LOCAL_TALK_COLOR, new_message); +} + +//--------------------------------------------- + +stock ProcessMegaphone(playerid, message[]) +{ + // Todo: add permissions on megaphone usage + new new_message[256+1]; + new PlayerName[MAX_PLAYER_NAME+1]; + GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); + format(new_message, 256, "(megaphone) %s >> %s", PlayerName, message); + LocalMessage(MEGAPHONE_DISTANCE, playerid, MEGAPHONE_COLOR, new_message, 1); +} + +//--------------------------------------------- + +stock ProcessWhisper(playerid, toplayerid, message[]) +{ + new PlayerName[MAX_PLAYER_NAME+1]; + new ToPlayerName[MAX_PLAYER_NAME+1]; + new PmMessage[256+1]; + GetPlayerName(playerid,PlayerName,sizeof(PlayerName)); + GetPlayerName(toplayerid,ToPlayerName,sizeof(ToPlayerName)); + format(PmMessage, sizeof(PmMessage), ">> %s(%d): %s", ToPlayerName, toplayerid, message); + PlayerMessage(playerid, WHISPER_COLOR, PmMessage); + format(PmMessage, sizeof(PmMessage), "** %s(%d): %s", PlayerName, playerid, message); + PlayerMessage(toplayerid, WHISPER_COLOR, PmMessage); + PlayerPlaySound(toplayerid, 1085, 0.0, 0.0, 0.0); +} + +//--------------------------------------------- + +stock ProcessChatCommands(playerid, cmdtext[]) +{ + new cmd[256+1]; + new message[256+1]; + new tmp[256+1]; + new idx; + + cmd = strtok(cmdtext, idx); + + // Action commands + if(!strcmp("/me", cmd, true)) + { + message = strrest(cmdtext,idx); + if(!strlen(message)) { + CmdUsageMessage(playerid, "/me [action]"); + return 1; + } + ProcessActionText(playerid, message, ACTION_ME); + return 1; + } + if(!strcmp("/do", cmd, true)) + { + message = strrest(cmdtext,idx); + if(!strlen(message)) { + CmdUsageMessage(playerid, "/do [action]"); + return 1; + } + ProcessActionText(playerid, message, ACTION_DO); + return 1; + } + // Talk commands + + // /low + if(!strcmp("/l", cmd, true) || !strcmp("/low", cmd, true)) + { + message = strrest(cmdtext,idx); + if(!strlen(message)) { + CmdUsageMessage(playerid, "(/l)ow [text]"); + return 1; + } + TalkMessage(LOW_DISTANCE, playerid, "*quietly*", message); + return 1; + } + // /shout + if(!strcmp("/s", cmd, true) || !strcmp("/shout", cmd, true)) + { + message = strrest(cmdtext,idx); + if(!strlen(message)) { + CmdUsageMessage(playerid, "(/s)hout [text]"); + return 1; + } + TalkMessage(SHOUT_DISTANCE, playerid, "*shouts*", message); + return 1; + } + // /b (local ooc) + if(!strcmp("/b", cmd, true)) + { + message = strrest(cmdtext,idx); + if(!strlen(message)) { + CmdUsageMessage(playerid, "/b [text]"); + return 1; + } + ProcessLocalOOC(playerid, message); + return 1; + } + // /megaphone + if(!strcmp("/m", cmd, true) || !strcmp("/megaphone", cmd, true)) + { + message = strrest(cmdtext,idx); + if(!strlen(message)) { + CmdUsageMessage(playerid, "(/m)egaphone [text]"); + return 1; + } + ProcessMegaphone(playerid, message); + return 1; + } + // Global OOC /o and /ooc + if(!strcmp("/o", cmd, true) || !strcmp("/ooc", cmd, true)) + { + message = strrest(cmdtext,idx); + if(!strlen(message)) { + CmdUsageMessage(playerid, "(/o)oc [text]"); + return 1; + } + GlobalOOCMessage(playerid, message); + return 1; + } + // Toggle the OOC channel /togooc + if(!strcmp("/togooc", cmd, true)) + { + ToggleOOC(playerid); + return 1; + } + // /whisper /pm + if(!strcmp("/w", cmd, true) || !strcmp("/wisper", cmd, true) || !strcmp("/pm", cmd, true)) + { + tmp = strtok(cmdtext,idx); + + if(!strlen(tmp)) { + CmdUsageMessage(playerid, "(/w)isper [playerid/PartOfName] [whisper text]"); + return 1; + } + + new toplayerid = ReturnUser(tmp); + + if(toplayerid == RETURN_USER_MULTIPLE) { + CmdErrorMessage(playerid, "Multiple matches found for [name]. Please narrow the search."); + return 1; + } + if(toplayerid == RETURN_USER_FAILURE || !IsPlayerConnected(toplayerid)) { + CmdErrorMessage(playerid, "That player isn't connected right now."); + return 1; + } + + message = strrest(cmdtext,idx); + + if(!strlen(message)) { + CmdUsageMessage(playerid, "(/w)isper [playerid/PartOfName] [whisper text]"); + return 1; + } + + if(IsPlayerConnected(toplayerid)) { + ProcessWhisper(playerid, toplayerid, message); + } + + return 1; + } + + + return 0; +} + +//--------------------------------------------- + +public OnPlayerText(playerid, text[]) +{ + ProcessChatText(playerid, text); + return 0; +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if(ProcessChatCommands(playerid,cmdtext)) { + return 1; + } + return 0; +} + +//--------------------------------------------- + diff --git a/filterscripts/gl_chatbubble.amx b/filterscripts/gl_chatbubble.amx new file mode 100644 index 0000000..35fb310 Binary files /dev/null and b/filterscripts/gl_chatbubble.amx differ diff --git a/filterscripts/gl_chatbubble.pwn b/filterscripts/gl_chatbubble.pwn new file mode 100644 index 0000000..7ba280c --- /dev/null +++ b/filterscripts/gl_chatbubble.pwn @@ -0,0 +1,63 @@ +// +// Example use of chat above player's head +// + +#include +#include "../include/gl_common.inc" + +#define MESSAGE_COLOR 0xEEEEEEFF +#define ECHO_COLOR 0xEEEEEEFF +#define ACTION_COLOR 0xEE66EEFF + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--Speech bubble example loaded.\n"); + return 1; +} + +//------------------------------------------------ + +public OnPlayerText(playerid, text[]) +{ + if(strlen(text) > 128) return 0; + + new to_others[MAX_CHATBUBBLE_LENGTH+1]; + new to_me[MAX_CHATBUBBLE_LENGTH+1]; + + format(to_others,MAX_CHATBUBBLE_LENGTH,"Says: %s",text); + format(to_me,MAX_CHATBUBBLE_LENGTH,">> %s",text); + + SetPlayerChatBubble(playerid,to_others,MESSAGE_COLOR,35.0,10000); + SendClientMessage(playerid,ECHO_COLOR,to_me); + + return 0; // can't do normal chat with this loaded +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256]; + new Message[256]; + new idx; + new actiontext[MAX_CHATBUBBLE_LENGTH+1]; + + cmd = strtok(cmdtext, idx); + + // Action command + if(strcmp("/me", cmd, true) == 0) + { + Message = strrest(cmdtext,idx); + format(actiontext,MAX_CHATBUBBLE_LENGTH,"* %s",Message); + SetPlayerChatBubble(playerid,actiontext,ACTION_COLOR,30.0,10000); + SendClientMessage(playerid,ACTION_COLOR,actiontext); + return 1; + } + + return 0; // not handled by this script +} + +//------------------------------------------------ + diff --git a/filterscripts/gl_mapicon.amx b/filterscripts/gl_mapicon.amx new file mode 100644 index 0000000..f5e05b3 Binary files /dev/null and b/filterscripts/gl_mapicon.amx differ diff --git a/filterscripts/gl_mapicon.pwn b/filterscripts/gl_mapicon.pwn new file mode 100644 index 0000000..b033c30 --- /dev/null +++ b/filterscripts/gl_mapicon.pwn @@ -0,0 +1,70 @@ +//------------------------------------------------- +// +// These are the default map icons from San Andreas +// Cluckin Bell, Ammu, Burgershot etc +// +// Kye 2010 +// +//------------------------------------------------- + +#pragma tabsize 0 + +#include +#include +#include + +public OnPlayerConnect(playerid) +{ + SetPlayerMapIcon(playerid,49,822.6,-1590.3,13.5,7,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,50,-2570.1,245.4,10.3,7,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,51,2726.6,-2026.4,17.5,7,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,52,2080.3,2119.0,10.8,7,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,53,675.7,-496.6,16.8,7,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,54,-1805.7,943.2,24.8,29,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,55,2750.9,2470.9,11.0,29,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,56,2351.8,2529.0,10.8,29,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,57,2635.5,1847.4,11.0,29,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,58,2083.4,2221.0,11.0,29,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,59,-1719.1,1359.4,8.6,29,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,60,2330.2,75.2,31.0,29,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,61,203.2,-200.4,6.5,29,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,62,812.9,-1616.1,13.6,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,63,1199.1,-924.0,43.3,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,64,2362.2,2069.9,10.8,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,65,2469.5,2033.8,10.8,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,66,2172.9,2795.7,10.8,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,67,1875.3,2072.0,10.8,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,68,1161.5,2072.0,10.8,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,69,-2356.0,1009.0,49.0,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,70,-1913.3,826.2,36.9,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,71,-2335.6,-165.6,39.5,10,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,72,2397.8,-1895.6,13.7,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,73,2421.6,-1509.6,24.1,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,74,-2671.6,257.4,4.6,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,75,2392.4,2046.5,10.8,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,76,2844.5,2401.1,11.0,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,77,2635.5,1674.3,11.0,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,78,2105.7,2228.7,11.0,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,79,-2154.0,-2461.2,30.8,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,80,-1816.2,620.8,37.5,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,81,-1216.0,1831.4,45.3,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,82,172.73,1176.76,13.7,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,83,932.0,-1353.0,14.0,14,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,84,1971.7,-2036.6,13.5,39,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,85,2071.6,-1779.9,13.5,39,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,86,2094.6,2119.0,10.8,39,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,87,-2490.5,-40.1,39.3,39,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,88,1372.9,-1278.8,12.5,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,89,2400.5,-1978.4,13.5,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,90,-2626.6,209.4,4.9,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,91,2535.9,2083.5,10.8,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,92,2156.5,943.2,10.8,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,93,779.7,1874.3,4.9,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,94,-2092.7,-2463.8,30.6,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,95,240.0,-178.2,2.0,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,96,-1509.4,2611.8,58.5,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,97,-315.67,829.87,13.43,6,0,MAPICON_LOCAL); + SetPlayerMapIcon(playerid,98,2332.9,63.6,31.0,6,0,MAPICON_LOCAL); + + return 1; +} diff --git a/filterscripts/gl_npcs.amx b/filterscripts/gl_npcs.amx new file mode 100644 index 0000000..37f60a8 Binary files /dev/null and b/filterscripts/gl_npcs.amx differ diff --git a/filterscripts/gl_npcs.pwn b/filterscripts/gl_npcs.pwn new file mode 100644 index 0000000..3861471 --- /dev/null +++ b/filterscripts/gl_npcs.pwn @@ -0,0 +1,161 @@ +//------------------------------------------------- +// +// NPC initialisation for Grand Larceny +// +//------------------------------------------------- + +#pragma tabsize 0 +#include + +//------------------------------------------------- + +public OnFilterScriptInit() +{ + ConnectNPC("TrainDriverLV","train_lv"); + ConnectNPC("TrainDriverLS","train_ls"); + ConnectNPC("TrainDriverSF","train_sf"); + ConnectNPC("PilotLV","at400_lv"); + ConnectNPC("PilotSF","at400_sf"); + ConnectNPC("PilotLS","at400_ls"); + + // Testing + //ConnectNPC("OnfootTest","onfoot_test"); + //ConnectNPC("DriverTest","mat_test2"); + //ConnectNPC("DriverTest2","driver_test2"); + + return 1; +} + +//------------------------------------------------- +// IMPORTANT: This restricts NPCs connecting from +// an IP address outside this server. If you need +// to connect NPCs externally you will need to modify +// the code in this callback. + +public OnPlayerConnect(playerid) +{ + if(IsPlayerNPC(playerid)) { + new ip_addr_npc[64+1]; + new ip_addr_server[64+1]; + GetServerVarAsString("bind",ip_addr_server,64); + GetPlayerIp(playerid,ip_addr_npc,64); + + if(!strlen(ip_addr_server)) { + ip_addr_server = "127.0.0.1"; + } + + if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) { + // this bot is remote connecting + printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc); + Kick(playerid); + return 0; + } + printf("NPC: Connection from %s is allowed.",ip_addr_npc); + } + + return 1; +} + +//------------------------------------------------- + +public OnPlayerRequestClass(playerid, classid) +{ + if(!IsPlayerNPC(playerid)) return 0; // We only deal with NPC players in this script + + new playername[64]; + GetPlayerName(playerid,playername,64); + + if(!strcmp(playername,"TrainDriverLV",true)) { + SetSpawnInfo(playerid,69,255,1462.0745,2630.8787,10.8203,0.0,-1,-1,-1,-1,-1,-1); + } + else if(!strcmp(playername,"TrainDriverSF",true)) { + SetSpawnInfo(playerid,69,255,-1942.7950,168.4164,27.0006,0.0,-1,-1,-1,-1,-1,-1); + } + else if(!strcmp(playername,"TrainDriverLS",true)) { + SetSpawnInfo(playerid,69,255,1700.7551,-1953.6531,14.8756,0.0,-1,-1,-1,-1,-1,-1); + } + else if(!strcmp(playername,"PilotLV",true)) { + SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1); + } + else if(!strcmp(playername,"PilotSF",true)) { + SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1); + } + else if(!strcmp(playername,"PilotLS",true)) { + SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1); + } + else if(!strcmp(playername,"OnfootTest",true)) { + SetSpawnInfo(playerid,69,61,2388.1003,-1279.8933,25.1291,94.3321,-1,-1,-1,-1,-1,-1); + } + else if(!strcmp(playername,"DriverTest",true)) { + SetSpawnInfo(playerid,69,61,2388.1003,-1279.8933,25.1291,94.3321,-1,-1,-1,-1,-1,-1); + } + else if(!strcmp(playername,"DriverTest2",true)) { + SetSpawnInfo(playerid,69,61,2388.1003,-1279.8933,25.1291,94.3321,-1,-1,-1,-1,-1,-1); + } + + return 0; +} + +//------------------------------------------------- + +stock SetVehicleTireStatus(vehicleid, tirestatus) +{ + new panels, doors, lights, tires; + GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires); + UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tirestatus); +} + +//------------------------------------------------- + +public OnPlayerSpawn(playerid) +{ + if(!IsPlayerNPC(playerid)) return 1; // We only deal with NPC players in this script + + new playername[64]; + GetPlayerName(playerid,playername,64); + + if(!strcmp(playername,"TrainDriverLV",true)) { + PutPlayerInVehicle(playerid,1,0); + SetPlayerColor(playerid,0xFFFFFFFF); + } + else if(!strcmp(playername,"TrainDriverSF",true)) { + PutPlayerInVehicle(playerid,5,0); + SetPlayerColor(playerid,0xFFFFFFFF); + } + else if(!strcmp(playername,"TrainDriverLS",true)) { + PutPlayerInVehicle(playerid,9,0); + SetPlayerColor(playerid,0xFFFFFFFF); + } + else if(!strcmp(playername,"PilotLV",true)) { + PutPlayerInVehicle(playerid,13,0); + SetPlayerColor(playerid,0xFFFFFFFF); + } + else if(!strcmp(playername,"PilotSF",true)) { + PutPlayerInVehicle(playerid,14,0); + SetPlayerColor(playerid,0xFFFFFFFF); + } + else if(!strcmp(playername,"PilotLS",true)) { + PutPlayerInVehicle(playerid,15,0); + SetPlayerColor(playerid,0xFFFFFFFF); + } + else if(!strcmp(playername,"OnfootTest",true)) { + //PutPlayerInVehicle(playerid,876,0); + SetPlayerColor(playerid,0xFFFFFFFF); + } + else if(!strcmp(playername,"DriverTest",true)) { + PutPlayerInVehicle(playerid,376,0); + SetPlayerColor(playerid,0xFFFFFFFF); + } + else if(!strcmp(playername,"DriverTest2",true)) { + //SetVehicleTireStatus(876,0xFF); + PutPlayerInVehicle(playerid,875,0); + SetPlayerColor(playerid,0xFFFFFFFF); + } + + return 1; +} + +//------------------------------------------------- +// EOF + + diff --git a/filterscripts/gl_property.amx b/filterscripts/gl_property.amx new file mode 100644 index 0000000..518567c Binary files /dev/null and b/filterscripts/gl_property.amx differ diff --git a/filterscripts/gl_property.pwn b/filterscripts/gl_property.pwn new file mode 100644 index 0000000..908bfa2 --- /dev/null +++ b/filterscripts/gl_property.pwn @@ -0,0 +1,835 @@ +//------------------------------------------------------- +// +// GRAND LARCENY Property creation and management script +// +// by damospiderman 2008 +// +//------------------------------------------------------- + +#include +#include "../include/gl_common.inc" + +#define FILTERSCRIPT +//#define USE_SQLITE + +#define PROP_VW (10000) +#define MAX_INTERIORS (146) +#define MAX_PROPERTIES (1000) + +#define PROPERTY_FOLDER "properties" // Location of properties file +#define PROPERTY_UNIQID_FILE "properties/uniqId.txt" // Location of Uniq Interior Info +#define DB_PROPERTIES "properties/dbProperties.db" // Location of the properties Database + +#define MAX_TYPES (5) +#define TYPE_EMPTY (0) +#define TYPE_HOUSE (1) +#define TYPE_BUSINESS (2) +#define TYPE_BANK (3) +#define TYPE_COP (4) + +enum // Property Type Enum + E_P_TYPES { + tIcon, + tName[32] + } + +enum // Uniq Interiors Enum + E_INTERIORS { + inIntID, + Float:inExitX, + Float:inExitY, + Float:inExitZ, + Float:inExitA, + inName[64] + }; + +enum // Properties Enum + E_PROPERTIES { + eInterior, + eType, + Float:eEntX, + Float:eEntY, + Float:eEntZ, + Float:eEntA, + eUniqIntId, + eOwner, + ePrice, + ePname[64] + }; + +// [ uniq property id ] +new unid; + +// [ Array of all the property interior info ] +new interiorInfo[MAX_INTERIORS][E_INTERIORS]; + +// [ Pickup array with property id assigned via array slot ( pickupid ) ] +new propPickups[MAX_PROPERTIES] = {-1}; + +// [ Handles for 3D text displayed at property entrances ] +new Text3D:propTextInfo[MAX_PROPERTIES]; + +// [ Mass array of all the properties and info about them ] +new properties[MAX_PROPERTIES][E_PROPERTIES]; + +// [ The last pickup the player went through so they can do /enter command ] +new lastPickup[MAX_PLAYERS] = {-1}; + +// [ Current property Unique Interior the player is in.. defaults to -1 when not in any property ] +new currentInt[MAX_PLAYERS] = {-1}; + +// [ Player Position array to store the last place the player was before /view command so they can be teleported back ] +new Float:plPos[MAX_PLAYERS][3]; + +// [ Players actual interior id used for /view /return command ] +new plInt[MAX_PLAYERS]; + +// [ Array of property type iconid's and strings for property type ] +new propIcons[MAX_TYPES][E_P_TYPES] = { + { 0, "" }, // TYPE_EMPTY ( not used ) + { 1273, "House" }, // TYPE_HOUSE green house icon + { 1272, "Business" }, // TYPE_BUSINESS blue house icon + { 1274, "Bank" }, // TYPE_BANK dollar sign icon + { 1247, "Police Station" } // TYPE_COP Bribe Star 1247 + }; + +new propFile[MAX_TYPES][64] = { + { "blank" }, + { "properties/houses.txt" }, + { "properties/businesses.txt" }, + { "properties/banks.txt" }, + { "properties/police.txt" } + }; + +// Keep track of what properties we've sent an /enter notification for +new gLastPropertyEnterNotification[MAX_PLAYERS]; + + +/******************************** +* Interior Info Functions * +********************************/ +stock Float:GetInteriorExit( id, &Float:x, &Float:y, &Float:z ){ + if( id > MAX_INTERIORS ) return 0.0; + else { + x = interiorInfo[id][inExitX]; + y = interiorInfo[id][inExitY]; + z = interiorInfo[id][inExitZ]; + return interiorInfo[id][inExitA]; + } +} + +// Gets interior exit info from uniq Interior Id. Returns InteriorId or -1 if interior doesn't exist +stock GetInteriorExitInfo( uniqIntId, &Float:exitX, &Float:exitY, &Float:exitZ, &Float:exitA ){ + if( uniqIntId < MAX_INTERIORS ){ + exitX = interiorInfo[uniqIntId][inExitX]; + exitY = interiorInfo[uniqIntId][inExitY]; + exitZ = interiorInfo[uniqIntId][inExitZ]; + exitA = interiorInfo[uniqIntId][inExitA]; + return interiorInfo[uniqIntId][inIntID]; + } + return -1; +} + + +stock GetInteriorIntID( id ){ // Gets the interior id of a uniq Interior Id :S + if( id > MAX_INTERIORS ) return -1; + else return interiorInfo[id][inIntID]; +} + +stock GetInteriorName( id ) +{ + new tmp[64]; + if( id > MAX_PROPERTIES ) return tmp; + + else { + format( tmp, 64, "%s", interiorInfo[id][inName] ); + return tmp; + } +} + +/******************************************************** +********************************************************/ + + +/******************************** +* Property Functions * +********************************/ + +stock Float:GetPropertyEntrance( id, &Float:x, &Float:y, &Float:z ){ + if( id > MAX_PROPERTIES ) return 0.0; + x = properties[id][eEntX]; + y = properties[id][eEntY]; + z = properties[id][eEntZ]; + return properties[id][eEntA]; +} + +stock Float:GetPropertyExit( id, &Float:x, &Float:y, &Float:z ){ + if( id > MAX_PROPERTIES ) return 0.0; + return GetInteriorExit( properties[id][eUniqIntId], x, y, z ); +} + +stock GetPropertyInteriorFileId( id ){ + if( id > MAX_PROPERTIES ) return 0; + else return properties[id][eUniqIntId]; +} + +stock GetPropertyInteriorId( id ){ + if( id > MAX_PROPERTIES ) return 0; + else return GetInteriorIntID( properties[id][eUniqIntId] ); +} + +stock GetPropertyType( id ){ + if( id > MAX_PROPERTIES ) return 0; + else return properties[id][eType]; +} + +stock GetPropertyOwner( id ){ + if( id > MAX_PROPERTIES ) return -1; + else return properties[id][eOwner]; +} + +stock GetPropertyPrice( id ){ + if( id > MAX_PROPERTIES ) return -1; + else return properties[id][ePrice]; +} + +stock GetPropertyName( id ){ + new tmp[64]; + if( id > MAX_PROPERTIES ) return tmp; + else { + format( tmp, 64, "%s", properties[id][ePname] ); + return tmp; + } +} + +/******************************************************** +********************************************************/ + +/******************************** +* Database Functions * +********************************/ + +stock Float:dbGetPropertyEntrance( database[], uniqId, &Float:x, &Float:y, &Float:z ){ + new + DB:prop, + DBResult:query_result, + query[128], + num; + + prop = db_open( database ); + format( query, 128,"SELECT entX, entY, enZ, entA FROM properties WHERE id = %d LIMIT 1", uniqId ); + + query_result = db_query( prop, query ); + num = db_num_rows(query_result); + if(!num) return -1.0; + + else { + db_get_field_assoc( query_result, "entX", query, 128 ); + x = floatstr( query ); + db_get_field_assoc( query_result, "entY", query, 128 ); + y = floatstr( query ); + db_get_field_assoc( query_result, "entZ", query, 128 ); + z = floatstr( query ); + db_get_field_assoc( query_result, "entA", query, 128 ); + return floatstr( query ); + } +} + +stock dbSetPropertyOwner( database[], uniqId, ownerId ){ +} + +stock dbSetPropertyPrice( database[], uniqId, price ){ +} + +stock dbDeleteProperty( database[], uniqId ){ +} + +stock dbCreateProperty( database[], uniqId, Float:entX, Float:entY, Float:entZ, Float:entA ){ // remember to add rest of params +} + +stock dbLoadProperties( database[] ) +{ + new + DB:prop, + DBResult:query_result, + query[128], + num, + i; + + prop = db_open( database ); + format( query, 128,"SELECT * FROM properties", uniqId ); + + query_result = db_query( prop, query ); + num = db_num_rows(query_result); + if(!num) return 0; + else { + while( i < num ){ + db_get_field_assoc( query_result, "entX", query, 128 ); + x = floatstr( query ); + db_get_field_assoc( query_result, "entX", query, 128 ); + x = floatstr( query ); + db_get_field_assoc( query_result, "entY", query, 128 ); + y = floatstr( query ); + db_get_field_assoc( query_result, "entZ", query, 128 ); + z = floatstr( query ); + db_get_field_assoc( query_result, "entA", query, 128 ); + i++; + } + } + +} +/******************************************************** +********************************************************/ + +/********************************* +* Property System Functions * +*********************************/ + +ReadInteriorInfo( fileName[] ) +{ + new + File:file_ptr, + buf[256], + tmp[64], + idx, + uniqId; + + + file_ptr = fopen( fileName, io_read ); + if( file_ptr ){ + while( fread( file_ptr, buf, 256 ) > 0){ + idx = 0; + + idx = token_by_delim( buf, tmp, ' ', idx ); + if(idx == (-1)) continue; + uniqId = strval( tmp ); + + if( uniqId >= MAX_INTERIORS ) return 0; + + idx = token_by_delim( buf, tmp, ' ', idx+1 ); + if(idx == (-1)) continue; + interiorInfo[uniqId][inIntID] = strval( tmp ); + + idx = token_by_delim( buf, tmp, ' ', idx+1 ); + if(idx == (-1)) continue; + interiorInfo[uniqId][inExitX] = floatstr( tmp ); + + idx = token_by_delim( buf, tmp, ' ', idx+1 ); + if(idx == (-1)) continue; + interiorInfo[uniqId][inExitY] = floatstr( tmp ); + + idx = token_by_delim( buf, tmp, ' ', idx+1); + if(idx == (-1)) continue; + interiorInfo[uniqId][inExitZ] = floatstr( tmp ); + + idx = token_by_delim( buf, tmp, ' ', idx+1 ); + if(idx == (-1)) continue; + interiorInfo[uniqId][inExitA] = floatstr( tmp ); + + idx = token_by_delim( buf, interiorInfo[uniqId][inName], ';', idx+1 ); + if(idx == (-1)) continue; + + /* + printf( "ReadInteriorInfo(%d, %d, %f, %f, %f, %f ( %s ))", + uniqId, + interiorInfo[uniqId][inIntID], + interiorInfo[uniqId][inExitX], + interiorInfo[uniqId][inExitY], + interiorInfo[uniqId][inExitZ], + interiorInfo[uniqId][inExitA], + interiorInfo[uniqId][inName] );*/ + + } + //printf( "Interiors File read successfully" ); + fclose( file_ptr ); + return 1; + } + printf( "Could Not Read Interiors file ( %s )", fileName ); + return 0; +} + +ReadPropertyFile( fileName[] ) +{ + new File:file_ptr, + tmp[128], + buf[256], + idx, + Float:enX, + Float:enY, + Float:enZ, + Float:enA, + uniqIntId, + p_type, + pIcon; + + printf("Reading File: %s",fileName); + + file_ptr = fopen( fileName, io_read ); + + if(!file_ptr )return 0; + + while( fread( file_ptr, buf, 256 ) > 0){ + idx = 0; + + idx = token_by_delim( buf, tmp, ',', idx ); + if(idx == (-1)) continue; + pIcon = strval( tmp ); + + idx = token_by_delim( buf, tmp, ',', idx+1 ); + if(idx == (-1)) continue; + enX = floatstr( tmp ); + + idx = token_by_delim( buf, tmp, ',', idx+1 ); + if(idx == (-1)) continue; + enY = floatstr( tmp ); + + idx = token_by_delim( buf, tmp, ',', idx+1 ); + if(idx == (-1)) continue; + enZ = floatstr( tmp ); + + idx = token_by_delim( buf, tmp, ',', idx+1 ); + if(idx == (-1)) continue; + enA = floatstr( tmp ); + + idx = token_by_delim( buf, tmp, ',', idx+1 ); + if(idx == (-1)) continue; + uniqIntId = strval( tmp ); + + idx = token_by_delim( buf, tmp, ';', idx+1 ); + if(idx == (-1)) continue; + p_type = strval( tmp ); + + CreateProperty( uniqIntId, pIcon, enX, enY, enZ, enA, p_type ); + } + fclose( file_ptr ); + return 1; +} + +PutPlayerInProperty( playerid, propId, propVW = 0 ) +{ + new Float:x, Float:y, Float:z, Float:a; + new intFileId; + + a = GetPropertyExit( propId, x, y, z ); + SetPlayerPos( playerid, x, y, z ); + SetPlayerFacingAngle( playerid, a ); + SetPlayerInterior( playerid, GetPropertyInteriorId( propId )); + SetPlayerVirtualWorld( playerid, (propVW==0)? propId+PROP_VW:propVW ); + intFileId = GetPropertyInteriorFileId(propId); + currentInt[playerid] = propId; + + //new dbgstring[128]; + //format(dbgstring,sizeof(dbgstring),"PutPlayerInProperty(%d): FileInt=%d",propId,intFileId); + //SendClientMessage(playerid,0xFFFFFFFF,dbgstring); + + // the following will make the client shop scripts run if we tell it + // the name of the shop. + if(intFileId == 22) { + SetPlayerShopName(playerid,"FDPIZA"); + } + else if(intFileId == 47) { + SetPlayerShopName(playerid,"FDBURG"); + } + else if(intFileId == 130) { + SetPlayerShopName(playerid,"FDCHICK"); + } + else if(intFileId == 32) { + SetPlayerShopName(playerid,"AMMUN1"); + } + else if(intFileId == 96) { + SetPlayerShopName(playerid,"AMMUN2"); + } + else if(intFileId == 122) { + SetPlayerShopName(playerid,"AMMUN3"); + } + else if(intFileId == 123) { + SetPlayerShopName(playerid,"AMMUN5"); + } + +} + +// Adds new property to property file +AddProperty( uniqIntId, Float:entX, Float:entY, Float:entZ, Float:entA, p_type, comment[]="" ) +{ + new + Float:exitX, + Float:exitY, + Float:exitZ, + Float:exitA, + interiorId, + File:file_ptr, + tmp[128]; + + interiorId = GetInteriorExitInfo( uniqIntId, exitX, exitY, exitZ, exitA ); + + if( interiorId != -1 ){ + file_ptr = fopen( propFile[p_type], io_append ); + if(file_ptr){ + format( tmp, 128, "%d, %f, %f, %f, %f, %d, %d ; //%s\r\n", propIcons[p_type][tIcon],entX, entY, entZ, entA, uniqIntId, p_type, comment ); + + fwrite( file_ptr, tmp ); + fclose( file_ptr ); + printf( "PropDB - %s", tmp ); + return CreateProperty( uniqIntId, propIcons[p_type][tIcon], entX, entY, entZ, entA, p_type ); + } + } + return -1; +} + +CreateProperty( uniqIntId, iconId, Float:entX, Float:entY, Float:entZ, Float:entA, p_type, name[64]="", owner=-1, price=0 ) +{ + if( (unid+1) < MAX_PROPERTIES ){ + new Id = CreatePickup( iconId ,23, entX, entY, entZ, 0 ); + //printf( "CreateProperty(%d, %d, %f, %f, %f, %f, %d)", uniqIntId, iconId, entX, entY, entZ, entA, p_type ); + propPickups[Id] = unid; + properties[unid][eEntX] = entX; + properties[unid][eEntY] = entY; + properties[unid][eEntZ] = entZ; + properties[unid][eEntA] = entA; + properties[unid][eUniqIntId] = uniqIntId; + properties[unid][eOwner] = owner; + properties[unid][ePrice] = price; + properties[unid][eType] = p_type; + format( properties[unid][ePname], 64, "%s", name ); + + new text_info[256]; + + propTextInfo[unid] = Text3D:INVALID_3DTEXT_ID; + + if(p_type == TYPE_HOUSE) { + format(text_info,256,"{FFFFFF}[{88EE88}House{FFFFFF}]"); + propTextInfo[unid] = Create3DTextLabel(text_info,0x88EE88FF,entX,entY,entZ+0.75,20.0,0,1); + } + else if(p_type == TYPE_BUSINESS) { + format(text_info,256,"{FFFFFF}[{AAAAFF}Business{FFFFFF}]"); + propTextInfo[unid] = Create3DTextLabel(text_info,0xAAAAFFFF,entX,entY,entZ+0.75,20.0,0,1); + } + else if(p_type == TYPE_BANK) { + format(text_info,256,"{FFFFFF}[{EEEE88}Bank{FFFFFF}]"); + propTextInfo[unid] = Create3DTextLabel(text_info,0xEEEE88FF,entX,entY,entZ+0.75,20.0,0,1); + } + else if(p_type == TYPE_COP) { + format(text_info,256,"{FFFFFF}[{EEEE88}Police Station{FFFFFF}]"); + propTextInfo[unid] = Create3DTextLabel(text_info,0xEEEE88FF,entX,entY,entZ+0.75,20.0,0,1); + } + + return unid++; + } + else print( "Property Limit Reached" ); + return -1; +} + +PropertyCommand( playerid, cmd[],cmdtext[],idx, p_type ) +{ + new + Float:x, + Float:y, + Float:z, + Float:a, + tmp[256], + string[128], + uniqId, + id; + + if( GetPlayerInterior(playerid) != 0 || GetPlayerVirtualWorld(playerid)!= 0 ){ + SendClientMessage(playerid, 0x550000FF, "You can only create properties in Interior 0 and VW 0" ); + return 1; + } + + GetPlayerPos( playerid, x, y, z ); + GetPlayerFacingAngle( playerid, a ); + + tmp = strtok( cmdtext, idx ); + if(!strlen(tmp)){ + format( string, 128, "Usage: %s [uniqInteriorId] [optional-comment]", cmd ); + SendClientMessage( playerid, 0xFF00CC, string ); + return 1; + } + if(!isNumeric(tmp)){ + SendClientMessage(playerid, 0x550000, "Uniq Interior Id must be a number" ); + return 1; + } + uniqId = strval( tmp ); + + if( uniqId > MAX_INTERIORS || uniqId < 0 ){ + SendClientMessage( playerid, 0xFFFFCC, "Invalid Uniq Interior Id" ); + return 1; + } + + idx = token_by_delim( cmdtext, tmp, '\0', idx ); + if(idx){ + id = AddProperty( uniqId, x, y, z, a, p_type, tmp ); + } + + else { + id = AddProperty( uniqId, x, y, z, a, p_type ); + } + + if( id != -1 ){ + format( tmp, 256, "Property Type ( %d ) Added Successfully: UniqId: %d Interior: %d IntName: %s",p_type, id, interiorInfo[uniqId][inIntID], interiorInfo[uniqId][inName] ); + SendClientMessage( playerid, 0xCC7700, tmp ); + }else{ + SendClientMessage( playerid, 0x00FF55, "Error: Something went wrong/Property Limit Reached" ); + } + return 1; +} + +LoadProperties() +{ + if( properties[0][eType] != TYPE_EMPTY ){ + UnloadProperties(); + } + unid = 0; + for( new i = 0; i < MAX_PROPERTIES; i++ ){ + properties[i][eType] = TYPE_EMPTY; + } + + ReadInteriorInfo( "properties/interiors.txt" ); + + for( new i = 0; i < MAX_TYPES; i++ ){ + ReadPropertyFile( propFile[i] ); + } + return 1; +} + +UnloadProperties() +{ + new + p; + for( new i = 0; i < MAX_PROPERTIES; i++ ){ + if( propPickups[i] != -1 ){ + DestroyPickup( i ); + p = propPickups[i]; + propPickups[i] = -1; + properties[p][eInterior] = -1; + properties[p][eType] = TYPE_EMPTY; + properties[p][eOwner] = -1; + properties[p][ePrice] = 0; + properties[p][ePname][0] = '\0'; + } + } +} + +/******************************************************** +********************************************************/ + + +/************************************ +* Callbacks * +************************************/ + + +public OnFilterScriptInit() +{ + print("\n-----------------------------------"); + print("Grand Larceny Property Filterscript "); + print("-----------------------------------\n"); + return 1; +} + +public OnFilterScriptExit() +{ + UnloadProperties(); + return 1; +} + +public OnGameModeInit() +{ + LoadProperties(); + return 1; +} + +public OnGameModeExit() +{ + UnloadProperties(); + return 1; +} + +public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) +{ + if( newinteriorid == 0 ){ + currentInt[playerid] = -1; + SetPlayerVirtualWorld( playerid, 0 ); + } + return 1; +} + +public OnPlayerSpawn( playerid ) +{ + gLastPropertyEnterNotification[playerid] = -1; + return 1; +} + +public OnPlayerPickUpPickup(playerid, pickupid) +{ + //printf( "DEBUG: Player %d pickedup Pickup %d Prop Id %d", playerid, pickupid ); + lastPickup[playerid] = pickupid; + new id = propPickups[pickupid]; + new pmsg[256]; + + if( properties[id][eType] > 0 ){ + + if(gLastPropertyEnterNotification[playerid] != id){ + gLastPropertyEnterNotification[playerid] = id; + switch( properties[id][eType] ){ + case TYPE_HOUSE:{ + format(pmsg,256,"* House: type /enter to enter"); + SendClientMessage( playerid, 0xFF55BBFF, pmsg ); + return 1; + } + + case TYPE_BUSINESS:{ + format(pmsg,256,"* Business: type /enter to enter"); + SendClientMessage( playerid, 0xFF55BBFF, pmsg ); + return 1; + } + + case TYPE_BANK:{ + format(pmsg,256,"* Bank: type /enter to enter"); + SendClientMessage( playerid, 0xFF55BBFF, pmsg ); + return 1; + } + + case TYPE_COP:{ + format(pmsg,256,"* Police Station: type /enter to enter"); + SendClientMessage( playerid, 0xFF55BBFF, pmsg ); + return 1; + } + } + } + } + else SendClientMessage( playerid, 0xFF9900FF, "This property doesn't exist :S" ); + + return 1; +} + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new idx; + new cmd[256]; + + cmd = strtok(cmdtext, idx); + + // Public commands. + if(strcmp("/enter", cmd, true) == 0) // enter property + { + if( lastPickup[playerid] != -1 || properties[lastPickup[playerid]][eType] > 0 ){ + new + id = propPickups[lastPickup[playerid]], + Float:x, + Float:y, + Float:z; + + GetPropertyEntrance( id, x, y, z ); + if( IsPlayerInRangeOfPoint( playerid, 3.0, x, y, z )){ + PutPlayerInProperty( playerid, id ); + SendClientMessage( playerid, 0x55AADDFF, "* You have entered a property.. type /exit to leave" ); + return 1; + } + } + return 1; + } + else if(strcmp("/exit", cmd, true) == 0) // exit property + { + if( currentInt[playerid] > -1 && GetPlayerInterior(playerid) == GetPropertyInteriorId( currentInt[playerid] )){ + + new id = currentInt[playerid]; + new Float:x; + new Float:y; + new Float:z; + new Float:a; + + // make sure they're near the exit before allowing them to exit. + GetPropertyExit( id, x, y, z ); + if(!IsPlayerInRangeOfPoint(playerid,4.5,x,y,z)) { + SendClientMessage(playerid,0xDDAA55FF,"* You must be near the property exit to /exit"); + return 1; + } + + a = GetPropertyEntrance( id, x, y, z ); + SetPlayerPos( playerid, x, y, z ); + SetPlayerFacingAngle( playerid, a ); + SetPlayerInterior( playerid, 0 ); + SetPlayerVirtualWorld( playerid, 0 ); + } + currentInt[playerid] = -1; + return 1; + } + + // The rest of the commands here are for + // property creation which is admin only. + + if(!IsPlayerAdmin(playerid)) return 0; + + if(strcmp("/chouse", cmd, true) == 0) // creates a house type property + { + PropertyCommand( playerid, cmd, cmdtext,idx, TYPE_HOUSE ); + return 1; + } + else if(strcmp("/cbus", cmd, true) == 0) // creates a business type property + { + PropertyCommand( playerid, cmd, cmdtext,idx, TYPE_BUSINESS ); + return 1; + } + else if(strcmp("/ccop", cmd, true) == 0) // creates a police station property + { + PropertyCommand( playerid, cmd, cmdtext,idx, TYPE_COP ); + return 1; + } + else if(strcmp("/cbank", cmd, true) == 0) // creates a bank type property + { + PropertyCommand( playerid, cmd, cmdtext,idx, TYPE_BANK ); + return 1; + } + else if(strcmp("/view", cmd, true) == 0) //Basically lets you view an interior from the interiors.txt file by id + { + + new + tmp[256], + string[128], + uniqId, + Float:x, + Float:y, + Float:z, + Float:a; + tmp = strtok( cmdtext, idx ); + if(!strlen(tmp)){ + format( string, 128, "Usage: %s [uniqInteriorId]", cmd ); + SendClientMessage( playerid, 0xFF00CC, string ); + + return 1; + } + if(!isNumeric(tmp)){ + SendClientMessage(playerid, 0x550000, "Uniq Interior Id must be a number" ); + return 1; + } + uniqId = strval( tmp ); + + if( uniqId > MAX_INTERIORS || uniqId < 0 ){ + SendClientMessage( playerid, 0xFFFFCC, "Invalid Uniq Interior Id" ); + return 1; + } + if( GetPlayerInterior( playerid ) == 0 ){ + GetPlayerPos( playerid, plPos[playerid][0], plPos[playerid][1], plPos[playerid][2] ); + plInt[playerid] = GetPlayerInterior( playerid ); + } + a = GetInteriorExit( uniqId, x, y, z ); + SetPlayerInterior( playerid, GetInteriorIntID( uniqId ) ); + SetPlayerPos( playerid, x, y, z ); + SetPlayerFacingAngle( playerid, a ); + format( string, 128, "UniqId: %d InteriorId: %d Name: %s | Use /return to go to last position", uniqId,GetInteriorIntID( uniqId ), GetInteriorName( uniqId )); + SendClientMessage( playerid, 0x556600FF, string ); + return 1; + } + else if( strcmp( "/return", cmd, true ) == 0 ) // return from /view command to last position + { + SetPlayerPos( playerid, plPos[playerid][0], plPos[playerid][1], plPos[playerid][2] ); + SetPlayerInterior( playerid, plInt[playerid] ); + return 1; + } + + return 0; +} + +/*********************************************************************** +***********************************************************************/ diff --git a/filterscripts/gl_realtime.amx b/filterscripts/gl_realtime.amx new file mode 100644 index 0000000..0d4d698 Binary files /dev/null and b/filterscripts/gl_realtime.amx differ diff --git a/filterscripts/gl_realtime.pwn b/filterscripts/gl_realtime.pwn new file mode 100644 index 0000000..90cf838 --- /dev/null +++ b/filterscripts/gl_realtime.pwn @@ -0,0 +1,162 @@ +// +// Keeps the in game time synced to the server's time and +// draws the current time on the player's hud using a textdraw/ +// (1 minute = 1 minute real world time) +// +// (c) 2009-2014 SA-MP Team + +#include +#pragma tabsize 0 + +#include "../include/gl_common.inc" + +//-------------------------------------------------- + +// Used to override the time in this script +new worldtime_override = 0; +new worldtime_overridehour = 0; +new worldtime_overridemin = 0; + +new Text:txtTimeDisp; +new hour, minute; +new timestr[32]; + +forward UpdateTimeAndWeather(); + +//-------------------------------------------------- + +new fine_weather_ids[] = {1,2,3,4,5,6,7,12,13,14,15,17,18,24,25,26,27,28,29,30,40}; +new foggy_weather_ids[] = {9,19,20,31,32}; +new wet_weather_ids[] = {8}; + +stock UpdateWorldWeather() +{ + new next_weather_prob = random(100); + if(next_weather_prob < 70) SetWeather(fine_weather_ids[random(sizeof(fine_weather_ids))]); + else if(next_weather_prob < 95) SetWeather(foggy_weather_ids[random(sizeof(foggy_weather_ids))]); + else SetWeather(wet_weather_ids[random(sizeof(wet_weather_ids))]); +} + +//-------------------------------------------------- + +//new last_weather_update=0; + +public UpdateTimeAndWeather() +{ + // Update time + if(!worldtime_override) { + gettime(hour, minute); + } else { + hour = worldtime_overridehour; + minute = worldtime_overridemin; + } + + format(timestr,32,"%02d:%02d",hour,minute); + TextDrawSetString(txtTimeDisp,timestr); + SetWorldTime(hour); + + new x=0; + while(x!=MAX_PLAYERS) { + if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE) { + SetPlayerTime(x,hour,minute); + } + x++; + } + + /* Update weather every hour + if(last_weather_update == 0) { + UpdateWorldWeather(); + } + last_weather_update++; + if(last_weather_update == 60) { + last_weather_update = 0; + }*/ +} + +//-------------------------------------------------- + +public OnGameModeInit() +{ + // Init our text display + txtTimeDisp = TextDrawCreate(605.0,25.0,"00:00"); + TextDrawUseBox(txtTimeDisp, 0); + TextDrawFont(txtTimeDisp, 3); + TextDrawSetShadow(txtTimeDisp,0); // no shadow + TextDrawSetOutline(txtTimeDisp,2); // thickness 1 + TextDrawBackgroundColor(txtTimeDisp,0x000000FF); + TextDrawColor(txtTimeDisp,0xFFFFFFFF); + TextDrawAlignment(txtTimeDisp,3); + TextDrawLetterSize(txtTimeDisp,0.5,1.5); + + UpdateTimeAndWeather(); + SetTimer("UpdateTimeAndWeather",1000 * 60,1); + + return 1; +} + +//-------------------------------------------------- + +public OnPlayerSpawn(playerid) +{ + TextDrawShowForPlayer(playerid,txtTimeDisp); + + // Update time + if(!worldtime_override) { + gettime(hour, minute); + } else { + hour = worldtime_overridehour; + minute = worldtime_overridemin; + } + + SetPlayerTime(playerid,hour,minute); + + return 1; +} + +//-------------------------------------------------- + +public OnPlayerDeath(playerid, killerid, reason) +{ + TextDrawHideForPlayer(playerid,txtTimeDisp); + return 1; +} + +//-------------------------------------------------- + +public OnPlayerConnect(playerid) +{ + gettime(hour, minute); + SetPlayerTime(playerid,hour,minute); + return 1; +} + +//-------------------------------------------------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256+1]; + new idx; + cmd = strtok(cmdtext, idx); + + if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script + + if(strcmp(cmd, "/sethour", true) == 0) { + new tmp[256+1]; + tmp = strtok(cmdtext,idx); + worldtime_override = 1; + worldtime_overridehour = strval(tmp); + UpdateTimeAndWeather(); + return 1; + } + + if(strcmp(cmd, "/setminute", true) == 0) { + new tmp[256+1]; + tmp = strtok(cmdtext,idx); + worldtime_override = 1; + worldtime_overridemin = strval(tmp); + UpdateTimeAndWeather(); + return 1; + } + + return 0; +} diff --git a/filterscripts/http_test.amx b/filterscripts/http_test.amx new file mode 100644 index 0000000..10f8198 Binary files /dev/null and b/filterscripts/http_test.amx differ diff --git a/filterscripts/http_test.pwn b/filterscripts/http_test.pwn new file mode 100644 index 0000000..3b73241 --- /dev/null +++ b/filterscripts/http_test.pwn @@ -0,0 +1,39 @@ +//------------------------------------------------ + +#include +#include + +forward MyHttpResponse(index, response_code, data[]); + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--HTTP Test Loaded.\n"); + return 1; +} + +//------------------------------------------------ + +public MyHttpResponse(index, response_code, data[]) +{ + new showdata[256+1]; + format(showdata, 256, "Index: %d ResponseCode: %d Data: %s", index, response_code, data); + SendClientMessage(index, 0xFFFFFFFF, showdata); +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256+1]; + + if(strcmp("/httptest", cmd, true) == 0) + { + HTTP(playerid, HTTP_GET, "sa-mp.com/return.txt", "", "MyHttpResponse"); + return 1; + } + + return 0; +} +//------------------------------------------------ diff --git a/filterscripts/iradio.amx b/filterscripts/iradio.amx new file mode 100644 index 0000000..21e0d62 Binary files /dev/null and b/filterscripts/iradio.amx differ diff --git a/filterscripts/iradio.pwn b/filterscripts/iradio.pwn new file mode 100644 index 0000000..335ef5e --- /dev/null +++ b/filterscripts/iradio.pwn @@ -0,0 +1,59 @@ +//------------------------------------------------- +// Internet radio example +// (c) 2011 SA-MP Team +//------------------------------------------------- + +#pragma tabsize 0 +#include + +//------------------------------------------------- + +public OnFilterScriptInit() +{ + return 1; +} + +//------------------------------------------------- + +public OnPlayerStateChange(playerid, newstate, oldstate) +{ + // play an internet radio stream when they are in a vehicle + if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) + { + PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls"); + } + // stop the internet stream + else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) + { + StopAudioStreamForPlayer(playerid); + } + return 0; +} + +//------------------------------------------------- + +public OnPlayerUpdate(playerid) +{ + if(!IsPlayerConnected(playerid)) return 0; + if(IsPlayerNPC(playerid)) return 1; + + // Handle playing SomaFM at the alhambra + if(GetPlayerInterior(playerid) == 17) { + if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle + if(!GetPVarInt(playerid,"alhambra")) { + SetPVarInt(playerid,"alhambra",1); + PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0,true); + } + } + } + else { + if(GetPVarInt(playerid,"alhambra")) { + DeletePVar(playerid,"alhambra"); + StopAudioStreamForPlayer(playerid); + } + } + + return 1; +} + +//------------------------------------------------- diff --git a/filterscripts/kylies_barn.amx b/filterscripts/kylies_barn.amx new file mode 100644 index 0000000..1c5fe25 Binary files /dev/null and b/filterscripts/kylies_barn.amx differ diff --git a/filterscripts/kylies_barn.pwn b/filterscripts/kylies_barn.pwn new file mode 100644 index 0000000..f3dc9d7 --- /dev/null +++ b/filterscripts/kylies_barn.pwn @@ -0,0 +1,138 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for Kylie's Barn Object +// -------------------------------------------- +// By Matite in March 2015 +// +// +// This script creates the repaired Kylie's Barn Building object and removes +// the existing GTASA barn object (normally this object has some collision +// bugs that prevent the player from moving about inside it). +// +// Warning... +// This script uses a total of: +// * 1 object = 1 for the replacement barn object +// * Enables the /kb command to teleport the player to Kylie's Barn +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Used for messages sent to the player +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + + +// ----------------------------------------------------------------------------- +// Variables +// --------- + +// Stores the created object number of the replacement barn object so +// it can be destroyed when the filterscript is unloaded +new KyliesBarnObject1; // Barn object + + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/kb", cmdtext, true, 3) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 3); + + // Set player position and facing angle + SetPlayerPos(playerid, 292.03, 309.82, 999.55); + SetPlayerFacingAngle(playerid, 88); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Kylie's Barn!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- Kylie's Barn Filterscript"); + print(" |-- Script v1.01"); + print(" |-- 6th March 2015"); + print(" |---------------------------------------------------"); + + // Create Kylie's Barn repaired object + KyliesBarnObject1 = CreateObject(19881, 286.188, 307.609, 1002.01, 0, 0, 0); + + // Display information in the Server Console + print(" |-- Kylie's Barn object created"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove default GTASA Kylie's Barn object for the player (so any + // player currently ingame does not have to rejoin for them to be + // removed when this filterscript is loaded) + RemoveBuildingForPlayer(i, 14871, 286.188, 307.609, 1002.01, 250.0); // Barn + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Check for valid object + if (IsValidObject(KyliesBarnObject1)) + { + // Destroy the Kylie's Barn object + DestroyObject(KyliesBarnObject1); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Kylie's Barn object destroyed"); + } + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Kylie's Barn Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove default GTASA Kylie's Barn object for the player + RemoveBuildingForPlayer(playerid, 14871, 286.188, 307.609, 1002.01, 250.0); // Barn + + // Exit here (return 1 so this callback is handled in other scripts too) + return 1; +} + diff --git a/filterscripts/ls_apartments1.amx b/filterscripts/ls_apartments1.amx new file mode 100644 index 0000000..0124f1e Binary files /dev/null and b/filterscripts/ls_apartments1.amx differ diff --git a/filterscripts/ls_apartments1.pwn b/filterscripts/ls_apartments1.pwn new file mode 100644 index 0000000..3a82481 --- /dev/null +++ b/filterscripts/ls_apartments1.pwn @@ -0,0 +1,770 @@ +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// Example Filterscript for the new LS Apartments 1 Building with Elevator +// ----------------------------------------------------------------------- +// Original elevator code by Zamaroht in 2010 +// +// Updated by Kye in 2011 +// * Added a sound effect for the elevator starting/stopping +// +// Edited by Matite in January 2015 +// * Added code to remove the existing building, add the new building and +// edited the elevator code so it works in this new building +// +// Updated to v1.02 by Matite in February 2015 +// * Added code for the new car park object and edited the elevator to +// include the car park +// +// This script creates the new LS Apartments 1 building object, removes the +// existing GTASA building object, adds the new car park object and creates +// an elevator that can be used to travel between all levels. +// +// You can un-comment the OnPlayerCommandText callback below to enable a simple +// teleport command (/lsa) that teleports you to the LS Apartments 1 building. +// +// Warning... +// This script uses a total of: +// * 27 objects = 1 for the elevator, 2 for the elevator doors, 22 for the +// elevator floor doors, 1 for the replacement LS Apartments 1 building +// and 1 for the car park +// * 12 3D Text Labels = 11 on the floors and 1 in the elevator +// * 1 dialog (for the elevator - dialog ID 876) +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + +// For PlaySoundForPlayersInRange() +#include "../include/gl_common.inc" + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Movement speed of the elevator +#define ELEVATOR_SPEED (5.0) + +// Movement speed of the doors +#define DOORS_SPEED (5.0) + +// Time in ms that the elevator will wait in each floor before continuing with the queue... +// be sure to give enough time for doors to open +#define ELEVATOR_WAIT_TIME (5000) + +// Dialog ID for the LS Apartments building elevator dialog +#define DIALOG_ID (876) + +// Position defines +#define Y_DOOR_CLOSED (-1180.535917) +#define Y_DOOR_R_OPENED Y_DOOR_CLOSED - 1.6 +#define Y_DOOR_L_OPENED Y_DOOR_CLOSED + 1.6 + +#define GROUND_Z_COORD (20.879316) + +#define ELEVATOR_OFFSET (0.059523) + +#define X_ELEVATOR_POS (1181.622924) +#define Y_ELEVATOR_POS (-1180.554687) + +// Elevator state defines +#define ELEVATOR_STATE_IDLE (0) +#define ELEVATOR_STATE_WAITING (1) +#define ELEVATOR_STATE_MOVING (2) + +// Invalid floor define +#define INVALID_FLOOR (-1) + +// Used for chat text messages +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + +// ----------------------------------------------------------------------------- +// Constants +// --------- + +// Elevator floor names for the 3D text labels +static FloorNames[11][] = +{ + "Car Park", + "Ground Floor", + "First Floor", + "Second Floor", + "Third Floor", + "Fourth Floor", + "Fifth Floor", + "Sixth Floor", + "Seventh Floor", + "Eighth Floor", + "Ninth Floor" +}; + +// Elevator floor Z heights +static Float:FloorZOffsets[11] = +{ + 0.0, // Car Park + 13.604544, // Ground Floor + 18.808519, // First Floor = 13.604544 + 5.203975 + 24.012494, // Second Floor = 18.808519 + 5.203975 + 29.216469, // Third Floor = 24.012494 + 5.203975 + 34.420444, // Fourth Floor = 29.216469 + 5.203975 + 39.624419, // Fifth Floor = 34.420444 + 5.203975 + 44.828394, // Sixth Floor = 39.624419 + 5.203975 + 50.032369, // Seventh Floor = 44.828394 + 5.203975 + 55.236344, // Eighth Floor = 50.032369 + 5.203975 + 60.440319 // Ninth Floor = 55.236344 + 5.203975 +}; + +// ------------------------------------------------------------------------------ +// Variables +// --------- + +// Stores the created object number of the replacement building so it can be +// destroyed when the filterscript is unloaded +new LSApartments1Object; + +// Stores the created object number of the new cark park so it can be +// destroyed when the filterscript is unloaded +new LSApartments1CPObject; + +// Stores the created object numbers of the elevator, the elevator doors and +// the elevator floor doors so they can be destroyed when the filterscript +// is unloaded +new Obj_Elevator, Obj_ElevatorDoors[2], Obj_FloorDoors[11][2]; + +// Stores a reference to the 3D text labels used on each floor and inside the +// elevator itself so they can be detroyed when the filterscript is unloaded +new Text3D:Label_Elevator, Text3D:Label_Floors[11]; + +// Stores the current state of the elevator (ie ELEVATOR_STATE_IDLE, +// ELEVATOR_STATE_WAITING or ELEVATOR_STATE_MOVING) +new ElevatorState; + +// Stores the current floor the elevator is on or heading to... if the value is +// ELEVATOR_STATE_IDLE or ELEVATOR_STATE_WAITING this is the current floor. If +// the value is ELEVATOR_STATE_MOVING then it is the floor it's moving to +new ElevatorFloor; + +// Stores the elevator queue for each floor +new ElevatorQueue[11]; + +// Stores who requested the floor for the elevator queue... +// FloorRequestedBy[floor_id] = playerid; (stores who requested which floor) +new FloorRequestedBy[11]; + +// Used for a timer that makes the elevator move faster after players start +// surfing the object +new ElevatorBoostTimer; + +// ------------------------------------------------------------------------------ +// Function Forwards +// ----------------- + +// Public: +forward CallElevator(playerid, floorid); // You can use INVALID_PLAYER_ID too. +forward ShowElevatorDialog(playerid); + +// Private: +forward Elevator_Initialize(); +forward Elevator_Destroy(); + +forward Elevator_OpenDoors(); +forward Elevator_CloseDoors(); +forward Floor_OpenDoors(floorid); +forward Floor_CloseDoors(floorid); + +forward Elevator_MoveToFloor(floorid); +forward Elevator_Boost(floorid); // Increases the elevator speed until it reaches 'floorid'. +forward Elevator_TurnToIdle(); + +forward ReadNextFloorInQueue(); +forward RemoveFirstQueueFloor(); +forward AddFloorToQueue(floorid); +forward IsFloorInQueue(floorid); +forward ResetElevatorQueue(); + +forward DidPlayerRequestElevator(playerid); + +forward Float:GetElevatorZCoordForFloor(floorid); +forward Float:GetDoorsZCoordForFloor(floorid); + +// ------------------------------------------------------------------------------ +// Callbacks +// --------- + + +// Uncomment the OnPlayerCommandText callback below (remove the "/*" and the "*/") +// to enable a simple teleport command (/lsa) which teleports the player to +// outside the LS Apartments 1 building. + +/* +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/lsa", cmdtext, true, 4) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 0); + + // Set player position and facing angle + SetPlayerPos(playerid, 1131.07 + random(3), -1180.72 + random(2), 33.32); + SetPlayerFacingAngle(playerid, 270); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~LS Apartments 1!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} +*/ + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- LS Apartments 1 Filterscript"); + print(" |-- Script v1.02"); + print(" |-- 5th February 2015"); + print(" |---------------------------------------------------"); + + // Create the LS Apartments 1 Building object + LSApartments1Object = CreateObject(19595, 1160.96, -1180.58, 70.4141, 0, 0, 0); + + // Display information in the Server Console + print(" |-- LS Apartments 1 Building object created"); + + // Create the LS Apartments 1 Car Park object + LSApartments1CPObject = CreateObject(19798, 1160.96, -1180.58, 20.4141, 0, 0, 0); + + // Display information in the Server Console + print(" |-- LS Apartments 1 Car Park object created"); + + // Reset the elevator queue + ResetElevatorQueue(); + + // Create the elevator object, the elevator doors and the floor doors + Elevator_Initialize(); + + // Display information in the Server Console + print(" |-- LS Apartments 1 Elevator created"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove default GTASA building map object, LOD and awning shadows + // (so any player currently ingame does not have to rejoin for them + // to be removed when this filterscript is loaded) + RemoveBuildingForPlayer(i, 5766, 1160.96, -1180.58, 70.4141, 250.0); // Awning shadows + RemoveBuildingForPlayer(i, 5767, 1160.96, -1180.58, 70.4141, 250.0); // Building + RemoveBuildingForPlayer(i, 5964, 1160.96, -1180.58, 70.4141, 250.0); // LOD + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Check for valid object + if (IsValidObject(LSApartments1Object)) + { + // Destroy the LS Apartments 1 Building object + DestroyObject(LSApartments1Object); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- LS Apartments 1 Building object destroyed"); + } + + // Check for valid object + if (IsValidObject(LSApartments1CPObject)) + { + // Destroy the LS Apartments 1 Car Park object + DestroyObject(LSApartments1CPObject); + + // Display information in the Server Console + print(" |-- LS Apartments 1 Car Park object destroyed"); + } + + // Destroy the elevator, the elevator doors and the elevator floor doors + Elevator_Destroy(); + + // Display information in the Server Console + print(" |-- LS Apartments 1 Elevator destroyed"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove default GTASA building map object, LOD and awning shadows + RemoveBuildingForPlayer(playerid, 5766, 1160.96, -1180.58, 70.4141, 250.0); // Awning shadows + RemoveBuildingForPlayer(playerid, 5767, 1160.96, -1180.58, 70.4141, 250.0); // Building + RemoveBuildingForPlayer(playerid, 5964, 1160.96, -1180.58, 70.4141, 250.0); // LOD + + // Exit here + return 1; +} + +public OnObjectMoved(objectid) +{ + // Create variables + new Float:x, Float:y, Float:z; + + // Loop + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + // Check if the object that moved was one of the elevator floor doors + if(objectid == Obj_FloorDoors[i][0]) + { + GetObjectPos(Obj_FloorDoors[i][0], x, y, z); + + // Some floor doors have shut, move the elevator to next floor in queue: + if (y < Y_DOOR_L_OPENED - 0.5) + { + Elevator_MoveToFloor(ElevatorQueue[0]); + RemoveFirstQueueFloor(); + } + } + } + + if(objectid == Obj_Elevator) // The elevator reached the specified floor. + { + KillTimer(ElevatorBoostTimer); // Kills the timer, in case the elevator reached the floor before boost. + + FloorRequestedBy[ElevatorFloor] = INVALID_PLAYER_ID; + + Elevator_OpenDoors(); + Floor_OpenDoors(ElevatorFloor); + + GetObjectPos(Obj_Elevator, x, y, z); + Label_Elevator = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, X_ELEVATOR_POS - 1.7, Y_ELEVATOR_POS - 1.75, z - 0.4, 4.0, 0, 1); + + ElevatorState = ELEVATOR_STATE_WAITING; + SetTimer("Elevator_TurnToIdle", ELEVATOR_WAIT_TIME, 0); + } + + return 1; +} + +public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) +{ + if(dialogid == DIALOG_ID) + { + if(!response) + return 0; + + if(FloorRequestedBy[listitem] != INVALID_PLAYER_ID || IsFloorInQueue(listitem)) + GameTextForPlayer(playerid, "~r~The floor is already in the queue", 3500, 4); + else if(DidPlayerRequestElevator(playerid)) + GameTextForPlayer(playerid, "~r~You already requested the elevator", 3500, 4); + else + CallElevator(playerid, listitem); + + return 1; + } + + return 0; +} + +public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) +{ + // Check if the player is not in a vehicle and pressed the conversation yes key (Y by default) + if (!IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_YES)) + { + // Create variables and get the players current position + new Float:pos[3]; + GetPlayerPos(playerid, pos[0], pos[1], pos[2]); + + // For debug + //printf("X = %0.2f | Y = %0.2f | Z = %0.2f", pos[0], pos[1], pos[2]); + + // Check if the player is using the button inside the elevator + if (pos[1] > (Y_ELEVATOR_POS - 1.8) && pos[1] < (Y_ELEVATOR_POS + 1.8) && pos[0] < (X_ELEVATOR_POS + 1.8) && pos[0] > (X_ELEVATOR_POS - 1.8)) + { + // The player is using the button inside the elevator + // -------------------------------------------------- + + // Show the elevator dialog to the player + ShowElevatorDialog(playerid); + } + else + { + // Check if the player is using the button on one of the floors + if(pos[1] < (Y_ELEVATOR_POS - 1.81) && pos[1] > (Y_ELEVATOR_POS - 3.8) && pos[0] > (X_ELEVATOR_POS - 3.8) && pos[0] < (X_ELEVATOR_POS - 1.81)) + { + // The player is most likely using an elevator floor button... check which floor + // ----------------------------------------------------------------------------- + + // Create variable with the number of floors to check (total floors minus 1) + new i = 10; + + // Loop + while(pos[2] < GetDoorsZCoordForFloor(i) + 3.5 && i > 0) + i --; + + if(i == 0 && pos[2] < GetDoorsZCoordForFloor(0) + 2.0) + i = -1; + + if (i <= 9) + { + // Check if the elevator is not moving (idle or waiting) + if (ElevatorState != ELEVATOR_STATE_MOVING) + { + // Check if the elevator is already on the floor it was called from + if (ElevatorFloor == i + 1) + { + // Display gametext message to the player + GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~y~~h~LS Apartments 1 Elevator Is~n~~y~~h~Already On This Floor...~n~~w~Walk Inside It~n~~w~And Press '~k~~CONVERSATION_YES~'", 3500, 3); + + // Display chat text message to the player + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* The LS Apartments 1 elevator is already on this floor... walk inside it and press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}'"); + + // Exit here (return 1 so this callback is processed in other scripts) + return 1; + } + } + + // Call function to call the elevator to the floor + CallElevator(playerid, i + 1); + + // Display gametext message to the player + GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~g~~h~LS Apartments 1 Elevator~n~~g~~h~Has Been Called...~n~~w~Please Wait", 3000, 3); + + // Create variable for formatted message + new strTempString[100]; + + // Check if the elevator is moving + if (ElevatorState == ELEVATOR_STATE_MOVING) + { + // Format chat text message + format(strTempString, sizeof(strTempString), "* The LS Apartments 1 elevator has been called... it is currently moving towards the %s.", FloorNames[ElevatorFloor]); + } + else + { + // Check if the floor is the car park + if (ElevatorFloor == 0) + { + // Format chat text message + format(strTempString, sizeof(strTempString), "* The LS Apartments 1 elevator has been called... it is currently at the %s.", FloorNames[ElevatorFloor]); + } + else + { + // Format chat text message + format(strTempString, sizeof(strTempString), "* The LS Apartments 1 elevator has been called... it is currently on the %s.", FloorNames[ElevatorFloor]); + } + } + + // Display formatted chat text message to the player + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString); + + // Exit here (return 1 so this callback is processed in other scripts) + return 1; + } + } + } + } + + // Exit here (return 1 so this callback is processed in other scripts) + return 1; +} + +// ------------------------ Functions ------------------------ +stock Elevator_Initialize() +{ + // Create the elevator and elevator door objects + Obj_Elevator = CreateObject(18755, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD + ELEVATOR_OFFSET, 0.000000, 0.000000, 0.000000); + Obj_ElevatorDoors[0] = CreateObject(18757, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD + ELEVATOR_OFFSET, 0.000000, 0.000000, 0.000000); + Obj_ElevatorDoors[1] = CreateObject(18756, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD + ELEVATOR_OFFSET, 0.000000, 0.000000, 0.000000); + + // Create the 3D text label for inside the elevator + Label_Elevator = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, X_ELEVATOR_POS - 1.7, Y_ELEVATOR_POS - 1.75, GROUND_Z_COORD - 0.4, 4.0, 0, 1); + + // Create variables + new string[128], Float:z; + + // Loop + for (new i; i < sizeof(Obj_FloorDoors); i ++) + { + // Create elevator floor door objects + Obj_FloorDoors[i][0] = CreateObject(18757, X_ELEVATOR_POS - 0.245, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(i), 0.000000, 0.000000, 0.000000); + Obj_FloorDoors[i][1] = CreateObject(18756, X_ELEVATOR_POS - 0.245, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(i), 0.000000, 0.000000, 0.000000); + + // Format string for the floor 3D text label + format(string, sizeof(string), "{CCCCCC}[%s]\n{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to call", FloorNames[i]); + + // Get label Z position + z = GetDoorsZCoordForFloor(i); + + // Create floor label + Label_Floors[i] = Create3DTextLabel(string, 0xCCCCCCAA, X_ELEVATOR_POS - 2.5, Y_ELEVATOR_POS - 2.5, z - 0.2, 10.5, 0, 1); + } + + // Open the car park floor doors and the elevator doors + Floor_OpenDoors(0); + Elevator_OpenDoors(); + + // Exit here + return 1; +} + +stock Elevator_Destroy() +{ + // Destroys the elevator. + + DestroyObject(Obj_Elevator); + DestroyObject(Obj_ElevatorDoors[0]); + DestroyObject(Obj_ElevatorDoors[1]); + Delete3DTextLabel(Label_Elevator); + + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + DestroyObject(Obj_FloorDoors[i][0]); + DestroyObject(Obj_FloorDoors[i][1]); + Delete3DTextLabel(Label_Floors[i]); + } + + return 1; +} + +stock Elevator_OpenDoors() +{ + // Opens the elevator's doors. + + new Float:x, Float:y, Float:z; + + GetObjectPos(Obj_ElevatorDoors[0], x, y, z); + MoveObject(Obj_ElevatorDoors[0], x, Y_DOOR_L_OPENED, z, DOORS_SPEED); + MoveObject(Obj_ElevatorDoors[1], x, Y_DOOR_R_OPENED, z, DOORS_SPEED); + + return 1; +} + +stock Elevator_CloseDoors() +{ + // Closes the elevator's doors. + + if(ElevatorState == ELEVATOR_STATE_MOVING) + return 0; + + new Float:x, Float:y, Float:z; + + GetObjectPos(Obj_ElevatorDoors[0], x, y, z); + MoveObject(Obj_ElevatorDoors[0], x, Y_DOOR_CLOSED, z, DOORS_SPEED); + MoveObject(Obj_ElevatorDoors[1], x, Y_DOOR_CLOSED, z, DOORS_SPEED); + + return 1; +} + +stock Floor_OpenDoors(floorid) +{ + // Opens the doors at the specified floor. + + MoveObject(Obj_FloorDoors[floorid][0], X_ELEVATOR_POS - 0.245, Y_DOOR_L_OPENED, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + MoveObject(Obj_FloorDoors[floorid][1], X_ELEVATOR_POS - 0.245, Y_DOOR_R_OPENED, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + + PlaySoundForPlayersInRange(6401, 50.0, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid) + 5.0); + + return 1; +} + +stock Floor_CloseDoors(floorid) +{ + // Closes the doors at the specified floor. + + MoveObject(Obj_FloorDoors[floorid][0], X_ELEVATOR_POS - 0.245, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + MoveObject(Obj_FloorDoors[floorid][1], X_ELEVATOR_POS - 0.245, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + + PlaySoundForPlayersInRange(6401, 50.0, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid) + 5.0); + + return 1; +} + +stock Elevator_MoveToFloor(floorid) +{ + // Moves the elevator to specified floor (doors are meant to be already closed). + + ElevatorState = ELEVATOR_STATE_MOVING; + ElevatorFloor = floorid; + + // Move the elevator slowly, to give time to clients to sync the object surfing. Then, boost it up: + MoveObject(Obj_Elevator, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetElevatorZCoordForFloor(floorid), 0.25); + MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), 0.25); + MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), 0.25); + Delete3DTextLabel(Label_Elevator); + + ElevatorBoostTimer = SetTimerEx("Elevator_Boost", 2000, 0, "i", floorid); + + return 1; +} + +public Elevator_Boost(floorid) +{ + // Increases the elevator's speed until it reaches 'floorid' + StopObject(Obj_Elevator); + StopObject(Obj_ElevatorDoors[0]); + StopObject(Obj_ElevatorDoors[1]); + + MoveObject(Obj_Elevator, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetElevatorZCoordForFloor(floorid), ELEVATOR_SPEED); + MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED); + + return 1; +} + +public Elevator_TurnToIdle() +{ + ElevatorState = ELEVATOR_STATE_IDLE; + ReadNextFloorInQueue(); + + return 1; +} + +stock RemoveFirstQueueFloor() +{ + // Removes the data in ElevatorQueue[0], and reorders the queue accordingly. + + for(new i; i < sizeof(ElevatorQueue) - 1; i ++) + ElevatorQueue[i] = ElevatorQueue[i + 1]; + + ElevatorQueue[sizeof(ElevatorQueue) - 1] = INVALID_FLOOR; + + return 1; +} + +stock AddFloorToQueue(floorid) +{ + // Adds 'floorid' at the end of the queue. + + // Scan for the first empty space: + new slot = -1; + for(new i; i < sizeof(ElevatorQueue); i ++) + { + if(ElevatorQueue[i] == INVALID_FLOOR) + { + slot = i; + break; + } + } + + if(slot != -1) + { + ElevatorQueue[slot] = floorid; + + // If needed, move the elevator. + if(ElevatorState == ELEVATOR_STATE_IDLE) + ReadNextFloorInQueue(); + + return 1; + } + + return 0; +} + +stock ResetElevatorQueue() +{ + // Resets the queue. + + for(new i; i < sizeof(ElevatorQueue); i ++) + { + ElevatorQueue[i] = INVALID_FLOOR; + FloorRequestedBy[i] = INVALID_PLAYER_ID; + } + + return 1; +} + +stock IsFloorInQueue(floorid) +{ + // Checks if the specified floor is currently part of the queue. + + for(new i; i < sizeof(ElevatorQueue); i ++) + if(ElevatorQueue[i] == floorid) + return 1; + + return 0; +} + +stock ReadNextFloorInQueue() +{ + // Reads the next floor in the queue, closes doors, and goes to it. + + if(ElevatorState != ELEVATOR_STATE_IDLE || ElevatorQueue[0] == INVALID_FLOOR) + return 0; + + Elevator_CloseDoors(); + Floor_CloseDoors(ElevatorFloor); + + return 1; +} + +stock DidPlayerRequestElevator(playerid) +{ + for(new i; i < sizeof(FloorRequestedBy); i ++) + if(FloorRequestedBy[i] == playerid) + return 1; + + return 0; +} + +stock ShowElevatorDialog(playerid) +{ + new string[512]; + for(new i; i < sizeof(ElevatorQueue); i ++) + { + if(FloorRequestedBy[i] != INVALID_PLAYER_ID) + strcat(string, "{FF0000}"); + + strcat(string, FloorNames[i]); + strcat(string, "\n"); + } + + ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "LS Apartments 1 Elevator...", string, "Accept", "Cancel"); + + return 1; +} + +stock CallElevator(playerid, floorid) +{ + // Calls the elevator (also used with the elevator dialog). + + if(FloorRequestedBy[floorid] != INVALID_PLAYER_ID || IsFloorInQueue(floorid)) + return 0; + + FloorRequestedBy[floorid] = playerid; + AddFloorToQueue(floorid); + + return 1; +} + +stock Float:GetElevatorZCoordForFloor(floorid) +{ + // Return Z height value plus a small offset + return (GROUND_Z_COORD + FloorZOffsets[floorid] + ELEVATOR_OFFSET); +} + +stock Float:GetDoorsZCoordForFloor(floorid) +{ + // Return Z height value plus a small offset + return (GROUND_Z_COORD + FloorZOffsets[floorid] + ELEVATOR_OFFSET); +} + diff --git a/filterscripts/ls_beachside.amx b/filterscripts/ls_beachside.amx new file mode 100644 index 0000000..2b1f723 Binary files /dev/null and b/filterscripts/ls_beachside.amx differ diff --git a/filterscripts/ls_beachside.pwn b/filterscripts/ls_beachside.pwn new file mode 100644 index 0000000..fdea43a --- /dev/null +++ b/filterscripts/ls_beachside.pwn @@ -0,0 +1,743 @@ +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// Example Filterscript for the new LS BeachSide Building with Elevator +// -------------------------------------------------------------------- +// Original elevator code by Zamaroht in 2010 +// +// Updated by Kye in 2011 +// * Added a sound effect for the elevator starting/stopping +// +// Edited by Matite in January 2015 +// * Adapted the elevator code so it works in this new building and removed the +// light pole at the underground car park entrance +// +// Updated to v1.03 by Matite in April 2015 +// * Removed the code that removes the existing building map object and the lines +// that create the new objects as the original building is now replaced with +// the new one by SAMP instead (same as the LS Office building) +// +// Updated to v1.02 by Matite in February 2015 +// * Added code for the new car park object and edited the elevator to +// include the car park +// +// This script creates the new LS BeachSide building object, removes the +// existing GTASA building object, adds the new car park object and creates +// an elevator that can be used to travel between all levels. +// +// You can un-comment the OnPlayerCommandText callback below to enable a simple +// teleport command (/lsb) that teleports you to the LS BeachSide building. +// +// Warning... +// This script uses a total of: +// * 31 objects = 1 for the elevator, 2 for the elevator doors and 28 for the +// elevator floor doors +// * 15 3D Text Labels = 14 on the floors and 1 in the elevator +// * 1 dialog (for the elevator - dialog ID 877) +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + +// For PlaySoundForPlayersInRange() +#include "../include/gl_common.inc" + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Movement speed of the elevator +#define ELEVATOR_SPEED (5.0) + +// Movement speed of the doors +#define DOORS_SPEED (5.0) + +// Time in ms that the elevator will wait in each floor before continuing with the queue... +// be sure to give enough time for doors to open +#define ELEVATOR_WAIT_TIME (5000) + +// Dialog ID for the LS BeachSide elevator dialog +#define DIALOG_ID (877) + +// Position defines +#define X_DOOR_R_OPENED (289.542419) +#define X_DOOR_L_OPENED (286.342407) +#define Y_DOOR_R_OPENED (-1609.640991) +#define Y_DOOR_L_OPENED (-1609.076049) + +#define X_FDOOR_R_OPENED (289.492431) +#define X_FDOOR_L_OPENED (286.292419) +#define Y_FDOOR_R_OPENED (-1609.870971) +#define Y_FDOOR_L_OPENED (-1609.306030) + +#define GROUND_Z_COORD (18.755348) // (33.825077) +#define X_ELEVATOR_POS (287.942413) +#define Y_ELEVATOR_POS (-1609.341064) + +// Elevator state defines +#define ELEVATOR_STATE_IDLE (0) +#define ELEVATOR_STATE_WAITING (1) +#define ELEVATOR_STATE_MOVING (2) + +// Invalid floor define +#define INVALID_FLOOR (-1) + +// Used for chat text messages +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + +// ----------------------------------------------------------------------------- +// Constants +// --------- + +// Elevator floor names for the 3D text labels +static FloorNames[14][] = +{ + "Car Park", + "Ground Floor", + "First Floor", + "Second Floor", + "Third Floor", + "Fourth Floor", + "Fifth Floor", + "Sixth Floor", + "Seventh Floor", + "Eighth Floor", + "Ninth Floor", + "Tenth Floor", + "Eleventh Floor", + "Twelfth Floor" +}; + +// Elevator floor Z heights +static Float:FloorZOffsets[14] = +{ + 0.0, // Car Park + 15.069729, // Ground Floor + 29.130733, // First Floor + 33.630733, // Second Floor = 29.130733 + 4.5 + 38.130733, // Third Floor = 33.630733 + 4.5 + 42.630733, // Fourth Floor = 38.130733 + 4.5 + 47.130733, // Fifth Floor = 42.630733 + 4.5 + 51.630733, // Sixth Floor = 47.130733 + 4.5 + 56.130733, // Seventh Floor = 51.630733 + 4.5 + 60.630733, // Eighth Floor = 56.130733 + 4.5 + 65.130733, // Ninth Floor = 60.630733 + 4.5 + 69.630733, // Tenth Floor = 65.130733 + 4.5 + 74.130733, // Eleventh Floor = 69.630733 + 4.5 + 78.630733, // Twelfth Floor = 74.130733 + 4.5 +}; + +// ----------------------------------------------------------------------------- +// Variables +// --------- + +// Stores the created object numbers of the elevator, the elevator doors and +// the elevator floor doors so they can be destroyed when the filterscript +// is unloaded +new Obj_Elevator, Obj_ElevatorDoors[2], Obj_FloorDoors[14][2]; + +// Stores a reference to the 3D text labels used on each floor and inside the +// elevator itself so they can be detroyed when the filterscript is unloaded +new Text3D:Label_Elevator, Text3D:Label_Floors[14]; + +// Stores the current state of the elevator (ie ELEVATOR_STATE_IDLE, +// ELEVATOR_STATE_WAITING or ELEVATOR_STATE_MOVING) +new ElevatorState; + +// Stores the current floor the elevator is on or heading to... if the value is +// ELEVATOR_STATE_IDLE or ELEVATOR_STATE_WAITING this is the current floor. If +// the value is ELEVATOR_STATE_MOVING then it is the floor it's moving to +new ElevatorFloor; + +// Stores the elevator queue for each floor +new ElevatorQueue[14]; + +// Stores who requested the floor for the elevator queue... +// FloorRequestedBy[floor_id] = playerid; (stores who requested which floor) +new FloorRequestedBy[14]; + +// Used for a timer that makes the elevator move faster after players start +// surfing the object +new ElevatorBoostTimer; + +// ----------------------------------------------------------------------------- +// Function Forwards +// ----------------- + +// Public: +forward CallElevator(playerid, floorid); // You can use INVALID_PLAYER_ID too. +forward ShowElevatorDialog(playerid); + +// Private: +forward Elevator_Initialize(); +forward Elevator_Destroy(); + +forward Elevator_OpenDoors(); +forward Elevator_CloseDoors(); +forward Floor_OpenDoors(floorid); +forward Floor_CloseDoors(floorid); + +forward Elevator_MoveToFloor(floorid); +forward Elevator_Boost(floorid); // Increases the elevator speed until it reaches 'floorid'. +forward Elevator_TurnToIdle(); + +forward ReadNextFloorInQueue(); +forward RemoveFirstQueueFloor(); +forward AddFloorToQueue(floorid); +forward IsFloorInQueue(floorid); +forward ResetElevatorQueue(); + +forward DidPlayerRequestElevator(playerid); + +forward Float:GetElevatorZCoordForFloor(floorid); +forward Float:GetDoorsZCoordForFloor(floorid); + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +// Un-comment the OnPlayerCommandText callback below (remove the "/*" and the "*/") +// to enable a simple teleport command (/lsb) which teleports the player to +// outside the LS BeachSide building. + +/* +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/lsb", cmdtext, true, 4) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 0); + + // Set player position and facing angle + SetPlayerPos(playerid, 289.81 + random(2), -1630.65 + random(2), 34.32); + SetPlayerFacingAngle(playerid, 10); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~LS BeachSide!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} +*/ + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- LS BeachSide Filterscript"); + print(" |-- Script v1.03"); + print(" |-- 19th April 2015"); + print(" |---------------------------------------------------"); + + // Reset the elevator queue + ResetElevatorQueue(); + + // Create the elevator object, the elevator doors and the floor doors + Elevator_Initialize(); + + // Display information in the Server Console + print(" |-- LS BeachSide Building Elevator created"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove the lamp post at the underground car park entrance + RemoveBuildingForPlayer(i, 1226, 265.481, -1581.1, 32.9311, 5.0); + + // Remove the night lights object (must be removed to also remove any + // occulsion zones inside the building) + RemoveBuildingForPlayer(i, 6518, 280.297, -1606.2, 72.3984, 250.0); + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Destroy the elevator, the elevator doors and the elevator floor doors + Elevator_Destroy(); + + // Display information in the Server Console + print(" |-- LS BeachSide Building Elevator destroyed"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove the lamp post at the underground car park entrance + RemoveBuildingForPlayer(playerid, 1226, 265.481, -1581.1, 32.9311, 5.0); + + // Remove the night lights object (must be removed to also remove any + // occulsion zones inside the building) + RemoveBuildingForPlayer(playerid, 6518, 280.297, -1606.2, 72.3984, 250.0); + + // Exit here (return 1 so this callback is processed in other scripts) + return 1; +} + +public OnObjectMoved(objectid) +{ + // Create variables + new Float:x, Float:y, Float:z; + + // Loop + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + // Check if the object that moved was one of the elevator floor doors + if(objectid == Obj_FloorDoors[i][0]) + { + GetObjectPos(Obj_FloorDoors[i][0], x, y, z); + + // Some floor doors have shut, move the elevator to next floor in queue: + if (y < Y_DOOR_L_OPENED - 0.5) + { + Elevator_MoveToFloor(ElevatorQueue[0]); + RemoveFirstQueueFloor(); + } + } + } + + if(objectid == Obj_Elevator) // The elevator reached the specified floor. + { + KillTimer(ElevatorBoostTimer); // Kills the timer, in case the elevator reached the floor before boost. + + FloorRequestedBy[ElevatorFloor] = INVALID_PLAYER_ID; + + Elevator_OpenDoors(); + Floor_OpenDoors(ElevatorFloor); + + GetObjectPos(Obj_Elevator, x, y, z); + Label_Elevator = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, X_ELEVATOR_POS + 1.6, Y_ELEVATOR_POS - 1.85, z - 0.4, 4.0, 0, 1); + + ElevatorState = ELEVATOR_STATE_WAITING; + SetTimer("Elevator_TurnToIdle", ELEVATOR_WAIT_TIME, 0); + } + + return 1; +} + +public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) +{ + if(dialogid == DIALOG_ID) + { + if(!response) + return 0; + + if(FloorRequestedBy[listitem] != INVALID_PLAYER_ID || IsFloorInQueue(listitem)) + GameTextForPlayer(playerid, "~r~The floor is already in the queue", 3500, 4); + else if(DidPlayerRequestElevator(playerid)) + GameTextForPlayer(playerid, "~r~You already requested the elevator", 3500, 4); + else + CallElevator(playerid, listitem); + + return 1; + } + + return 0; +} + +public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) +{ + // Check if the player is not in a vehicle and pressed the conversation yes key (Y by default) + if (!IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_YES)) + { + // Create variables and get the players current position + new Float:pos[3]; + GetPlayerPos(playerid, pos[0], pos[1], pos[2]); + + // For debug + //printf("X = %0.2f | Y = %0.2f | Z = %0.2f", pos[0], pos[1], pos[2]); + + // Check if the player is using the button inside the elevator + if (pos[1] > (Y_ELEVATOR_POS - 1.8) && pos[1] < (Y_ELEVATOR_POS + 1.8) && pos[0] < (X_ELEVATOR_POS + 1.8) && pos[0] > (X_ELEVATOR_POS - 1.8)) + { + // The player is using the button inside the elevator + // -------------------------------------------------- + + // Show the elevator dialog to the player + ShowElevatorDialog(playerid); + } + else + { + // Check if the player is using the button on one of the floors + if(pos[1] < (Y_ELEVATOR_POS - 1.81) && pos[1] > (Y_ELEVATOR_POS - 3.8) && pos[0] > (X_ELEVATOR_POS + 1.21) && pos[0] < (X_ELEVATOR_POS + 3.8)) + { + // The player is most likely using an elevator floor button... check which floor + // ----------------------------------------------------------------------------- + + // Create variable with the number of floors to check (total floors minus 1) + new i = 13; + + // Loop + while(pos[2] < GetDoorsZCoordForFloor(i) + 3.5 && i > 0) + i --; + + if(i == 0 && pos[2] < GetDoorsZCoordForFloor(0) + 2.0) + i = -1; + + if (i <= 12) + { + // Check if the elevator is not moving (idle or waiting) + if (ElevatorState != ELEVATOR_STATE_MOVING) + { + // Check if the elevator is already on the floor it was called from + if (ElevatorFloor == i + 1) + { + // Display gametext message to the player + GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~y~~h~LS BeachSide Elevator Is~n~~y~~h~Already On This Floor...~n~~w~Walk Inside It~n~~w~And Press '~k~~CONVERSATION_YES~'", 3500, 3); + + // Display chat text message to the player + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* The LS BeachSide elevator is already on this floor... walk inside it and press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}'"); + + // Exit here (return 1 so this callback is processed in other scripts) + return 1; + } + } + + // Call function to call the elevator to the floor + CallElevator(playerid, i + 1); + + // Display gametext message to the player + GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~g~~h~LS BeachSide Elevator~n~~g~~h~Has Been Called...~n~~w~Please Wait", 3000, 3); + + // Create variable for formatted message + new strTempString[100]; + + // Check if the elevator is moving + if (ElevatorState == ELEVATOR_STATE_MOVING) + { + // Format chat text message + format(strTempString, sizeof(strTempString), "* The LS BeachSide elevator has been called... it is currently moving towards the %s.", FloorNames[ElevatorFloor]); + } + else + { + // Check if the floor is the car park + if (ElevatorFloor == 0) + { + // Format chat text message + format(strTempString, sizeof(strTempString), "* The LS BeachSide elevator has been called... it is currently at the %s.", FloorNames[ElevatorFloor]); + } + else + { + // Format chat text message + format(strTempString, sizeof(strTempString), "* The LS BeachSide elevator has been called... it is currently on the %s.", FloorNames[ElevatorFloor]); + } + } + + // Display formatted chat text message to the player + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString); + + // Exit here (return 1 so this callback is processed in other scripts) + return 1; + } + } + } + } + + // Exit here (return 1 so this callback is processed in other scripts) + return 1; +} + +// ------------------------ Functions ------------------------ +stock Elevator_Initialize() +{ + // Create the elevator and elevator door objects + Obj_Elevator = CreateObject(18755, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD, 0.000000, 0.000000, 80.000000); + Obj_ElevatorDoors[0] = CreateObject(18757, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD, 0.000000, 0.000000, 80.000000); + Obj_ElevatorDoors[1] = CreateObject(18756, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD, 0.000000, 0.000000, 80.000000); + + // Create the 3D text label for inside the elevator + Label_Elevator = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, X_ELEVATOR_POS + 1.6, Y_ELEVATOR_POS - 1.85, GROUND_Z_COORD - 0.4, 4.0, 0, 1); + + // Create variables + new string[128], Float:z; + + // Loop + for (new i; i < sizeof(Obj_FloorDoors); i ++) + { + // Create elevator floor door objects + Obj_FloorDoors[i][0] = CreateObject(18757, X_ELEVATOR_POS, Y_ELEVATOR_POS - 0.245, GetDoorsZCoordForFloor(i) + 0.05, 0.000000, 0.000000, 80.000000); + Obj_FloorDoors[i][1] = CreateObject(18756, X_ELEVATOR_POS, Y_ELEVATOR_POS - 0.245, GetDoorsZCoordForFloor(i) + 0.05, 0.000000, 0.000000, 80.000000); + + // Format string for the floor 3D text label + format(string, sizeof(string), "{CCCCCC}[%s]\n{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to call", FloorNames[i]); + + // Get label Z position + z = GetDoorsZCoordForFloor(i); + + // Create floor label + Label_Floors[i] = Create3DTextLabel(string, 0xCCCCCCAA, X_ELEVATOR_POS + 2, Y_ELEVATOR_POS -3, z - 0.2, 10.5, 0, 1); + } + + // Open the car park floor doors and the elevator doors + Floor_OpenDoors(0); + Elevator_OpenDoors(); + + // Exit here + return 1; +} + +stock Elevator_Destroy() +{ + // Destroys the elevator. + + DestroyObject(Obj_Elevator); + DestroyObject(Obj_ElevatorDoors[0]); + DestroyObject(Obj_ElevatorDoors[1]); + Delete3DTextLabel(Label_Elevator); + + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + DestroyObject(Obj_FloorDoors[i][0]); + DestroyObject(Obj_FloorDoors[i][1]); + Delete3DTextLabel(Label_Floors[i]); + } + + return 1; +} + +stock Elevator_OpenDoors() +{ + // Opens the elevator's doors. + + new Float:x, Float:y, Float:z; + + GetObjectPos(Obj_ElevatorDoors[0], x, y, z); + MoveObject(Obj_ElevatorDoors[0], X_DOOR_L_OPENED, Y_DOOR_L_OPENED, z, DOORS_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_DOOR_R_OPENED, Y_DOOR_R_OPENED, z, DOORS_SPEED); + + return 1; +} + +stock Elevator_CloseDoors() +{ + // Closes the elevator's doors. + + if(ElevatorState == ELEVATOR_STATE_MOVING) + return 0; + + new Float:x, Float:y, Float:z; + + GetObjectPos(Obj_ElevatorDoors[0], x, y, z); + MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, z, DOORS_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, z, DOORS_SPEED); + + return 1; +} + +stock Floor_OpenDoors(floorid) +{ + // Opens the doors at the specified floor. + + MoveObject(Obj_FloorDoors[floorid][0], X_FDOOR_L_OPENED, Y_FDOOR_L_OPENED, GetDoorsZCoordForFloor(floorid) + 0.05, DOORS_SPEED); + MoveObject(Obj_FloorDoors[floorid][1], X_FDOOR_R_OPENED, Y_FDOOR_R_OPENED, GetDoorsZCoordForFloor(floorid) + 0.05, DOORS_SPEED); + + PlaySoundForPlayersInRange(6401, 50.0, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid) + 5.0); + + return 1; +} + +stock Floor_CloseDoors(floorid) +{ + // Closes the doors at the specified floor. + + MoveObject(Obj_FloorDoors[floorid][0], X_ELEVATOR_POS, Y_ELEVATOR_POS - 0.245, GetDoorsZCoordForFloor(floorid) + 0.05, DOORS_SPEED); + MoveObject(Obj_FloorDoors[floorid][1], X_ELEVATOR_POS, Y_ELEVATOR_POS - 0.245, GetDoorsZCoordForFloor(floorid) + 0.05, DOORS_SPEED); + + PlaySoundForPlayersInRange(6401, 50.0, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid) + 5.0); + + return 1; +} + +stock Elevator_MoveToFloor(floorid) +{ + // Moves the elevator to specified floor (doors are meant to be already closed). + + ElevatorState = ELEVATOR_STATE_MOVING; + ElevatorFloor = floorid; + + // Move the elevator slowly, to give time to clients to sync the object surfing. Then, boost it up: + MoveObject(Obj_Elevator, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetElevatorZCoordForFloor(floorid), 0.25); + MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), 0.25); + MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), 0.25); + Delete3DTextLabel(Label_Elevator); + + ElevatorBoostTimer = SetTimerEx("Elevator_Boost", 2000, 0, "i", floorid); + + return 1; +} + +public Elevator_Boost(floorid) +{ + // Increases the elevator's speed until it reaches 'floorid' + StopObject(Obj_Elevator); + StopObject(Obj_ElevatorDoors[0]); + StopObject(Obj_ElevatorDoors[1]); + + MoveObject(Obj_Elevator, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetElevatorZCoordForFloor(floorid), ELEVATOR_SPEED); + MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED); + + return 1; +} + +public Elevator_TurnToIdle() +{ + ElevatorState = ELEVATOR_STATE_IDLE; + ReadNextFloorInQueue(); + + return 1; +} + +stock RemoveFirstQueueFloor() +{ + // Removes the data in ElevatorQueue[0], and reorders the queue accordingly. + + for(new i; i < sizeof(ElevatorQueue) - 1; i ++) + ElevatorQueue[i] = ElevatorQueue[i + 1]; + + ElevatorQueue[sizeof(ElevatorQueue) - 1] = INVALID_FLOOR; + + return 1; +} + +stock AddFloorToQueue(floorid) +{ + // Adds 'floorid' at the end of the queue. + + // Scan for the first empty space: + new slot = -1; + for(new i; i < sizeof(ElevatorQueue); i ++) + { + if(ElevatorQueue[i] == INVALID_FLOOR) + { + slot = i; + break; + } + } + + if(slot != -1) + { + ElevatorQueue[slot] = floorid; + + // If needed, move the elevator. + if(ElevatorState == ELEVATOR_STATE_IDLE) + ReadNextFloorInQueue(); + + return 1; + } + + return 0; +} + +stock ResetElevatorQueue() +{ + // Resets the queue. + + for(new i; i < sizeof(ElevatorQueue); i ++) + { + ElevatorQueue[i] = INVALID_FLOOR; + FloorRequestedBy[i] = INVALID_PLAYER_ID; + } + + return 1; +} + +stock IsFloorInQueue(floorid) +{ + // Checks if the specified floor is currently part of the queue. + + for(new i; i < sizeof(ElevatorQueue); i ++) + if(ElevatorQueue[i] == floorid) + return 1; + + return 0; +} + +stock ReadNextFloorInQueue() +{ + // Reads the next floor in the queue, closes doors, and goes to it. + + if(ElevatorState != ELEVATOR_STATE_IDLE || ElevatorQueue[0] == INVALID_FLOOR) + return 0; + + Elevator_CloseDoors(); + Floor_CloseDoors(ElevatorFloor); + + return 1; +} + +stock DidPlayerRequestElevator(playerid) +{ + for(new i; i < sizeof(FloorRequestedBy); i ++) + if(FloorRequestedBy[i] == playerid) + return 1; + + return 0; +} + +stock ShowElevatorDialog(playerid) +{ + new string[512]; + for(new i; i < sizeof(ElevatorQueue); i ++) + { + if(FloorRequestedBy[i] != INVALID_PLAYER_ID) + strcat(string, "{FF0000}"); + + strcat(string, FloorNames[i]); + strcat(string, "\n"); + } + + ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "LS BeachSide Elevator...", string, "Accept", "Cancel"); + + return 1; +} + +stock CallElevator(playerid, floorid) +{ + // Calls the elevator (also used with the elevator dialog). + + if(FloorRequestedBy[floorid] != INVALID_PLAYER_ID || IsFloorInQueue(floorid)) + return 0; + + FloorRequestedBy[floorid] = playerid; + AddFloorToQueue(floorid); + + return 1; +} + +stock Float:GetElevatorZCoordForFloor(floorid) +{ + // Return Z height value + return (GROUND_Z_COORD + FloorZOffsets[floorid]); +} + +stock Float:GetDoorsZCoordForFloor(floorid) +{ + // Return Z height value + return (GROUND_Z_COORD + FloorZOffsets[floorid]); +} + diff --git a/filterscripts/ls_elevator.amx b/filterscripts/ls_elevator.amx new file mode 100644 index 0000000..ee21a00 Binary files /dev/null and b/filterscripts/ls_elevator.amx differ diff --git a/filterscripts/ls_elevator.pwn b/filterscripts/ls_elevator.pwn new file mode 100644 index 0000000..6ba34b6 --- /dev/null +++ b/filterscripts/ls_elevator.pwn @@ -0,0 +1,509 @@ +/* +* Example elevator system for the new LS building. +* +* Zamaroht 2010 +* +* 26/08/2011: Kye: added a sound effect for the elevator starting/stopping. +*/ + +// Warning: This script uses a total of 45 objects, 22 3D Text Labels and 1 dialog. + +#include +#include "../include/gl_common.inc" // for PlaySoundForPlayersInRange() + +#define ELEVATOR_SPEED (5.0) // Movement speed of the elevator. +#define DOORS_SPEED (5.0) // Movement speed of the doors. +#define ELEVATOR_WAIT_TIME (5000) // Time in ms that the elevator will wait in each floor before continuing with the queue. + // Be sure to give enough time for doors to open. + +#define DIALOG_ID (874) + +// Private: +#define X_DOOR_CLOSED (1786.627685) +#define X_DOOR_R_OPENED (1785.027685) +#define X_DOOR_L_OPENED (1788.227685) +#define GROUND_Z_COORD (14.511476) +#define ELEVATOR_OFFSET (0.059523) + +/* ------------------ +// Constants: +-------------------*/ +static FloorNames[21][] = +{ + "Ground Floor", + "First Floor", + "Second Floor", + "Third Floor", + "Fourth Floor", + "Fifth Floor", + "Sixth Floor", + "Seventh Floor", + "Eighth Floor", + "Ninth Floor", + "Tenth Floor", + "Eleventh Floor", + "Twelfth Floor", + "Thirteenth Floor", + "Fourteenth Floor", + "Fifteenth Floor", + "Sixteenth Floor", + "Seventeenth Floor", + "Eighteenth Floor", + "Nineteenth Floor", + "Penthouse" +}; + +static Float:FloorZOffsets[21] = +{ + 0.0, // 0.0, + 8.5479, // 8.5479, + 13.99945, // 8.5479 + (5.45155 * 1.0), + 19.45100, // 8.5479 + (5.45155 * 2.0), + 24.90255, // 8.5479 + (5.45155 * 3.0), + 30.35410, // 8.5479 + (5.45155 * 4.0), + 35.80565, // 8.5479 + (5.45155 * 5.0), + 41.25720, // 8.5479 + (5.45155 * 6.0), + 46.70875, // 8.5479 + (5.45155 * 7.0), + 52.16030, // 8.5479 + (5.45155 * 8.0), + 57.61185, // 8.5479 + (5.45155 * 9.0), + 63.06340, // 8.5479 + (5.45155 * 10.0), + 68.51495, // 8.5479 + (5.45155 * 11.0), + 73.96650, // 8.5479 + (5.45155 * 12.0), + 79.41805, // 8.5479 + (5.45155 * 13.0), + 84.86960, // 8.5479 + (5.45155 * 14.0), + 90.32115, // 8.5479 + (5.45155 * 15.0), + 95.77270, // 8.5479 + (5.45155 * 16.0), + 101.22425, // 8.5479 + (5.45155 * 17.0), + 106.67580, // 8.5479 + (5.45155 * 18.0), + 112.12735 // 8.5479 + (5.45155 * 19.0) +}; + +/* ------------------ +// Variables: +-------------------*/ +new Obj_Elevator, Obj_ElevatorDoors[2], + Obj_FloorDoors[21][2]; + +new Text3D:Label_Elevator, Text3D:Label_Floors[21]; + +#define ELEVATOR_STATE_IDLE (0) +#define ELEVATOR_STATE_WAITING (1) +#define ELEVATOR_STATE_MOVING (2) + +new ElevatorState, + ElevatorFloor; // If Idle or Waiting, this is the current floor. If Moving, the floor it's moving to. + +#define INVALID_FLOOR (-1) + +new ElevatorQueue[21], // Floors in queue. + FloorRequestedBy[21]; // FloorRequestedBy[floor_id] = playerid; - Points out who requested which floor. + +new ElevatorBoostTimer; // Timer that makes the elevator move faster after players start surfing the object. + +/* ------------------ +* Function forwards: +-------------------*/ +// Public: +forward CallElevator(playerid, floorid); // You can use INVALID_PLAYER_ID too. +forward ShowElevatorDialog(playerid); + +// Private: +forward Elevator_Initialize(); +forward Elevator_Destroy(); + +forward Elevator_OpenDoors(); +forward Elevator_CloseDoors(); +forward Floor_OpenDoors(floorid); +forward Floor_CloseDoors(floorid); + +forward Elevator_MoveToFloor(floorid); +forward Elevator_Boost(floorid); // Increases the elevator speed until it reaches 'floorid'. +forward Elevator_TurnToIdle(); + +forward ReadNextFloorInQueue(); +forward RemoveFirstQueueFloor(); +forward AddFloorToQueue(floorid); +forward IsFloorInQueue(floorid); +forward ResetElevatorQueue(); + +forward DidPlayerRequestElevator(playerid); + +forward Float:GetElevatorZCoordForFloor(floorid); +forward Float:GetDoorsZCoordForFloor(floorid); + +// ------------------------ Callbacks ------------------------ + +public OnFilterScriptInit() +{ + ResetElevatorQueue(); + Elevator_Initialize(); + + return 1; +} + +public OnFilterScriptExit() +{ + Elevator_Destroy(); + + return 1; +} + +public OnObjectMoved(objectid) +{ + new Float:x, Float:y, Float:z; + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + if(objectid == Obj_FloorDoors[i][0]) + { + GetObjectPos(Obj_FloorDoors[i][0], x, y, z); + + if(x < X_DOOR_L_OPENED - 0.5) // Some floor doors have shut, move the elevator to next floor in queue: + { + Elevator_MoveToFloor(ElevatorQueue[0]); + RemoveFirstQueueFloor(); + } + } + } + + if(objectid == Obj_Elevator) // The elevator reached the specified floor. + { + KillTimer(ElevatorBoostTimer); // Kills the timer, in case the elevator reached the floor before boost. + + FloorRequestedBy[ElevatorFloor] = INVALID_PLAYER_ID; + + Elevator_OpenDoors(); + Floor_OpenDoors(ElevatorFloor); + + GetObjectPos(Obj_Elevator, x, y, z); + Label_Elevator = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, 1784.9822, -1302.0426, z - 0.9, 4.0, 0, 1); + + ElevatorState = ELEVATOR_STATE_WAITING; + SetTimer("Elevator_TurnToIdle", ELEVATOR_WAIT_TIME, 0); + } + + return 1; +} + +public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) +{ + if(dialogid == DIALOG_ID) + { + if(!response) + return 0; + + if(FloorRequestedBy[listitem] != INVALID_PLAYER_ID || IsFloorInQueue(listitem)) + GameTextForPlayer(playerid, "~r~The floor is already in the queue", 3500, 4); + else if(DidPlayerRequestElevator(playerid)) + GameTextForPlayer(playerid, "~r~You already requested the elevator", 3500, 4); + else + CallElevator(playerid, listitem); + + return 1; + } + + return 0; +} + +public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) +{ + if(!IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_YES)) + { + new Float:pos[3]; + GetPlayerPos(playerid, pos[0], pos[1], pos[2]); + if(pos[1] < -1301.4 && pos[1] > -1303.2417 && pos[0] < 1786.2131 && pos[0] > 1784.1555) // He is using the elevator button + ShowElevatorDialog(playerid); + else // Is he in a floor button? + { + if(pos[1] > -1301.4 && pos[1] < -1299.1447 && pos[0] < 1785.6147 && pos[0] > 1781.9902) + { + // He is most likely using it, check floor: + new i=20; + while(pos[2] < GetDoorsZCoordForFloor(i) + 3.5 && i > 0) + i --; + + if(i == 0 && pos[2] < GetDoorsZCoordForFloor(0) + 2.0) + i = -1; + + if(i <= 19) + { + CallElevator(playerid, i + 1); + GameTextForPlayer(playerid, "~r~Elevator called", 3500, 4); + } + } + } + } + + return 1; +} + +// ------------------------ Functions ------------------------ +stock Elevator_Initialize() +{ + // Initializes the elevator. + + Obj_Elevator = CreateObject(18755, 1786.678100, -1303.459472, GROUND_Z_COORD + ELEVATOR_OFFSET, 0.000000, 0.000000, 270.000000); + Obj_ElevatorDoors[0] = CreateObject(18757, X_DOOR_CLOSED, -1303.459472, GROUND_Z_COORD, 0.000000, 0.000000, 270.000000); + Obj_ElevatorDoors[1] = CreateObject(18756, X_DOOR_CLOSED, -1303.459472, GROUND_Z_COORD, 0.000000, 0.000000, 270.000000); + + Label_Elevator = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, 1784.9822, -1302.0426, 13.6491, 4.0, 0, 1); + + new string[128], + Float:z; + + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + Obj_FloorDoors[i][0] = CreateObject(18757, X_DOOR_CLOSED, -1303.171142, GetDoorsZCoordForFloor(i), 0.000000, 0.000000, 270.000000); + Obj_FloorDoors[i][1] = CreateObject(18756, X_DOOR_CLOSED, -1303.171142, GetDoorsZCoordForFloor(i), 0.000000, 0.000000, 270.000000); + + format(string, sizeof(string), "{CCCCCC}[%s]\n{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to call", FloorNames[i]); + + if(i == 0) + z = 13.4713; + else + z = 13.4713 + 8.7396 + ((i-1) * 5.45155); + + Label_Floors[i] = Create3DTextLabel(string, 0xCCCCCCAA, 1783.9799, -1300.7660, z, 10.5, 0, 1); + // Label_Elevator, Text3D:Label_Floors[21]; + } + + // Open ground floor doors: + Floor_OpenDoors(0); + Elevator_OpenDoors(); + + return 1; +} + +stock Elevator_Destroy() +{ + // Destroys the elevator. + + DestroyObject(Obj_Elevator); + DestroyObject(Obj_ElevatorDoors[0]); + DestroyObject(Obj_ElevatorDoors[1]); + Delete3DTextLabel(Label_Elevator); + + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + DestroyObject(Obj_FloorDoors[i][0]); + DestroyObject(Obj_FloorDoors[i][1]); + Delete3DTextLabel(Label_Floors[i]); + } + + return 1; +} + +stock Elevator_OpenDoors() +{ + // Opens the elevator's doors. + + new Float:x, Float:y, Float:z; + + GetObjectPos(Obj_ElevatorDoors[0], x, y, z); + MoveObject(Obj_ElevatorDoors[0], X_DOOR_L_OPENED, y, z, DOORS_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_DOOR_R_OPENED, y, z, DOORS_SPEED); + + return 1; +} + +stock Elevator_CloseDoors() +{ + // Closes the elevator's doors. + + if(ElevatorState == ELEVATOR_STATE_MOVING) + return 0; + + new Float:x, Float:y, Float:z; + + GetObjectPos(Obj_ElevatorDoors[0], x, y, z); + MoveObject(Obj_ElevatorDoors[0], X_DOOR_CLOSED, y, z, DOORS_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_DOOR_CLOSED, y, z, DOORS_SPEED); + + return 1; +} + +stock Floor_OpenDoors(floorid) +{ + // Opens the doors at the specified floor. + + MoveObject(Obj_FloorDoors[floorid][0], X_DOOR_L_OPENED, -1303.171142, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + MoveObject(Obj_FloorDoors[floorid][1], X_DOOR_R_OPENED, -1303.171142, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + + PlaySoundForPlayersInRange(6401, 50.0, X_DOOR_CLOSED, -1303.171142, GetDoorsZCoordForFloor(floorid) + 5.0); + + return 1; +} + +stock Floor_CloseDoors(floorid) +{ + // Closes the doors at the specified floor. + + MoveObject(Obj_FloorDoors[floorid][0], X_DOOR_CLOSED, -1303.171142, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + MoveObject(Obj_FloorDoors[floorid][1], X_DOOR_CLOSED, -1303.171142, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + + PlaySoundForPlayersInRange(6401, 50.0, X_DOOR_CLOSED, -1303.171142, GetDoorsZCoordForFloor(floorid) + 5.0); + + return 1; +} + +stock Elevator_MoveToFloor(floorid) +{ + // Moves the elevator to specified floor (doors are meant to be already closed). + + ElevatorState = ELEVATOR_STATE_MOVING; + ElevatorFloor = floorid; + + // Move the elevator slowly, to give time to clients to sync the object surfing. Then, boost it up: + MoveObject(Obj_Elevator, 1786.678100, -1303.459472, GetElevatorZCoordForFloor(floorid), 0.25); + MoveObject(Obj_ElevatorDoors[0], X_DOOR_CLOSED, -1303.459472, GetDoorsZCoordForFloor(floorid), 0.25); + MoveObject(Obj_ElevatorDoors[1], X_DOOR_CLOSED, -1303.459472, GetDoorsZCoordForFloor(floorid), 0.25); + Delete3DTextLabel(Label_Elevator); + + ElevatorBoostTimer = SetTimerEx("Elevator_Boost", 2000, 0, "i", floorid); + + return 1; +} + +public Elevator_Boost(floorid) +{ + // Increases the elevator's speed until it reaches 'floorid' + StopObject(Obj_Elevator); + StopObject(Obj_ElevatorDoors[0]); + StopObject(Obj_ElevatorDoors[1]); + + MoveObject(Obj_Elevator, 1786.678100, -1303.459472, GetElevatorZCoordForFloor(floorid), ELEVATOR_SPEED); + MoveObject(Obj_ElevatorDoors[0], X_DOOR_CLOSED, -1303.459472, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_DOOR_CLOSED, -1303.459472, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED); + + return 1; +} + +public Elevator_TurnToIdle() +{ + ElevatorState = ELEVATOR_STATE_IDLE; + ReadNextFloorInQueue(); + + return 1; +} + +stock RemoveFirstQueueFloor() +{ + // Removes the data in ElevatorQueue[0], and reorders the queue accordingly. + + for(new i; i < sizeof(ElevatorQueue) - 1; i ++) + ElevatorQueue[i] = ElevatorQueue[i + 1]; + + ElevatorQueue[sizeof(ElevatorQueue) - 1] = INVALID_FLOOR; + + return 1; +} + +stock AddFloorToQueue(floorid) +{ + // Adds 'floorid' at the end of the queue. + + // Scan for the first empty space: + new slot = -1; + for(new i; i < sizeof(ElevatorQueue); i ++) + { + if(ElevatorQueue[i] == INVALID_FLOOR) + { + slot = i; + break; + } + } + + if(slot != -1) + { + ElevatorQueue[slot] = floorid; + + // If needed, move the elevator. + if(ElevatorState == ELEVATOR_STATE_IDLE) + ReadNextFloorInQueue(); + + return 1; + } + + return 0; +} + +stock ResetElevatorQueue() +{ + // Resets the queue. + + for(new i; i < sizeof(ElevatorQueue); i ++) + { + ElevatorQueue[i] = INVALID_FLOOR; + FloorRequestedBy[i] = INVALID_PLAYER_ID; + } + + return 1; +} + +stock IsFloorInQueue(floorid) +{ + // Checks if the specified floor is currently part of the queue. + + for(new i; i < sizeof(ElevatorQueue); i ++) + if(ElevatorQueue[i] == floorid) + return 1; + + return 0; +} + +stock ReadNextFloorInQueue() +{ + // Reads the next floor in the queue, closes doors, and goes to it. + + if(ElevatorState != ELEVATOR_STATE_IDLE || ElevatorQueue[0] == INVALID_FLOOR) + return 0; + + Elevator_CloseDoors(); + Floor_CloseDoors(ElevatorFloor); + + return 1; +} + +stock DidPlayerRequestElevator(playerid) +{ + for(new i; i < sizeof(FloorRequestedBy); i ++) + if(FloorRequestedBy[i] == playerid) + return 1; + + return 0; +} + +stock ShowElevatorDialog(playerid) +{ + new string[512]; + for(new i; i < sizeof(ElevatorQueue); i ++) + { + if(FloorRequestedBy[i] != INVALID_PLAYER_ID) + strcat(string, "{FF0000}"); + + strcat(string, FloorNames[i]); + strcat(string, "\n"); + } + + ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "Elevator", string, "Accept", "Cancel"); + + return 1; +} + +stock CallElevator(playerid, floorid) +{ + // Calls the elevator (also used with the elevator dialog). + + if(FloorRequestedBy[floorid] != INVALID_PLAYER_ID || IsFloorInQueue(floorid)) + return 0; + + FloorRequestedBy[floorid] = playerid; + AddFloorToQueue(floorid); + + return 1; +} + +stock Float:GetElevatorZCoordForFloor(floorid) + return (GROUND_Z_COORD + FloorZOffsets[floorid] + ELEVATOR_OFFSET); // A small offset for the elevator object itself. + +stock Float:GetDoorsZCoordForFloor(floorid) + return (GROUND_Z_COORD + FloorZOffsets[floorid]); diff --git a/filterscripts/ls_mall.amx b/filterscripts/ls_mall.amx new file mode 100644 index 0000000..3584fa2 Binary files /dev/null and b/filterscripts/ls_mall.amx differ diff --git a/filterscripts/ls_mall.pwn b/filterscripts/ls_mall.pwn new file mode 100644 index 0000000..f0026c4 --- /dev/null +++ b/filterscripts/ls_mall.pwn @@ -0,0 +1,220 @@ +//------------------------------------------------- +// +// This is an example of using cessil's LS mall replacement +// mesh, which contains enterable shop interiors which +// you can decorate yourself. +// +// It's recommended you use Jernej's map editor, found on the +// SA-MP forum, and import this script (Import .pwn) if you +// want to place new objects in the shops. +// +// SA-MP 0.3d and above +// +//------------------------------------------------- + +#include +#include "../include/gl_common.inc" + +#define MALL_OBJECT_DRAW_DIST 30.0 // Even with a streamer, keep the draw distance on the objects inside the shops low. + +//------------------------------------------------- + +RemoveBuildingsForMall(playerid) +{ + // Remove the original mall mesh + RemoveBuildingForPlayer(playerid, 6130, 1117.5859, -1490.0078, 32.7188, 10.0); + + // This is the mall mesh LOD + RemoveBuildingForPlayer(playerid, 6255, 1117.5859, -1490.0078, 32.7188, 10.0); + + // There are some trees on the outside of the mall which poke through one of the interiors + RemoveBuildingForPlayer(playerid, 762, 1175.3594, -1420.1875, 19.8828, 0.25); + RemoveBuildingForPlayer(playerid, 615, 1166.3516, -1417.6953, 13.9531, 0.25); +} + +//------------------------------------------------- + +public OnPlayerConnect(playerid) +{ + RemoveBuildingsForMall(playerid); + return 1; +} + +//------------------------------------------------- + +public OnFilterScriptInit() +{ + // Main mall mesh, interior areas + CreateObject(19322, 1117.580, -1490.01, 32.72, 0.00, 0.00, 0.00, 200.0); + CreateObject(19323, 1117.580, -1490.01, 32.72, 0.00, 0.00, 0.00, 200.0); + + // Mall windows + CreateObject(19325, 1155.40, -1434.89, 16.49, 0.00, 0.00, 0.30, 100.0); + CreateObject(19325, 1155.37, -1445.41, 16.31, 0.00, 0.00, 0.00, 100.0); + CreateObject(19325, 1155.29, -1452.38, 16.31, 0.00, 0.00, 0.00, 100.0); + CreateObject(19325, 1157.36, -1468.35, 16.31, 0.00, 0.00, 18.66, 100.0); + CreateObject(19325, 1160.64, -1478.37, 16.31, 0.00, 0.00, 17.76, 100.0); + CreateObject(19325, 1159.84, -1502.06, 16.31, 0.00, 0.00, -19.92, 100.0); + CreateObject(19325, 1139.28, -1523.71, 16.31, 0.00, 0.00, -69.36, 100.0); + CreateObject(19325, 1117.06, -1523.43, 16.51, 0.00, 0.00, -109.44, 100.0); + CreateObject(19325, 1097.18, -1502.43, 16.51, 0.00, 0.00, -158.58, 100.0); + CreateObject(19325, 1096.47, -1478.29, 16.51, 0.00, 0.00, -197.94, 100.0); + CreateObject(19325, 1099.70, -1468.27, 16.51, 0.00, 0.00, -197.94, 100.0); + CreateObject(19325, 1101.81, -1445.45, 16.22, 0.00, 0.00, -180.24, 100.0); + CreateObject(19325, 1101.76, -1452.47, 16.22, 0.00, 0.00, -181.62, 100.0); + CreateObject(19325, 1101.77, -1434.88, 16.22, 0.00, 0.00, -180.24, 100.0); + CreateObject(19325, 1094.31, -1444.92, 23.47, 0.00, 0.00, -180.24, 100.0); + CreateObject(19325, 1094.37, -1458.37, 23.47, 0.00, 0.00, -179.46, 100.0); + CreateObject(19325, 1093.01, -1517.44, 23.44, 0.00, 0.00, -138.72, 100.0); + CreateObject(19325, 1101.08, -1526.64, 23.42, 0.00, 0.00, -137.34, 100.0); + CreateObject(19325, 1155.12, -1526.38, 23.46, 0.00, 0.00, -42.12, 100.0); + CreateObject(19325, 1163.09, -1517.25, 23.46, 0.00, 0.00, -40.74, 100.0); + CreateObject(19325, 1163.04, -1442.06, 23.40, 0.00, 0.00, -0.12, 100.0); + CreateObject(19325, 1163.09, -1428.47, 23.50, 0.00, 0.00, 0.54, 100.0); + + // This is an example 24/7. Normally you'd want to stream these + // interior objects in your streamer. + + // signs + CreateObject(19326, 1155.34, -1446.73, 16.38, 0.00, 0.00, -89.82, MALL_OBJECT_DRAW_DIST); + CreateObject(19326, 1155.25, -1443.85, 16.36, 0.00, 0.00, -89.82, MALL_OBJECT_DRAW_DIST); + CreateObject(19326, 1155.37, -1436.32, 16.36, 0.00, 0.00, -89.82, MALL_OBJECT_DRAW_DIST); + CreateObject(19326, 1155.35, -1433.51, 16.36, 0.00, 0.00, -89.70, MALL_OBJECT_DRAW_DIST); + CreateObject(19329, 1155.18, -1440.22, 18.70, 0.00, 0.00, 89.04, MALL_OBJECT_DRAW_DIST); + CreateObject(19329, 1161.59, -1431.50, 17.93, 0.00, 0.00, 0.00, MALL_OBJECT_DRAW_DIST); + CreateObject(19329, 1160.40, -1448.79, 17.96, 0.00, 0.00, 0.00, MALL_OBJECT_DRAW_DIST); + + // 24/7 food aisles + CreateObject(2543, 1168.18, -1436.39, 14.79, 0.00, 0.00, 0.30, MALL_OBJECT_DRAW_DIST); + CreateObject(2535, 1182.74, -1448.30, 14.70, 0.00, 0.00, -90.96, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1167.10, -1436.40, 14.79, 0.00, 0.00, 0.31, MALL_OBJECT_DRAW_DIST); + CreateObject(2538, 1172.31, -1435.32, 14.79, 0.00, 0.00, 180.34, MALL_OBJECT_DRAW_DIST); + CreateObject(2539, 1171.38, -1435.31, 14.79, 0.00, 0.00, 180.19, MALL_OBJECT_DRAW_DIST); + CreateObject(2540, 1169.56, -1435.36, 14.79, 0.00, 0.00, 180.17, MALL_OBJECT_DRAW_DIST); + CreateObject(1984, 1157.37, -1442.59, 14.79, 0.00, 0.00, -450.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1163.25, -1448.31, 14.75, 0.00, 0.00, -179.16, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1169.29, -1431.92, 14.75, 0.00, 0.00, 359.80, MALL_OBJECT_DRAW_DIST); + CreateObject(1987, 1163.13, -1436.34, 14.79, 0.00, 0.00, 361.06, MALL_OBJECT_DRAW_DIST); + CreateObject(1988, 1164.13, -1436.33, 14.79, 0.00, 0.00, 360.80, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1164.79, -1443.96, 14.79, 0.00, 0.00, 177.73, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1164.70, -1444.98, 14.79, 0.00, 0.00, 358.07, MALL_OBJECT_DRAW_DIST); + CreateObject(2942, 1155.52, -1464.68, 15.43, 0.00, 0.00, -71.22, MALL_OBJECT_DRAW_DIST); + CreateObject(1987, 1164.12, -1435.32, 14.77, 0.00, 0.00, 180.96, MALL_OBJECT_DRAW_DIST); + CreateObject(2530, 1171.13, -1443.79, 14.79, 0.00, 0.00, -182.16, MALL_OBJECT_DRAW_DIST); + CreateObject(1991, 1173.75, -1439.56, 14.79, 0.00, 0.00, 179.47, MALL_OBJECT_DRAW_DIST); + CreateObject(1996, 1169.82, -1439.50, 14.79, 0.00, 0.00, 179.10, MALL_OBJECT_DRAW_DIST); + CreateObject(1996, 1174.24, -1435.38, 14.79, 0.00, 0.00, 179.24, MALL_OBJECT_DRAW_DIST); + CreateObject(1991, 1175.23, -1435.39, 14.79, 0.00, 0.00, 179.57, MALL_OBJECT_DRAW_DIST); + CreateObject(1995, 1182.65, -1435.10, 14.79, 0.00, 0.00, 90.00, MALL_OBJECT_DRAW_DIST); + CreateObject(1994, 1182.66, -1438.07, 14.79, 0.00, 0.00, 90.00, MALL_OBJECT_DRAW_DIST); + CreateObject(1993, 1182.66, -1437.08, 14.79, 0.00, 0.00, 90.00, MALL_OBJECT_DRAW_DIST); + CreateObject(2542, 1163.78, -1443.92, 14.76, 0.00, 0.00, 178.77, MALL_OBJECT_DRAW_DIST); + CreateObject(2536, 1166.88, -1445.07, 14.70, 0.00, 0.00, -0.42, MALL_OBJECT_DRAW_DIST); + CreateObject(2542, 1163.70, -1444.93, 14.78, 0.00, 0.00, -1.74, MALL_OBJECT_DRAW_DIST); + CreateObject(1984, 1157.34, -1435.71, 14.79, 0.00, 0.00, -450.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1166.31, -1448.28, 14.75, 0.00, 0.00, -180.12, MALL_OBJECT_DRAW_DIST); + CreateObject(2530, 1172.14, -1443.83, 14.79, 0.00, 0.00, -181.38, MALL_OBJECT_DRAW_DIST); + CreateObject(2530, 1173.14, -1443.85, 14.79, 0.00, 0.00, -180.96, MALL_OBJECT_DRAW_DIST); + CreateObject(2530, 1174.13, -1443.88, 14.79, 0.00, 0.00, -181.50, MALL_OBJECT_DRAW_DIST); + CreateObject(1981, 1170.76, -1439.52, 14.79, 0.00, 0.00, -181.74, MALL_OBJECT_DRAW_DIST); + CreateObject(1981, 1171.76, -1439.54, 14.79, 0.00, 0.00, -180.80, MALL_OBJECT_DRAW_DIST); + CreateObject(1981, 1172.75, -1439.55, 14.79, 0.00, 0.00, -180.84, MALL_OBJECT_DRAW_DIST); + CreateObject(2535, 1182.75, -1447.28, 14.70, 0.00, 0.00, -90.78, MALL_OBJECT_DRAW_DIST); + CreateObject(2535, 1182.74, -1446.28, 14.70, 0.00, 0.00, -90.78, MALL_OBJECT_DRAW_DIST); + CreateObject(2535, 1182.74, -1445.26, 14.70, 0.00, 0.00, -90.00, MALL_OBJECT_DRAW_DIST); + CreateObject(2541, 1182.75, -1444.22, 14.79, 0.00, 0.00, -90.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2541, 1182.75, -1443.20, 14.79, 0.00, 0.00, -90.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2541, 1182.74, -1442.16, 14.79, 0.00, 0.00, -90.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1182.76, -1441.18, 14.79, 0.00, 0.00, -90.84, MALL_OBJECT_DRAW_DIST); + CreateObject(2541, 1182.79, -1440.17, 14.79, 0.00, 0.00, -90.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1182.72, -1439.15, 14.79, 0.00, 0.00, -90.84, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1182.66, -1431.67, 14.79, 0.00, 0.00, 3.30, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1181.63, -1431.73, 14.79, 0.00, 0.00, 3.30, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1180.61, -1431.81, 14.79, 0.00, 0.00, 3.30, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1179.61, -1431.83, 14.79, 0.00, 0.00, 3.30, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1178.61, -1431.89, 14.79, 0.00, 0.00, 3.30, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1177.59, -1431.86, 14.79, 0.00, 0.00, 3.30, MALL_OBJECT_DRAW_DIST); + CreateObject(1993, 1182.66, -1436.09, 14.79, 0.00, 0.00, 90.00, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1175.50, -1431.82, 14.75, 0.00, 0.00, 361.17, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1172.42, -1431.87, 14.75, 0.00, 0.00, 359.93, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1160.10, -1448.35, 14.75, 0.00, 0.00, -179.94, MALL_OBJECT_DRAW_DIST); + CreateObject(2539, 1170.45, -1435.33, 14.79, 0.00, 0.00, 181.26, MALL_OBJECT_DRAW_DIST); + CreateObject(2545, 1161.82, -1431.84, 14.91, 0.00, 0.00, -90.54, MALL_OBJECT_DRAW_DIST); + CreateObject(2545, 1160.82, -1431.83, 14.91, 0.00, 0.00, -90.54, MALL_OBJECT_DRAW_DIST); + CreateObject(2545, 1159.81, -1431.86, 14.91, 0.00, 0.00, -90.54, MALL_OBJECT_DRAW_DIST); + CreateObject(2545, 1162.82, -1431.87, 14.91, 0.00, 0.00, -90.54, MALL_OBJECT_DRAW_DIST); + CreateObject(1988, 1163.13, -1435.34, 14.79, 0.00, 0.00, 541.46, MALL_OBJECT_DRAW_DIST); + CreateObject(1988, 1166.07, -1436.32, 14.79, 0.00, 0.00, 360.80, MALL_OBJECT_DRAW_DIST); + CreateObject(1987, 1165.07, -1436.33, 14.79, 0.00, 0.00, 361.06, MALL_OBJECT_DRAW_DIST); + CreateObject(1987, 1166.11, -1435.30, 14.77, 0.00, 0.00, 180.96, MALL_OBJECT_DRAW_DIST); + CreateObject(1988, 1165.07, -1435.31, 14.79, 0.00, 0.00, 540.44, MALL_OBJECT_DRAW_DIST); + CreateObject(2536, 1165.79, -1445.07, 14.70, 0.00, 0.00, -1.20, MALL_OBJECT_DRAW_DIST); + CreateObject(2536, 1167.83, -1445.07, 14.70, 0.00, 0.00, -0.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1165.79, -1444.00, 14.79, 0.00, 0.00, 178.27, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1166.81, -1444.03, 14.79, 0.00, 0.00, 179.35, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1167.79, -1444.04, 14.79, 0.00, 0.00, 179.89, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1168.13, -1435.36, 14.79, 0.00, 0.00, 180.05, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1167.10, -1435.37, 14.79, 0.00, 0.00, 180.35, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1170.63, -1440.67, 14.75, 0.00, 0.00, 359.50, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1173.77, -1440.72, 14.75, 0.00, 0.00, 359.82, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1177.30, -1445.31, 14.75, 0.00, 0.00, 359.93, MALL_OBJECT_DRAW_DIST); + CreateObject(1996, 1173.36, -1448.30, 14.79, 0.00, 0.00, 179.10, MALL_OBJECT_DRAW_DIST); + CreateObject(1981, 1174.33, -1448.32, 14.79, 0.00, 0.00, -181.74, MALL_OBJECT_DRAW_DIST); + CreateObject(1981, 1175.32, -1448.35, 14.79, 0.00, 0.00, -180.84, MALL_OBJECT_DRAW_DIST); + CreateObject(1981, 1176.30, -1448.37, 14.79, 0.00, 0.00, -180.84, MALL_OBJECT_DRAW_DIST); + CreateObject(1991, 1177.28, -1448.37, 14.79, 0.00, 0.00, 179.47, MALL_OBJECT_DRAW_DIST); + CreateObject(1996, 1178.33, -1448.36, 14.79, 0.00, 0.00, 179.24, MALL_OBJECT_DRAW_DIST); + CreateObject(1991, 1179.33, -1448.37, 14.79, 0.00, 0.00, 179.57, MALL_OBJECT_DRAW_DIST); + CreateObject(1994, 1176.82, -1444.16, 14.79, 0.00, 0.00, -0.84, MALL_OBJECT_DRAW_DIST); + CreateObject(1995, 1178.81, -1444.20, 14.79, 0.00, 0.00, -1.26, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1168.89, -1444.06, 14.79, 0.00, 0.00, 178.97, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1169.91, -1444.07, 14.79, 0.00, 0.00, 179.69, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1169.87, -1445.12, 14.79, 0.00, 0.00, -0.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1168.86, -1445.11, 14.79, 0.00, 0.00, 0.31, MALL_OBJECT_DRAW_DIST); + CreateObject(2538, 1167.02, -1431.87, 14.79, 0.00, 0.00, 0.42, MALL_OBJECT_DRAW_DIST); + CreateObject(2539, 1166.03, -1431.89, 14.79, 0.00, 0.00, 0.70, MALL_OBJECT_DRAW_DIST); + CreateObject(2540, 1164.04, -1431.91, 14.79, 0.00, 0.00, 0.60, MALL_OBJECT_DRAW_DIST); + CreateObject(2539, 1165.03, -1431.91, 14.79, 0.00, 0.00, 1.02, MALL_OBJECT_DRAW_DIST); + CreateObject(2538, 1176.17, -1436.38, 14.79, 0.00, 0.00, 0.24, MALL_OBJECT_DRAW_DIST); + CreateObject(2539, 1174.22, -1436.37, 14.79, 0.00, 0.00, -0.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2540, 1173.22, -1436.36, 14.79, 0.00, 0.00, 0.18, MALL_OBJECT_DRAW_DIST); + CreateObject(2539, 1175.20, -1436.38, 14.79, 0.00, 0.00, -2.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2540, 1173.26, -1435.31, 14.79, 0.00, 0.00, 180.17, MALL_OBJECT_DRAW_DIST); + CreateObject(1991, 1175.74, -1439.58, 14.79, 0.00, 0.00, 179.57, MALL_OBJECT_DRAW_DIST); + CreateObject(1996, 1174.74, -1439.57, 14.79, 0.00, 0.00, 179.24, MALL_OBJECT_DRAW_DIST); + CreateObject(1996, 1176.17, -1435.37, 14.79, 0.00, 0.00, 179.24, MALL_OBJECT_DRAW_DIST); + CreateObject(1991, 1177.16, -1435.38, 14.79, 0.00, 0.00, 179.57, MALL_OBJECT_DRAW_DIST); + CreateObject(2540, 1169.44, -1436.35, 14.79, 0.00, 0.00, 0.18, MALL_OBJECT_DRAW_DIST); + CreateObject(2539, 1170.43, -1436.35, 14.79, 0.00, 0.00, 0.90, MALL_OBJECT_DRAW_DIST); + CreateObject(2539, 1171.34, -1436.33, 14.79, 0.00, 0.00, 0.58, MALL_OBJECT_DRAW_DIST); + CreateObject(2538, 1172.22, -1436.32, 14.79, 0.00, 0.00, 0.30, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1163.40, -1440.68, 14.79, 0.00, 0.00, 360.41, MALL_OBJECT_DRAW_DIST); + CreateObject(2536, 1164.49, -1440.73, 14.70, 0.00, 0.00, -1.20, MALL_OBJECT_DRAW_DIST); + CreateObject(2536, 1165.49, -1440.75, 14.70, 0.00, 0.00, -0.42, MALL_OBJECT_DRAW_DIST); + CreateObject(2536, 1166.50, -1440.75, 14.70, 0.00, 0.00, -0.06, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1167.61, -1440.64, 14.79, 0.00, 0.00, 0.31, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1168.62, -1440.64, 14.79, 0.00, 0.00, 0.30, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1168.64, -1439.60, 14.79, 0.00, 0.00, 180.05, MALL_OBJECT_DRAW_DIST); + CreateObject(2543, 1167.67, -1439.61, 14.79, 0.00, 0.00, 180.35, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1163.65, -1439.67, 14.79, 0.00, 0.00, 180.61, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1164.68, -1439.67, 14.79, 0.00, 0.00, 179.77, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1165.68, -1439.68, 14.79, 0.00, 0.00, 180.61, MALL_OBJECT_DRAW_DIST); + CreateObject(2871, 1166.68, -1439.66, 14.79, 0.00, 0.00, 180.61, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1175.09, -1444.97, 14.79, 0.00, 0.00, -2.46, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1181.63, -1431.73, 14.79, 0.00, 0.00, 3.30, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1174.07, -1444.94, 14.79, 0.00, 0.00, 0.48, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1173.09, -1444.94, 14.79, 0.00, 0.00, -1.20, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1172.11, -1444.92, 14.79, 0.00, 0.00, -1.14, MALL_OBJECT_DRAW_DIST); + CreateObject(1990, 1171.12, -1444.91, 14.79, 0.00, 0.00, -0.72, MALL_OBJECT_DRAW_DIST); + CreateObject(2530, 1168.54, -1448.31, 14.79, 0.00, 0.00, -178.98, MALL_OBJECT_DRAW_DIST); + CreateObject(2530, 1169.60, -1448.29, 14.79, 0.00, 0.00, -178.98, MALL_OBJECT_DRAW_DIST); + CreateObject(2530, 1170.67, -1448.30, 14.79, 0.00, 0.00, -178.98, MALL_OBJECT_DRAW_DIST); + CreateObject(2530, 1171.72, -1448.32, 14.79, 0.00, 0.00, -181.50, MALL_OBJECT_DRAW_DIST); + CreateObject(2530, 1175.13, -1443.91, 14.79, 0.00, 0.00, -181.50, MALL_OBJECT_DRAW_DIST); + CreateObject(2012, 1176.82, -1440.75, 14.75, 0.00, 0.00, 359.93, MALL_OBJECT_DRAW_DIST); + CreateObject(1995, 1177.71, -1439.63, 14.79, 0.00, 0.00, 0.00, MALL_OBJECT_DRAW_DIST); + CreateObject(1994, 1176.73, -1439.63, 14.79, 0.00, 0.00, 0.06, MALL_OBJECT_DRAW_DIST); + CreateObject(1993, 1177.83, -1444.15, 14.79, 0.00, 0.00, 179.46, MALL_OBJECT_DRAW_DIST); + + return 1; +} diff --git a/filterscripts/ls_prisonwalls.amx b/filterscripts/ls_prisonwalls.amx new file mode 100644 index 0000000..40c1b8a Binary files /dev/null and b/filterscripts/ls_prisonwalls.amx differ diff --git a/filterscripts/ls_prisonwalls.pwn b/filterscripts/ls_prisonwalls.pwn new file mode 100644 index 0000000..e7a2469 --- /dev/null +++ b/filterscripts/ls_prisonwalls.pwn @@ -0,0 +1,404 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the LS Prison Walls and Gate Objects +// ------------------------------------------------------------- +// By Matite in February 2015 +// +// +// This script creates the new LS Prison Walls object, removes the existing +// GTASA object and creates 2 sets of opening gates. +// +// Warning... +// This script uses a total of: +// * 5 objects = 1 for the replacement walls and 4 for the replacement gates +// * 2 3D Text Labels = 1 on each set of gates +// * Enables the /lsp command to teleport the player to the eastern prison gates +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + +// For PlaySoundForPlayersInRange() +#include "../include/gl_common.inc" + + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Used for the eastern and southern prison gates status flags +#define GATES_CLOSED 0 +#define GATES_CLOSING 1 +#define GATES_OPEN 2 +#define GATES_OPENING 3 + +// Used for messages sent to the player +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + + +// ----------------------------------------------------------------------------- +// Constants +// --------- + +// Gate names for the 3D text labels +static GateNames[2][] = +{ + "Eastern Gates", + "Southern Gates" +}; + + +// ----------------------------------------------------------------------------- +// Variables +// --------- + +// Stores the created object number of the replacement prison walls so it can +// be destroyed when the filterscript is unloaded +new LSPrisonWallsObject; + +// Stores the created object numbers of the prison walls gates so they can be +// opened or closed and destroyed when the filterscript is unloaded +new LSPrisonGatesObject[4]; + +// Stores a reference to the 3D text labels used on each set of gates so they +// can be destroyed when the filterscript is unloaded +new Text3D:LabelGates[2]; + +// Stores the current status of the eastern prison gates +new EasternGatesStatus = GATES_CLOSED; + +// Stores the current status of the southern prison gates +new SouthernGatesStatus = GATES_CLOSED; + + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/lsp", cmdtext, true, 4) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 0); + + // Set player position and facing angle + SetPlayerPos(playerid, 1830.66 + random(2), -1538.46, 14.5); + SetPlayerFacingAngle(playerid, 85); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~LS Prison!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- LS Prison Walls Filterscript"); + print(" |-- Script v1.01"); + print(" |-- 13th February 2015"); + print(" |---------------------------------------------------"); + + // Create the LS Prison Walls object + LSPrisonWallsObject = CreateObject(19794, 1787.13, -1565.68, 11.9688, 0, 0, 0); + + // Display information in the Server Console + print(" |-- LS Prison Walls object created"); + + // Create the LS Prison Walls Eastern Gates objects + LSPrisonGatesObject[0] = CreateObject(19795, 1824.318481, -1534.731201, 14.296878 - 0.01, 0, 0, 343.0); + LSPrisonGatesObject[1] = CreateObject(19795, 1822.407592, -1540.949951, 14.296878 - 0.01, 0, 0, 163.0); + + // Create the LS Prison Walls Southern Gates objects + LSPrisonGatesObject[2] = CreateObject(19796, 1752.004150, -1591.186523, 14.267195 - 0.01, 0, 0, 77.0); + LSPrisonGatesObject[3] = CreateObject(19796, 1756.914062, -1592.316284, 14.267195 - 0.01, 0, 0, 257.0); + + // Display information in the Server Console + print(" |-- LS Prison Walls Gates objects created"); + + // Create variable + new string[192]; + + // Create 3D Text Label at the prisons eastern gates + format(string, sizeof(string), "{CCCCCC}[%s]\n{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to open or close the gates", GateNames[0]); + LabelGates[0] = Create3DTextLabel(string, 0xCCCCCCAA, 1823.78, -1537.98, 13.54, 10.5, 0, 1); + + // Create 3D Text Label at the prisons eastern gates + format(string, sizeof(string), "{CCCCCC}[%s]\n{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to open or close the gates", GateNames[1]); + LabelGates[1] = Create3DTextLabel(string, 0xCCCCCCAA, 1754.27, -1592.18, 13.54, 10.5, 0, 1); + + // Display information in the Server Console + print(" |-- LS Prison Wall Gates 3D Text Labels created"); + print(" |---------------------------------------------------"); + + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove default GTASA LS Prison Walls and LOD map objects for the player + // (so any player currently ingame does not have to rejoin for them + // to be removed when this filterscript is loaded) + RemoveBuildingForPlayer(i, 4000, 1787.13, -1565.68, 11.9688, 250.0); // Walls + RemoveBuildingForPlayer(i, 4080, 1787.13, -1565.68, 11.9688, 250.0); // LOD + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Check for valid object + if (IsValidObject(LSPrisonWallsObject)) + { + // Destroy the LS Prison Walls object + DestroyObject(LSPrisonWallsObject); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- LS Prison Walls object destroyed"); + } + + // Check for valid object + if (IsValidObject(LSPrisonGatesObject[0])) + { + // Destroy the LS Prison Walls Eastern Gates object 1 + DestroyObject(LSPrisonGatesObject[0]); + + // Display information in the Server Console + print(" |-- LS Prison Walls Eastern Gates object 1 destroyed"); + } + + // Check for valid object + if (IsValidObject(LSPrisonGatesObject[1])) + { + // Destroy the LS Prison Walls Eastern Gates object 2 + DestroyObject(LSPrisonGatesObject[1]); + + // Display information in the Server Console + print(" |-- LS Prison Walls Eastern Gates object 2 destroyed"); + } + + // Check for valid object + if (IsValidObject(LSPrisonGatesObject[2])) + { + // Destroy the LS Prison Walls Southern Gates object 1 + DestroyObject(LSPrisonGatesObject[2]); + + // Display information in the Server Console + print(" |-- LS Prison Walls Southern Gates object 1 destroyed"); + } + + // Check for valid object + if (IsValidObject(LSPrisonGatesObject[3])) + { + // Destroy the LS Prison Walls Southern Gates object 2 + DestroyObject(LSPrisonGatesObject[3]); + + // Display information in the Server Console + print(" |-- LS Prison Walls Southern Gates object 2 destroyed"); + } + + // Destroy 3D Text Labels on the eastern and southern gates + Delete3DTextLabel(LabelGates[0]); + Delete3DTextLabel(LabelGates[1]); + + // Display information in the Server Console + print(" |-- Deleted the 3D Text Labels on the Prison Gates"); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- LS Prison Walls Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove default GTASA LS Prison Walls and LOD map objects for the player + RemoveBuildingForPlayer(playerid, 4000, 1787.13, -1565.68, 11.9688, 250.0); // Walls + RemoveBuildingForPlayer(playerid, 4080, 1787.13, -1565.68, 11.9688, 250.0); // LOD + + // Exit here (return 1 so this callback is handled in other scripts too) + return 1; +} + +public OnObjectMoved(objectid) +{ + // Check if the object that moved was one of the eastern gates + if (objectid == LSPrisonGatesObject[0]) + { + // Check if the eastern gates were closing + if (EasternGatesStatus == GATES_CLOSING) + { + // Set status flag for eastern gates + EasternGatesStatus = GATES_CLOSED; + } + else + { + // Set status flag for eastern gates + EasternGatesStatus = GATES_OPEN; + } + } + // Check if the object that moved was one of the southern gates + else if (objectid == LSPrisonGatesObject[2]) + { + // Check if the southern gates were closing + if (SouthernGatesStatus == GATES_CLOSING) + { + // Set status flag for southern gates + SouthernGatesStatus = GATES_CLOSED; + } + else + { + // Set status flag for southern gates + SouthernGatesStatus = GATES_OPEN; + } + } + + // Exit here + return 1; +} + +public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) +{ + // Check if the player pressed the conversation yes key (normally the Y key) + if (newkeys & KEY_YES) + { + // Check if the player is outside the eastern prison gates + if (IsPlayerInRangeOfPoint(playerid, 10.0, 1823.78, -1537.98, 13.54)) + { + // Debug + //printf("-->Player ID %d within 10m of the Eastern Prison Gates", playerid); + + // Check if the eastern gates are not currently opening (ie moving) + if (EasternGatesStatus == GATES_OPENING) + { + // Send chat text message and exit here + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must wait for the eastern gates to fully open first."); + return 1; + } + // Check if the eastern gates are not currently closing (ie moving) + else if (EasternGatesStatus == GATES_CLOSING) + { + // Send chat text message and exit here + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must wait for the eastern gates to fully close first."); + return 1; + } + + // Play gate opening sound + PlaySoundForPlayersInRange(1035, 50.0, 1823.78, -1537.98, 13.54); + + // Check if the eastern gates are currently open or closed + if (EasternGatesStatus == GATES_CLOSED) + { + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Eastern Prison~n~~b~~h~Gates Opening!", 3000, 3); + + // Animate the eastern gates opening (the small Z offset is required) + MoveObject(LSPrisonGatesObject[0], 1824.318481, -1534.731201, 14.296878 + 0.01, 0.002, 0, 0, 258); + + // Animate the eastern gates opening (the small Z offset is required) + MoveObject(LSPrisonGatesObject[1], 1822.407592, -1540.949951, 14.296878 + 0.01, 0.002, 0, 0, 253); + + // Set status flag for eastern gates + EasternGatesStatus = GATES_OPENING; + } + else + { + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Eastern Prison~n~~b~~h~Gates Closing!", 3000, 3); + + // Animate the eastern gates closing (the small Z offset is required) + MoveObject(LSPrisonGatesObject[0], 1824.318481, -1534.731201, 14.296878 - 0.01, 0.002, 0, 0, 343); + + // Animate the eastern gates closing (the small Z offset is required) + MoveObject(LSPrisonGatesObject[1], 1822.407592, -1540.949951, 14.296878 - 0.01, 0.002, 0, 0, 163); + + // Set status flag for eastern gates + EasternGatesStatus = GATES_CLOSING; + } + } + // Check if the player is outside the southern prison gates + else if (IsPlayerInRangeOfPoint(playerid, 10.0, 1754.27, -1592.18, 13.54)) + { + // Debug + //printf("-->Player ID %d within 10m of the Southern Prison Gates", playerid); + + // Check if the southern gates are not currently opening (ie moving) + if (SouthernGatesStatus == GATES_OPENING) + { + // Send chat text message and exit here + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must wait for the southern gates to fully open first."); + return 1; + } + // Check if the southern gates are not currently closing (ie moving) + else if (SouthernGatesStatus == GATES_CLOSING) + { + // Send chat text message and exit here + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must wait for the southern gates to fully close first."); + return 1; + } + + // Play gate opening sound + PlaySoundForPlayersInRange(1035, 50.0, 1754.27, -1592.18, 13.54); + + // Check if the southern gates are currently open or closed + if (SouthernGatesStatus == GATES_CLOSED) + { + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Southern Prison~n~~b~~h~Gates Opening!", 3000, 3); + + // Animate the southern gates opening (the small Z offset is required) + MoveObject(LSPrisonGatesObject[2], 1752.004150, -1591.186523, 14.267195 + 0.01, 0.002, 0, 0, 172); + + // Animate the southern gates opening (the small Z offset is required) + MoveObject(LSPrisonGatesObject[3], 1756.914062, -1592.316284, 14.267195 + 0.01, 0.002, 0, 0, 187); + + // Set status flag for southern gates + SouthernGatesStatus = GATES_OPENING; + } + else + { + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Southern Prison~n~~b~~h~Gates Closing!", 3000, 3); + + // Animate the southern gates closing (the small Z offset is required) + MoveObject(LSPrisonGatesObject[2], 1752.004150, -1591.186523, 14.267195 - 0.01, 0.002, 0, 0, 77); + + // Animate the southern gates closing (the small Z offset is required) + MoveObject(LSPrisonGatesObject[3], 1756.914062, -1592.316284, 14.267195 - 0.01, 0.002, 0, 0, 257); + + // Set status flag for southern gates + SouthernGatesStatus = GATES_CLOSING; + } + } + } + + // Exit here (return 1 so this callback is handled in other scripts too) + return 1; +} + diff --git a/filterscripts/ls_wellsfargo.amx b/filterscripts/ls_wellsfargo.amx new file mode 100644 index 0000000..ae85f01 Binary files /dev/null and b/filterscripts/ls_wellsfargo.amx differ diff --git a/filterscripts/ls_wellsfargo.pwn b/filterscripts/ls_wellsfargo.pwn new file mode 100644 index 0000000..186829e --- /dev/null +++ b/filterscripts/ls_wellsfargo.pwn @@ -0,0 +1,139 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the LS Wells Fargo Building Object +// ----------------------------------------------------------- +// By Matite in March 2015 +// +// +// This script creates the edited LS Wells Fargo Building object and +// removes the existing GTASA building object. +// +// Warning... +// This script uses a total of: +// * 1 object = 1 for the replacement building object +// * Enables the /lswf command to teleport the player to the LS Wells Fargo Building +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Used for messages sent to the player +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + + +// ----------------------------------------------------------------------------- +// Variables +// --------- + +// Stores the created object number of the replacement building object so +// it can be destroyed when the filterscript is unloaded +new LSWellsFargoObject1; // Building object + + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/lswf", cmdtext, true, 5) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 0); + + // Set player position and facing angle + SetPlayerPos(playerid, 1448.43, -1468.28, 13.82); + SetPlayerFacingAngle(playerid, 92); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~LS Wells Fargo!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- LS Wells Fargo Building Filterscript"); + print(" |-- Script v1.01"); + print(" |-- 6th March 2015"); + print(" |---------------------------------------------------"); + + // Create the LS Wells Fargo Building object + LSWellsFargoObject1 = CreateObject(19879, 1421.38, -1477.6, 42.2031, 0, 0, 0); + + // Display information in the Server Console + print(" |-- LS Wells Fargo Building object created"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove default GTASA Wells Fargo Building and LOD map objects for the player + // (so any player currently ingame does not have to rejoin for them + // to be removed when this filterscript is loaded) + RemoveBuildingForPlayer(i, 4007, 1421.38, -1477.6, 42.2031, 250.0); // Building + RemoveBuildingForPlayer(i, 4009, 1421.38, -1477.6, 42.2031, 250.0); // LOD + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Check for valid object + if (IsValidObject(LSWellsFargoObject1)) + { + // Destroy the Wells Fargo Building object + DestroyObject(LSWellsFargoObject1); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- LS Wells Fargo Building object destroyed"); + } + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- LS Wells Fargo Building Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove default GTASA Wells Fargo Building and LOD map objects for the player + RemoveBuildingForPlayer(playerid, 4007, 1421.38, -1477.6, 42.2031, 250.0); // Building + RemoveBuildingForPlayer(playerid, 4009, 1421.38, -1477.6, 42.2031, 250.0); // LOD + + // Exit here (return 1 so this callback is handled in other scripts too) + return 1; +} + diff --git a/filterscripts/maxips.amx b/filterscripts/maxips.amx new file mode 100644 index 0000000..9b88ccf Binary files /dev/null and b/filterscripts/maxips.amx differ diff --git a/filterscripts/maxips.pwn b/filterscripts/maxips.pwn new file mode 100644 index 0000000..fc1a58d --- /dev/null +++ b/filterscripts/maxips.pwn @@ -0,0 +1,52 @@ +// maxips FS limits the number of players connecting from a +// single IP address. + +#include + +#define MAX_CONNECTIONS_FROM_IP 3 + +//--------------------------------------------- + +public OnFilterScriptInit() +{ + printf("\n*** Player IP limiting FS (maxips) Loaded. Max connections from 1 IP = %d\n",MAX_CONNECTIONS_FROM_IP); +} + +//--------------------------------------------- +// GetNumberOfPlayersOnThisIP +// Returns the number of players connecting from the +// provided IP address + +stock GetNumberOfPlayersOnThisIP(test_ip[]) +{ + new against_ip[32+1]; + new x = 0; + new ip_count = 0; + for(x=0; x MAX_CONNECTIONS_FROM_IP) { + printf("MAXIPs: Connecting player(%d) exceeded %d IP connections from %s.", playerid, MAX_CONNECTIONS_FROM_IP, connecting_ip); + Kick(playerid); + return 1; + } + + return 0; +} + +//--------------------------------------------- + diff --git a/filterscripts/menutest.amx b/filterscripts/menutest.amx new file mode 100644 index 0000000..8075e6e Binary files /dev/null and b/filterscripts/menutest.amx differ diff --git a/filterscripts/menutest.pwn b/filterscripts/menutest.pwn new file mode 100644 index 0000000..b5dbce4 --- /dev/null +++ b/filterscripts/menutest.pwn @@ -0,0 +1,53 @@ +// Test menu functionality filterscipt + +#include + +#define TEST_MENU_ITEMS 6 + +new Menu:TestMenu; +new TestMenuStrings[6][16] = {"Test1", "Test2", "Test3", "Test4", "Test5", "Test6"}; + +HandleTestMenuSelection(playerid, row) +{ + new s[256]; + + if(row < TEST_MENU_ITEMS) { + format(s,256,"You selected item %s",TestMenuStrings[row]); + SendClientMessage(playerid,0xFFFFFFFF,s); + } +} + +InitTestMenu() +{ + TestMenu = CreateMenu("Test Menu", 1, 200.0, 150.0, 200.0, 200.0); + + for(new x=0; x < TEST_MENU_ITEMS; x++) { + AddMenuItem(TestMenu, 0, TestMenuStrings[x]); + } +} + +public OnFilterScriptInit() +{ + InitTestMenu(); +} + +public OnPlayerSelectedMenuRow(playerid, row) +{ + new Menu:PlayerMenu = GetPlayerMenu(playerid); + + if(PlayerMenu == TestMenu) { + HandleTestMenuSelection(playerid, row); + } +} + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + if(!strcmp(cmdtext, "/menutest", true)) { + ShowMenuForPlayer(TestMenu, playerid); + return 1; + } + return 0; +} + + + diff --git a/filterscripts/modular_houses.amx b/filterscripts/modular_houses.amx new file mode 100644 index 0000000..ddc3136 Binary files /dev/null and b/filterscripts/modular_houses.amx differ diff --git a/filterscripts/modular_houses.pwn b/filterscripts/modular_houses.pwn new file mode 100644 index 0000000..4ac1f14 --- /dev/null +++ b/filterscripts/modular_houses.pwn @@ -0,0 +1,363 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the new Modular House Objects +// ------------------------------------------------------ +// By Matite in February 2015 +// +// This script creates a Modular Island with Modular Houses just off the coast +// in SF (near Jizzy's Nightclub). +// +// Warning... +// This script uses a total of 205 player objects and enables the /mh teleport +// command by default. +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP Include +#include + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Used for chat text messages +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/mh", cmdtext, true, 3) == 0) + { + // Set the player interior + SetPlayerInterior(playerid, 0); + + // Check if the player is in any vehicle + if (IsPlayerInAnyVehicle(playerid)) + { + // In a Vehicle + // ------------ + + // Set vehicle position and facing angle + SetVehiclePos(GetPlayerVehicleID(playerid), -3305.72 + random(2), 1602.27 + random(2), 6.2); + SetVehicleZAngle(GetPlayerVehicleID(playerid), 233); + + // Link vehicle to interior + LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0); + } + else + { + // On Foot + // ------- + + // Set player position and facing angle + SetPlayerPos(playerid, -3305.72 + random(2), 1602.27 + random(2), 6.2); + SetPlayerFacingAngle(playerid, 233); + } + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Modular Houses!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- Modular Houses Filterscript by Matite"); + print(" |-- Script v1.01"); + print(" |-- 28th February 2015"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Create modular houses and island objects for the player + // (so any player currently ingame does not have to rejoin for them + // to appear when this filterscript is loaded) + CreateMHObjects(i); + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Modular Houses Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Create modular houses and island objects for the player + CreateMHObjects(playerid); + + // Exit here + return 1; +} + +CreateMHObjects(playerid) +{ + // Create variable + new TempObjectNumber; + + // Create modular houses and island player objects (with draw distance of 999m) + CreatePlayerObject(playerid,19867,-3233.1538,1472.8060,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19849,-3250.0000,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19539,-3343.1260,1608.7500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19855,-3250.0000,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19854,-3250.0000,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19856,-3250.0000,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19851,-3218.7495,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19850,-3281.2505,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19532,-3234.3757,1461.2500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19852,-3187.4990,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19853,-3187.4993,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19850,-3218.7498,1562.5000,4.0000,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19850,-3250.0002,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19532,-3304.3760,1531.2500,4.0000,-0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19532,-3164.3757,1531.2500,4.0000,-0.0000,0.0000,0.0000,999.0); + + // Create exterior building object and change roof tile texture + TempObjectNumber = CreatePlayerObject(playerid,19854,-3218.7500,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 5520, "BDupsHouse_LAe", "shingles3", 0); + + CreatePlayerObject(playerid,19855,-3218.7500,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19856,-3218.7500,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19856,-3187.5000,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19855,-3187.5000,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + + // Create exterior building object and change roof tile texture + TempObjectNumber = CreatePlayerObject(playerid,19854,-3187.5000,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 5986, "chateau_lawn", "chatshade02_law", 0); + + CreatePlayerObject(playerid,19856,-3281.2500,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19855,-3281.2500,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + + // Create exterior building object and change roof tile texture + TempObjectNumber = CreatePlayerObject(playerid,19854,-3281.2500,1500.0000,4.0000,0.0000,0.0000,0.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 6284, "bev_law2", "shinglegrey_la", 0); + + CreatePlayerObject(playerid,19849,-3281.2507,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + + // Create exterior building object and change roof tile texture + TempObjectNumber = CreatePlayerObject(playerid,19854,-3281.2507,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 6283, "pierb_law2", "rooftiles2", 0); + + CreatePlayerObject(playerid,19855,-3281.2507,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19856,-3281.2507,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19532,-3234.3757,1601.2500,4.0000,0.0000,0.0000,90.0000,999.0); + + // Create exterior building object and change roof tile texture + TempObjectNumber = CreatePlayerObject(playerid,19854,-3250.0007,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 13721, "mulhousclahills", "sjmlahus26", 0); + + CreatePlayerObject(playerid,19855,-3250.0007,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19856,-3250.0007,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19856,-3218.7507,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + + // Create exterior building object and change roof tile texture + TempObjectNumber = CreatePlayerObject(playerid,19854,-3218.7507,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 3484, "vegashse5", "shingles1", 0); + + CreatePlayerObject(playerid,19855,-3218.7507,1562.5000,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19542,-3031.8757,1531.2500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19529,-3094.3757,1531.2500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19536,-3343.1260,1531.2500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19542,-3374.3760,1531.2500,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19532,-3094.3757,1461.2500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19788,-3304.3760,1461.2500,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19532,-3094.3757,1601.2500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19535,-3164.3757,1601.2500,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19788,-3304.3760,1601.2500,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19541,-3031.8757,1461.2500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19541,-3031.8757,1601.2500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19541,-3374.3760,1601.2500,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19541,-3374.3760,1461.2500,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19543,-3343.1260,1461.2500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19543,-3343.1260,1601.2500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19542,-3094.3757,1608.7500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19542,-3234.3757,1608.7500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19541,-3304.3760,1608.7500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19541,-3164.3757,1608.7500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19540,-3031.8757,1608.7500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19540,-3374.3760,1608.7500,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19529,-3094.3757,1391.2500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19534,-3164.3757,1461.2500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19532,-3164.3757,1391.2500,4.0000,-0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19529,-3234.3757,1391.2500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19543,-3304.3757,1422.5000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19543,-3304.3757,1360.0000,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19542,-3234.3757,1328.7500,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19542,-3094.3757,1328.7500,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19542,-3031.8757,1391.2500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19540,-3031.8757,1328.7500,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19541,-3164.3757,1328.7500,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19541,-3304.3757,1328.7500,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19546,-3311.8757,1453.7500,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19539,-3311.8757,1360.0000,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19540,-3311.8757,1328.7500,4.0000,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19540,-3374.3760,1453.7500,4.0000,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1471.3014,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1476.3118,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1481.3260,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1486.3364,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1506.3838,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1501.3734,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1491.3488,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1496.3591,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1511.3954,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1516.4058,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1521.4200,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1526.4304,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1531.4427,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1536.4531,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1541.4674,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1546.4778,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1551.4934,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1556.5038,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1561.5181,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1566.5284,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1571.5409,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1576.5511,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1581.5654,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8906,1586.5758,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19865,-3171.8921,1591.2007,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19866,-3265.6252,1479.1422,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19866,-3265.6252,1474.1422,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19866,-3234.3748,1474.1422,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19866,-3234.3748,1479.1422,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19867,-3295.6548,1472.8060,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19867,-3264.4043,1472.8060,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,877,-3217.8623,1518.8107,5.6301,0.0000,0.0000,-46.0000,999.0); + CreatePlayerObject(playerid,19867,-3201.9033,1472.8060,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19867,-3204.3455,1589.6940,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19867,-3235.5959,1589.6940,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19867,-3266.8464,1589.6940,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19857,-3282.5649,1489.4465,5.9775,0.0000,0.0000,85.0000,999.0); + CreatePlayerObject(playerid,19858,-3251.3149,1489.4470,5.9780,0.0000,0.0000,85.0000,999.0); + CreatePlayerObject(playerid,19859,-3220.0649,1489.4470,5.9780,0.0000,0.0000,85.0000,999.0); + CreatePlayerObject(playerid,19860,-3188.8149,1489.4470,5.9780,0.0000,0.0000,85.0000,999.0); + CreatePlayerObject(playerid,19857,-3217.4358,1573.0535,5.9775,0.0000,0.0000,-95.0000,999.0); + CreatePlayerObject(playerid,19859,-3248.6858,1573.0535,5.9780,0.0000,0.0000,-95.0000,999.0); + CreatePlayerObject(playerid,19860,-3279.9358,1573.0535,5.9780,0.0000,0.0000,-95.0000,999.0); + CreatePlayerObject(playerid,19861,-3272.7583,1481.9060,6.4885,-85.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19862,-3241.5083,1483.8816,6.4880,-90.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19863,-3210.2583,1483.8196,6.4880,-90.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19864,-3179.0083,1483.8199,6.4880,-90.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19861,-3227.2424,1580.5940,6.4885,-85.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19862,-3258.4924,1578.5750,6.4635,-90.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19863,-3289.7424,1578.5652,6.4880,-90.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19868,-3315.4624,1593.7500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19868,-3312.8430,1591.1295,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19868,-3312.8430,1585.8579,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19868,-3312.8430,1580.5906,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19868,-3312.8430,1564.7810,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19868,-3312.8430,1570.0482,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19868,-3312.8430,1575.3198,4.0000,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19868,-3326.0046,1593.7500,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19868,-3315.4624,1562.1616,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19868,-3326.0046,1562.1616,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19868,-3328.6240,1564.7810,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19868,-3328.6240,1570.0482,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19868,-3328.6240,1575.3198,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19868,-3328.6240,1580.5906,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19868,-3328.6240,1585.8579,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19868,-3328.6240,1591.1295,4.0000,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19868,-3320.7344,1562.1616,4.0000,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,1226,-3296.4019,1467.9758,7.8744,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,1226,-3265.6252,1467.9758,7.8744,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,1226,-3234.3757,1467.9758,7.8744,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,1226,-3203.1243,1467.9758,7.8744,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,1226,-3172.1250,1467.9758,7.8744,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,1226,-3204.2439,1594.5591,7.8744,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,1226,-3234.3757,1594.5591,7.8744,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,1226,-3265.6255,1594.5591,7.8744,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,1226,-3296.7024,1594.5591,7.8744,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,1226,-3172.4277,1594.5591,7.8744,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,1226,-3314.0095,1563.0968,7.8744,0.0000,0.0000,-45.0000,999.0); + CreatePlayerObject(playerid,1226,-3327.6401,1563.3578,7.8744,0.0000,0.0000,-135.0000,999.0); + CreatePlayerObject(playerid,1226,-3327.4702,1592.8082,7.8744,0.0000,0.0000,135.0000,999.0); + CreatePlayerObject(playerid,1226,-3313.7534,1592.6093,7.8744,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,762,-3321.2837,1460.1271,8.1565,0.0000,0.0000,-136.0000,999.0); + CreatePlayerObject(playerid,762,-3321.2837,1478.6985,8.1565,0.0000,0.0000,-178.0000,999.0); + CreatePlayerObject(playerid,762,-3321.2837,1497.2699,8.1565,0.0000,0.0000,166.0000,999.0); + CreatePlayerObject(playerid,762,-3321.2837,1515.8413,8.1565,0.0000,0.0000,128.0000,999.0); + CreatePlayerObject(playerid,762,-3321.2837,1534.4127,8.1565,0.0000,0.0000,82.0000,999.0); + CreatePlayerObject(playerid,762,-3321.2837,1552.9843,8.1565,0.0000,0.0000,37.0000,999.0); + CreatePlayerObject(playerid,762,-3141.8879,1484.2739,8.1565,0.0000,0.0000,-136.0000,999.0); + CreatePlayerObject(playerid,762,-3141.8879,1502.8453,8.1565,0.0000,0.0000,-178.0000,999.0); + CreatePlayerObject(playerid,762,-3141.8879,1521.4167,8.1565,0.0000,0.0000,166.0000,999.0); + CreatePlayerObject(playerid,762,-3141.8879,1539.9882,8.1565,0.0000,0.0000,128.0000,999.0); + CreatePlayerObject(playerid,762,-3141.8879,1558.5596,8.1565,0.0000,0.0000,82.0000,999.0); + CreatePlayerObject(playerid,762,-3141.8879,1577.1311,8.1565,0.0000,0.0000,37.0000,999.0); + CreatePlayerObject(playerid,759,-3174.4050,1591.4492,4.0000,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,759,-3202.9797,1478.9318,4.0000,0.0000,0.0000,82.0000,999.0); + CreatePlayerObject(playerid,759,-3293.6179,1528.0867,4.0000,0.0000,0.0000,-142.0000,999.0); + CreatePlayerObject(playerid,759,-3268.6069,1528.0867,4.0000,0.0000,0.0000,-81.0000,999.0); + CreatePlayerObject(playerid,759,-3280.7466,1528.0867,4.0000,0.0000,0.0000,-38.0000,999.0); + CreatePlayerObject(playerid,759,-3287.2175,1528.0867,4.0000,0.0000,0.0000,11.0000,999.0); + CreatePlayerObject(playerid,759,-3274.6274,1528.0867,4.0000,0.0000,0.0000,63.0000,999.0); + CreatePlayerObject(playerid,808,-3234.3008,1584.7771,5.5884,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,808,-3206.2786,1528.3306,5.5884,0.0000,0.0000,-122.0000,999.0); + CreatePlayerObject(playerid,808,-3231.6143,1528.3306,5.5884,0.0000,0.0000,-32.0000,999.0); + CreatePlayerObject(playerid,885,-3231.0566,1534.4080,3.9827,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,885,-3206.9106,1534.4080,3.9827,0.0000,0.0000,69.0000,999.0); + CreatePlayerObject(playerid,885,-3218.6855,1534.4080,3.9827,0.0000,0.0000,125.0000,999.0); + CreatePlayerObject(playerid,628,-3248.2051,1487.5242,5.9592,0.0000,0.0000,-131.0000,999.0); + CreatePlayerObject(playerid,628,-3226.1389,1523.6616,5.2747,0.0000,0.0000,-120.0000,999.0); + CreatePlayerObject(playerid,628,-3223.3250,1525.0994,5.2747,0.0000,0.0000,-74.0000,999.0); + CreatePlayerObject(playerid,628,-3223.4836,1522.1924,5.2747,0.0000,0.0000,-38.0000,999.0); + CreatePlayerObject(playerid,628,-3220.8762,1574.8800,5.9524,0.0000,0.0000,28.0000,999.0); + CreatePlayerObject(playerid,759,-3211.6606,1513.9496,4.0000,0.0000,0.0000,107.0000,999.0); + CreatePlayerObject(playerid,624,-3264.0588,1529.2220,3.2300,0.0000,0.0000,15.0000,999.0); + CreatePlayerObject(playerid,624,-3236.3870,1529.2220,3.2300,0.0000,0.0000,53.0000,999.0); + CreatePlayerObject(playerid,817,-3263.4792,1533.7153,4.4050,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,817,-3260.5073,1533.7153,4.4050,0.0000,0.0000,30.0000,999.0); + CreatePlayerObject(playerid,817,-3257.5352,1533.7153,4.4050,0.0000,0.0000,54.0000,999.0); + CreatePlayerObject(playerid,817,-3254.5632,1533.7153,4.4050,0.0000,0.0000,72.0000,999.0); + CreatePlayerObject(playerid,817,-3251.5913,1533.7153,4.4050,0.0000,0.0000,39.0000,999.0); + CreatePlayerObject(playerid,817,-3248.6191,1533.7153,4.4050,0.0000,0.0000,39.0000,999.0); + CreatePlayerObject(playerid,817,-3239.8359,1533.7153,4.4050,0.0000,0.0000,105.0000,999.0); + CreatePlayerObject(playerid,817,-3236.8638,1533.7153,4.4050,0.0000,0.0000,47.0000,999.0); + CreatePlayerObject(playerid,817,-3242.8079,1533.7153,4.4050,0.0000,0.0000,68.0000,999.0); + CreatePlayerObject(playerid,817,-3245.7319,1533.7153,4.4050,0.0000,0.0000,28.0000,999.0); + CreatePlayerObject(playerid,817,-3238.2627,1553.1128,4.4050,0.0000,0.0000,82.0000,999.0); + CreatePlayerObject(playerid,817,-3241.5566,1553.1128,4.4050,0.0000,0.0000,125.0000,999.0); + CreatePlayerObject(playerid,817,-3244.4338,1553.1128,4.4050,0.0000,0.0000,153.0000,999.0); + CreatePlayerObject(playerid,817,-3246.8398,1553.1128,4.4050,0.0000,0.0000,-179.0000,999.0); + CreatePlayerObject(playerid,817,-3249.6064,1553.1128,4.4050,0.0000,0.0000,-145.0000,999.0); + CreatePlayerObject(playerid,817,-3252.4700,1553.1128,4.4050,0.0000,0.0000,-96.0000,999.0); + CreatePlayerObject(playerid,817,-3255.2151,1553.1128,4.4050,0.0000,0.0000,-79.0000,999.0); + CreatePlayerObject(playerid,817,-3257.8047,1553.1128,4.4050,0.0000,0.0000,-32.0000,999.0); + CreatePlayerObject(playerid,817,-3265.5815,1582.6428,4.4050,0.0000,0.0000,-14.0000,999.0); + + // Exit here + return 1; +} + diff --git a/filterscripts/modular_island.amx b/filterscripts/modular_island.amx new file mode 100644 index 0000000..6946123 Binary files /dev/null and b/filterscripts/modular_island.amx differ diff --git a/filterscripts/modular_island.pwn b/filterscripts/modular_island.pwn new file mode 100644 index 0000000..e5e1275 --- /dev/null +++ b/filterscripts/modular_island.pwn @@ -0,0 +1,194 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the new Modular Island Objects +// ------------------------------------------------------- +// By Matite in January 2015 +// +// This script creates a Modular Island just off the coast in SF (next to the +// docks near the hospital). +// +// Warning... +// This script uses a total of 87 player objects +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP Include +#include + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +// Un-comment the OnPlayerCommandText callback below (remove the "/*" and the "*/") +// to enable a simple teleport command (/mi) which teleports the player to +// the modular island in SF. + +/* +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/mi", cmdtext, true, 3) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 0); + + // Set player position and facing angle + SetPlayerPos(playerid, -3343.57 + random(2), 194.34 + random(2), 6.2); + SetPlayerFacingAngle(playerid, 315); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Modular Island!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} +*/ + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- Modular Island Filterscript by Matite"); + print(" |-- Script v1.01"); + print(" |-- 12th January 2015"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Create modular island objects for the player + // (so any player currently ingame does not have to rejoin for them + // to appear when this filterscript is loaded) + CreateMIObjects(i); + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Modular Island Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Create modular island objects for the player + CreateMIObjects(playerid); + + // Exit here + return 1; +} + +CreateMIObjects(playerid) +{ + // Create modular island player objects (with draw distance of 599m) + CreatePlayerObject(playerid,19529,-3130.000000,0.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19530,-3130.000000,140.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19531,-3130.000000,280.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19532,-3130.000000,70.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19532,-3130.000000,210.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19533,-3238.750000,210.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19534,-3200.000000,210.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19532,-3200.000000,280.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19534,-3200.000000,70.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19532,-3200.000000,140.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19534,-3200.000000,70.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19532,-3200.000000,0.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19535,-3277.500000,210.000000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19532,-3277.500000,140.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19532,-3277.500000,280.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19532,-3277.500000,0.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19535,-3277.500000,70.000000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19533,-3238.750000,70.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19536,-3238.750000,0.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19537,-3238.750000,140.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19538,-3238.750000,280.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19542,-3052.500000,0.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19541,-3052.500000,70.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19535,-3060.000000,70.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19532,-3060.000000,0.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19532,-3060.000000,140.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19535,-3060.000000,210.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19532,-3060.000000,280.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19542,-3052.500000,140.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19541,-3052.500000,210.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19542,-3052.500000,280.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19540,-3052.500000,-62.500000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19541,-3060.000000,-62.500000,4.000000,0.000000,0.000000,-90.000000, 599.0); + CreatePlayerObject(playerid,19542,-3130.000000,-62.500000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19541,-3200.000000,-62.500000,4.000000,0.000000,0.000000,-90.000000, 599.0); + CreatePlayerObject(playerid,19539,-3238.750000,-62.500000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19541,-3277.500000,-62.500000,4.000000,0.000000,0.000000,-90.000000, 599.0); + CreatePlayerObject(playerid,19540,-3285.000000,-62.500000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19542,-3410.000488,0.000000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19541,-3285.000000,70.000000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19543,-3316.250000,210.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19546,-3285.000000,202.500000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19540,-3472.500000,342.500000,4.000000,0.000000,0.000000,450.000000, 599.0); + CreatePlayerObject(playerid,19546,-3285.000000,0.000000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19546,-3285.000000,0.000000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19542,-3410.000000,0.000000,4.000000,0.000000,0.000000,450.000000, 599.0); + CreatePlayerObject(playerid,19540,-3472.500000,0.000000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19540,-3472.500000,0.000000,4.000000,0.000000,0.000000,450.000000, 599.0); + CreatePlayerObject(playerid,19547,-3347.500000,280.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19539,-3285.000000,108.750000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19542,-3410.000000,202.500000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19543,-3378.750000,210.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19543,-3441.250000,210.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19536,-3441.250000,280.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19540,-3472.500000,202.500000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19542,-3472.500000,265.000000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19541,-3472.500000,335.000000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19542,-3410.000000,342.500000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19535,-3277.500000,350.000000,4.000000,0.000000,0.000000,270.000000, 599.0); + CreatePlayerObject(playerid,19535,-3200.000000,350.000000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19535,-3060.000000,350.000000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19532,-3130.000000,350.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19533,-3238.750000,350.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19546,-3285.000000,342.500000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19540,-3285.000000,482.500000,4.000000,0.000000,0.000000,450.000000, 599.0); + CreatePlayerObject(playerid,19542,-3222.500000,482.500000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19536,-3238.750000,420.000000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19541,-3285.000000,412.500000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19541,-3052.500000,350.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19540,-3052.500000,482.500000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19539,-3052.500000,388.750000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19539,-3083.750000,482.500000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19541,-3122.500000,482.500000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19541,-3137.500000,482.500000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19541,-3152.500000,482.500000,4.000000,0.000000,0.000000,90.000000, 599.0); + CreatePlayerObject(playerid,19529,-3130.000000,420.000000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19543,-3277.500000,388.750000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19543,-3277.500000,451.250000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19543,-3200.000000,388.750000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19543,-3200.000000,451.250000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19543,-3060.000000,388.750000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19543,-3060.000000,451.250000,4.000000,0.000000,0.000000,0.000000, 599.0); + CreatePlayerObject(playerid,19539,-3285.000000,451.250000,4.000000,0.000000,0.000000,180.000000, 599.0); + CreatePlayerObject(playerid,19539,-3052.500000,451.250000,4.000000,0.000000,0.000000,0.000000, 599.0); + + // Exit here + return 1; +} + diff --git a/filterscripts/netstats.amx b/filterscripts/netstats.amx new file mode 100644 index 0000000..a1d42e0 Binary files /dev/null and b/filterscripts/netstats.amx differ diff --git a/filterscripts/netstats.pwn b/filterscripts/netstats.pwn new file mode 100644 index 0000000..53cc1eb --- /dev/null +++ b/filterscripts/netstats.pwn @@ -0,0 +1,70 @@ +// +// Admin netstats display +// + +#include +#include "../include/gl_common.inc" + +#define ADMINFS_MESSAGE_COLOR 0xFF444499 +#define ADMIN_NETSTATS_DIALOGID 12898 + +new gNetStatsPlayerId = INVALID_PLAYER_ID; +new gNetStatsTimerId = 0; + +forward NetStatsDisplay(); + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--Admin Netstats FS loaded.\n"); + return 1; +} + +//------------------------------------------------ + +public NetStatsDisplay() +{ + new netstats_str[2048+1]; + GetNetworkStats(netstats_str, 2048); + ShowPlayerDialog(gNetStatsPlayerId, ADMIN_NETSTATS_DIALOGID, DIALOG_STYLE_MSGBOX, "Server NetStats", netstats_str, "Ok", ""); +} + +//------------------------------------------------ + +public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) +{ + if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script + + if(dialogid == ADMIN_NETSTATS_DIALOGID) { + KillTimer(gNetStatsTimerId); + gNetStatsPlayerId = INVALID_PLAYER_ID; + return 1; + } + + return 0; +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256+1]; + new idx; + + if(!IsPlayerAdmin(playerid)) return 0; + + cmd = strtok(cmdtext, idx); + + // netstats command + if(strcmp("/netstats", cmd, true) == 0) + { + gNetStatsPlayerId = playerid; + NetStatsDisplay(); + gNetStatsTimerId = SetTimer("NetStatsDisplay", 3000, true); // this will refresh the display every 3 seconds + return 1; + } + + return 0; +} +//------------------------------------------------ diff --git a/filterscripts/npc_record.amx b/filterscripts/npc_record.amx new file mode 100644 index 0000000..cc7c1ac Binary files /dev/null and b/filterscripts/npc_record.amx differ diff --git a/filterscripts/npc_record.pwn b/filterscripts/npc_record.pwn new file mode 100644 index 0000000..3371898 --- /dev/null +++ b/filterscripts/npc_record.pwn @@ -0,0 +1,75 @@ +//------------------------------------------------- +// +// Recording player data for NPC playback +// Kye 2009 +// +//------------------------------------------------- + +#pragma tabsize 0 + +#include +#include +#include + +#include "../include/gl_common.inc" + +//------------------------------------------------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256]; + new idx; + cmd = strtok(cmdtext, idx); + + if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script + + // Start recording vehicle data (/vrecord recording_name[]) + // Find the recording_name[] file in /scriptfiles/ + if(strcmp(cmd, "/vrecord", true) == 0) { + new tmp[512]; + tmp = strtok(cmdtext, idx); + if(!strlen(tmp)) { + SendClientMessage(playerid,0xFF0000FF,"Usage: /vrecord {name}"); + return 1; + } + if(!IsPlayerInAnyVehicle(playerid)) { + SendClientMessage(playerid,0xFF0000FF,"Recording: Get in a vehicle."); + return 1; + } + StartRecordingPlayerData(playerid,PLAYER_RECORDING_TYPE_DRIVER,tmp); + SendClientMessage(playerid,0xFF0000FF,"Recording: started."); + return 1; + } + + // Start recording onfoot data (/ofrecord recording_name[]) + // Find the recording_name[] file in /scriptfiles/ + if(strcmp(cmd, "/ofrecord", true) == 0) { + new tmp[512]; + tmp = strtok(cmdtext, idx); + if(!strlen(tmp)) { + SendClientMessage(playerid,0xFF0000FF,"Usage: /ofrecord {name}"); + return 1; + } + if(IsPlayerInAnyVehicle(playerid)) { + SendClientMessage(playerid,0xFF0000FF,"Recording: Leave the vehicle and reuse the command."); + return 1; + } + StartRecordingPlayerData(playerid,PLAYER_RECORDING_TYPE_ONFOOT,tmp); + SendClientMessage(playerid,0xFF0000FF,"Recording: started."); + return 1; + } + + // Stop recording any data + if(strcmp(cmd, "/stoprecord", true) == 0) { + StopRecordingPlayerData(playerid); + SendClientMessage(playerid,0xFF0000FF,"Recording: stopped."); + return 1; + } + + return 0; +} + +//------------------------------------------------- +// EOF + + diff --git a/filterscripts/ospawner.amx b/filterscripts/ospawner.amx new file mode 100644 index 0000000..7369333 Binary files /dev/null and b/filterscripts/ospawner.amx differ diff --git a/filterscripts/ospawner.pwn b/filterscripts/ospawner.pwn new file mode 100644 index 0000000..f15d020 --- /dev/null +++ b/filterscripts/ospawner.pwn @@ -0,0 +1,416 @@ +// +// Admin spawner using previews. For SA-MP 0.3x and above. +// - Kye 2012 +// + +#include +#include "../include/gl_common.inc" + +#define TOTAL_ITEMS 20000 +#define SELECTION_ITEMS 21 +#define ITEMS_PER_LINE 7 + +#define HEADER_TEXT "Objects" +#define NEXT_TEXT "Next" +#define PREV_TEXT "Prev" + +#define DIALOG_BASE_X 75.0 +#define DIALOG_BASE_Y 130.0 +#define DIALOG_WIDTH 550.0 +#define DIALOG_HEIGHT 180.0 +#define SPRITE_DIM_X 60.0 +#define SPRITE_DIM_Y 70.0 + +new gTotalItems = TOTAL_ITEMS; + +new PlayerText:gBackgroundTextDrawId[MAX_PLAYERS]; +new PlayerText:gNextButtonTextDrawId[MAX_PLAYERS]; +new PlayerText:gPrevButtonTextDrawId[MAX_PLAYERS]; +new PlayerText:gSelectionItems[MAX_PLAYERS][SELECTION_ITEMS]; +new PlayerText:gCurrentPageTextDrawId[MAX_PLAYERS]; +new PlayerText:gHeaderTextDrawId[MAX_PLAYERS]; +new gSelectionItemsTag[MAX_PLAYERS][SELECTION_ITEMS]; +new gItemAt[MAX_PLAYERS]; + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--Admin Vehicle Spawner Loaded\n"); + return 1; +} + +//------------------------------------------------ + +GetNumberOfPages() +{ + if((gTotalItems >= SELECTION_ITEMS) && (gTotalItems % SELECTION_ITEMS) == 0) + { + return (gTotalItems / SELECTION_ITEMS); + } + else return (gTotalItems / SELECTION_ITEMS) + 1; +} + +//------------------------------------------------ + +PlayerText:CreateCurrentPageTextDraw(playerid, Float:Xpos, Float:Ypos) +{ + new PlayerText:txtInit; + txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, "0/0"); + PlayerTextDrawUseBox(playerid, txtInit, 0); + PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1); + PlayerTextDrawFont(playerid, txtInit, 1); + PlayerTextDrawSetShadow(playerid, txtInit, 0); + PlayerTextDrawSetOutline(playerid, txtInit, 1); + PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF); + PlayerTextDrawShow(playerid, txtInit); + return txtInit; +} + +//------------------------------------------------ +// Creates a button textdraw and returns the textdraw ID. + +PlayerText:CreatePlayerDialogButton(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, button_text[]) +{ + new PlayerText:txtInit; + txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, button_text); + PlayerTextDrawUseBox(playerid, txtInit, 1); + PlayerTextDrawBoxColor(playerid, txtInit, 0x000000FF); + PlayerTextDrawBackgroundColor(playerid, txtInit, 0x000000FF); + PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1); + PlayerTextDrawFont(playerid, txtInit, 1); + PlayerTextDrawSetShadow(playerid, txtInit, 0); // no shadow + PlayerTextDrawSetOutline(playerid, txtInit, 0); + PlayerTextDrawColor(playerid, txtInit, 0x4A5A6BFF); + PlayerTextDrawSetSelectable(playerid, txtInit, 1); + PlayerTextDrawAlignment(playerid, txtInit, 2); + PlayerTextDrawTextSize(playerid, txtInit, Height, Width); // The width and height are reversed for centering.. something the game does + PlayerTextDrawShow(playerid, txtInit); + return txtInit; +} + +//------------------------------------------------ + +PlayerText:CreatePlayerHeaderTextDraw(playerid, Float:Xpos, Float:Ypos, header_text[]) +{ + new PlayerText:txtInit; + txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, header_text); + PlayerTextDrawUseBox(playerid, txtInit, 0); + PlayerTextDrawLetterSize(playerid, txtInit, 1.25, 3.0); + PlayerTextDrawFont(playerid, txtInit, 0); + PlayerTextDrawSetShadow(playerid, txtInit, 0); + PlayerTextDrawSetOutline(playerid, txtInit, 1); + PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF); + PlayerTextDrawShow(playerid, txtInit); + return txtInit; +} + +//------------------------------------------------ + +PlayerText:CreatePlayerBackgroundTextDraw(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height) +{ + new PlayerText:txtBackground = CreatePlayerTextDraw(playerid, Xpos, Ypos, + " ~n~"); // enough space for everyone + PlayerTextDrawUseBox(playerid, txtBackground, 1); + PlayerTextDrawBoxColor(playerid, txtBackground, 0x4A5A6BBB); + PlayerTextDrawLetterSize(playerid, txtBackground, 5.0, 5.0); + PlayerTextDrawFont(playerid, txtBackground, 0); + PlayerTextDrawSetShadow(playerid, txtBackground, 0); + PlayerTextDrawSetOutline(playerid, txtBackground, 0); + PlayerTextDrawColor(playerid, txtBackground,0xFFFFFFFF); + PlayerTextDrawTextSize(playerid, txtBackground, Width, Height); + PlayerTextDrawBackgroundColor(playerid, txtBackground, 0x4A5A6BBB); + PlayerTextDrawShow(playerid, txtBackground); + return txtBackground; +} + +//------------------------------------------------ +// Creates a model preview sprite + +PlayerText:CreateModelPreviewTextDraw(playerid, modelindex, Float:Xpos, Float:Ypos, Float:width, Float:height) +{ + new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, Xpos, Ypos, ""); // it has to be set with SetText later + PlayerTextDrawFont(playerid, txtPlayerSprite, TEXT_DRAW_FONT_MODEL_PREVIEW); + PlayerTextDrawColor(playerid, txtPlayerSprite, 0xFFFFFFFF); + PlayerTextDrawBackgroundColor(playerid, txtPlayerSprite, 0x88888899); + PlayerTextDrawTextSize(playerid, txtPlayerSprite, width, height); // Text size is the Width:Height + PlayerTextDrawSetPreviewModel(playerid, txtPlayerSprite, modelindex); + if(modelindex > 319) { + PlayerTextDrawSetPreviewRot(playerid,txtPlayerSprite, -15.0, 0.0, 0.0); + } + PlayerTextDrawSetSelectable(playerid, txtPlayerSprite, 1); + PlayerTextDrawShow(playerid,txtPlayerSprite); + return txtPlayerSprite; +} + +//------------------------------------------------ + +DestroyPlayerModelPreviews(playerid) +{ + new x=0; + while(x != SELECTION_ITEMS) { + if(gSelectionItems[playerid][x] != PlayerText:INVALID_TEXT_DRAW) { + PlayerTextDrawDestroy(playerid, gSelectionItems[playerid][x]); + gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW; + } + x++; + } +} + +//------------------------------------------------ + +ShowPlayerModelPreviews(playerid) +{ + new x=0; + new Float:BaseX = DIALOG_BASE_X; + new Float:BaseY = DIALOG_BASE_Y - (SPRITE_DIM_Y * 0.33); // down a bit + new linetracker = 0; + + new itemat = GetPVarInt(playerid, "ospawner_page") * SELECTION_ITEMS; + + // Destroy any previous ones created + DestroyPlayerModelPreviews(playerid); + + while(x != SELECTION_ITEMS && itemat < gTotalItems) { + if(linetracker == 0) { + BaseX = DIALOG_BASE_X + 25.0; // in a bit from the box + BaseY += SPRITE_DIM_Y + 1.0; // move on the Y for the next line + } + gSelectionItems[playerid][x] = CreateModelPreviewTextDraw(playerid, itemat, BaseX, BaseY, SPRITE_DIM_X, SPRITE_DIM_Y); + gSelectionItemsTag[playerid][x] = itemat; + BaseX += SPRITE_DIM_X + 1.0; // move on the X for the next sprite + linetracker++; + if(linetracker == ITEMS_PER_LINE) linetracker = 0; + itemat++; + x++; + } +} + +//------------------------------------------------ + +UpdatePageTextDraw(playerid) +{ + new PageText[64+1]; + format(PageText, 64, "%d/%d", GetPVarInt(playerid,"ospawner_page") + 1, GetNumberOfPages()); + PlayerTextDrawSetString(playerid, gCurrentPageTextDrawId[playerid], PageText); +} + +//------------------------------------------------ + +CreateSelectionMenu(playerid) +{ + gBackgroundTextDrawId[playerid] = CreatePlayerBackgroundTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y + 20.0, DIALOG_WIDTH, DIALOG_HEIGHT); + gHeaderTextDrawId[playerid] = CreatePlayerHeaderTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y, HEADER_TEXT); + gCurrentPageTextDrawId[playerid] = CreateCurrentPageTextDraw(playerid, DIALOG_WIDTH - 50.0, DIALOG_BASE_Y + 15.0); + gNextButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 30.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, NEXT_TEXT); + gPrevButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 90.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, PREV_TEXT); + + ShowPlayerModelPreviews(playerid); + UpdatePageTextDraw(playerid); +} + +//------------------------------------------------ + +DestroySelectionMenu(playerid) +{ + DestroyPlayerModelPreviews(playerid); + + PlayerTextDrawDestroy(playerid, gHeaderTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gBackgroundTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gCurrentPageTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gNextButtonTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gPrevButtonTextDrawId[playerid]); + + gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; +} + +//------------------------------------------------ + +SpawnVehicle_InfrontOfPlayer(playerid, vehiclemodel, color1, color2) +{ + new Float:x,Float:y,Float:z; + new Float:facing; + new Float:distance; + + GetPlayerPos(playerid, x, y, z); + GetPlayerFacingAngle(playerid, facing); + + new Float:size_x,Float:size_y,Float:size_z; + GetVehicleModelInfo(vehiclemodel, VEHICLE_MODEL_INFO_SIZE, size_x, size_y, size_z); + + distance = size_x + 0.5; + + x += (distance * floatsin(-facing, degrees)); + y += (distance * floatcos(-facing, degrees)); + + facing += 90.0; + if(facing > 360.0) facing -= 360.0; + + return CreateVehicle(vehiclemodel, x, y, z + (size_z * 0.25), facing, color1, color2, -1); +} + +//------------------------------------------------ + +SpawnObject_InfrontOfPlayer(playerid, model) +{ + new Float:x,Float:y,Float:z; + new Float:facing; + new Float:distance; + + GetPlayerPos(playerid, x, y, z); + GetPlayerFacingAngle(playerid, facing); + + distance = 5.0; + + x += (distance * floatsin(-facing, degrees)); + y += (distance * floatcos(-facing, degrees)); + + facing += 90.0; + if(facing > 360.0) facing -= 360.0; + + return CreateObject(model, x, y, z, 0.0, 0.0, 0.0, 300.0); +} + +//------------------------------------------------ + +HandlePlayerItemSelection(playerid, selecteditem) +{ + if(gSelectionItemsTag[playerid][selecteditem] >= 0 && gSelectionItemsTag[playerid][selecteditem] < 319) { + SetPlayerSkin(playerid, gSelectionItemsTag[playerid][selecteditem]); + return; + } + if(gSelectionItemsTag[playerid][selecteditem] >= 400 && gSelectionItemsTag[playerid][selecteditem] < 612) { + // In this case we're spawning a vehicle for them + SpawnVehicle_InfrontOfPlayer(playerid, gSelectionItemsTag[playerid][selecteditem], -1, -1); + return; + } + if(gSelectionItemsTag[playerid][selecteditem] > 615) { + new objectid = SpawnObject_InfrontOfPlayer(playerid, gSelectionItemsTag[playerid][selecteditem]); + EditObject(playerid, objectid); + return; + } +} + +//------------------------------------------------ + +public OnPlayerConnect(playerid) +{ + // Init all of the textdraw related globals + gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + + new x=0; + while(x != SELECTION_ITEMS) { + gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW; + x++; + } + + gItemAt[playerid] = 0; + + return 1; // Allow other scripts to keep processing OnPlayerConnect +} + +//------------------------------------------- +// Even though only Player* textdraws are used in this script, +// OnPlayerClickTextDraw is still required to handle ESC + +public OnPlayerClickTextDraw(playerid, Text:clickedid) +{ + if(GetPVarInt(playerid, "ospawner_active") == 0) return 0; + + // Handle: They cancelled (with ESC) + if(clickedid == Text:INVALID_TEXT_DRAW) { + DestroySelectionMenu(playerid); + SetPVarInt(playerid, "ospawner_active", 0); + PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); + return 1; + } + + return 0; +} + +//------------------------------------------------ + +public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) +{ + if(GetPVarInt(playerid, "ospawner_active") == 0) return 0; + + new curpage = GetPVarInt(playerid, "ospawner_page"); + + // Handle: next button + if(playertextid == gNextButtonTextDrawId[playerid]) { + if(curpage < (GetNumberOfPages() - 1)) { + SetPVarInt(playerid, "ospawner_page", curpage + 1); + ShowPlayerModelPreviews(playerid); + UpdatePageTextDraw(playerid); + PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); + } else { + PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); + } + return 1; + } + + // Handle: previous button + if(playertextid == gPrevButtonTextDrawId[playerid]) { + if(curpage > 0) { + SetPVarInt(playerid, "ospawner_page", curpage - 1); + ShowPlayerModelPreviews(playerid); + UpdatePageTextDraw(playerid); + PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); + } else { + PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); + } + return 1; + } + + // Search in the array of textdraws used for the items + new x=0; + while(x != SELECTION_ITEMS) { + if(playertextid == gSelectionItems[playerid][x]) { + DestroySelectionMenu(playerid); + CancelSelectTextDraw(playerid); + HandlePlayerItemSelection(playerid, x); + PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); + SetPVarInt(playerid, "ospawner_active", 0); + return 1; + } + x++; + } + + return 0; +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256+1]; + new idx; + + if(!IsPlayerAdmin(playerid)) return 0; + + cmd = strtok(cmdtext, idx); + + if(strcmp("/ospawner", cmd, true) == 0) + { + // If there was a previously created selection menu, destroy it + DestroySelectionMenu(playerid); + + SetPVarInt(playerid, "ospawner_active", 1); + SetPVarInt(playerid, "ospawner_page", 1); + + CreateSelectionMenu(playerid); + SelectTextDraw(playerid, 0xACCBF1FF); + return 1; + } + + return 0; +} +//------------------------------------------------ diff --git a/filterscripts/pirateship.amx b/filterscripts/pirateship.amx new file mode 100644 index 0000000..00f483a Binary files /dev/null and b/filterscripts/pirateship.amx differ diff --git a/filterscripts/pirateship.pwn b/filterscripts/pirateship.pwn new file mode 100644 index 0000000..e289e69 --- /dev/null +++ b/filterscripts/pirateship.pwn @@ -0,0 +1,177 @@ +// +// Used for testing interpolated rotations with MoveObject +// Also used to test AttachObjectToObject +// A pirate ship goes around and visits some route points +// +// SA-MP 0.3d and above +// +// - Kye 2011 +// + +#include +#include "../include/gl_common.inc" // for PlaySoundForPlayersInRange() + +#define NUM_SHIP_ROUTE_POINTS 25 +#define SHIP_OBJECT_ID 8493 // pirate ship +#define SHIP_SKULL_ATTACH 3524 +#define SHIP_RAILS_ATTACH 9159 +#define SHIP_LINES_ATTACH 8981 +#define SHIP_MOVE_SPEED 10.0 +#define SHIP_DRAW_DISTANCE 800.0 + +// Pirate ship route points (position/rotation) +new Float:gShipRoutePoints[NUM_SHIP_ROUTE_POINTS][6] = { +{-2389.81, 1434.84, 13.51, 0.00, 0.0, -87.36}, +{-2319.54, 1450.75, 13.91, 1.0, 0.0, -71.70}, +{-2245.87, 1479.80, 14.21, 5.00, 0.0, -63.84}, +{-2168.53, 1535.31, 15.73, 1.00, 0.0, -50.76}, +{-2096.43, 1634.13, 15.73, 0.00, 0.0, -36.60}, +{-2036.11, 1734.57, 15.27, -1.00, 0.0, -20.22}, +{-2018.20, 1841.61, 15.27, -5.00, 0.00, -4.86}, +{-2043.70, 1936.95, 15.27, -1.00, 0.00, 25.32}, +{-2104.07, 2023.54, 12.78, 0.00, 0.00, 49.14}, +{-2206.40, 2065.64, 16.76, 1.00, 0.00, 73.32}, +{-2298.24, 2070.62, 14.59, 5.00, 0.00, 91.62}, +{-2412.24, 2067.55, 14.59, 1.00, 0.00, 91.62}, +{-2528.28, 2057.22, 12.30, 0.00, 0.00, 99.78}, +{-2626.64, 2032.14, 17.04, -1.00, 0.00, 106.98}, +{-2727.60, 1996.95, 15.36, -5.00, 0.00, 106.98}, +{-2808.88, 1953.08, 15.36, -1.00, 0.00, 121.62}, +{-2886.19, 1876.19, 16.68, 0.00, 0.00, 143.16}, +{-2911.09, 1782.21, 16.68, -1.00, 0.00, 173.34}, +{-2898.36, 1678.83, 14.88, 0.00, 0.00, 194.58}, +{-2851.29, 1601.46, 16.13, 1.00, 0.00, 228.42}, +{-2760.72, 1557.18, 16.13, 0.00, 0.00, 257.52}, +{-2665.41, 1535.22, 16.13, -1.00, 0.00, 257.52}, +{-2589.06, 1509.08, 16.13, 0.00, 0.00, 239.88}, +{-2517.74, 1463.39, 14.59, 1.00, 0.00, 243.78}, +{-2456.12, 1441.11, 14.59, 0.00, 0.00, 254.76} +}; + + +new gShipCurrentPoint = 1; // current route point the ship is at + +// SA-MP objects +new gMainShipObjectId; +new gShipSkullAttachment[4]; +new gShipRailsAttachment; +new gShipLinesAttachment; + +forward StartMovingTimer(); + +//------------------------------------------------- + +public StartMovingTimer() +{ + MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0], + gShipRoutePoints[gShipCurrentPoint][1], + gShipRoutePoints[gShipCurrentPoint][2], + SHIP_MOVE_SPEED / 4.0, // bit slower for the first point + gShipRoutePoints[gShipCurrentPoint][3], + gShipRoutePoints[gShipCurrentPoint][4], + gShipRoutePoints[gShipCurrentPoint][5]); +} + +//------------------------------------------------- + +public OnFilterScriptInit() +{ + gMainShipObjectId = CreateObject(SHIP_OBJECT_ID, gShipRoutePoints[0][0], gShipRoutePoints[0][1], gShipRoutePoints[0][2], + gShipRoutePoints[0][3], gShipRoutePoints[0][4], gShipRoutePoints[0][5], SHIP_DRAW_DISTANCE); + + gShipSkullAttachment[0] = CreateObject(SHIP_SKULL_ATTACH, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE); + AttachObjectToObject(gShipSkullAttachment[0], gMainShipObjectId, 4.11, -5.53, -9.78, 0.0, 0.0, 90.0); + + gShipSkullAttachment[1] = CreateObject(SHIP_SKULL_ATTACH, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE); + AttachObjectToObject(gShipSkullAttachment[1], gMainShipObjectId, -4.11, -5.53, -9.78, 0.0, 0.0, -90.0); + + gShipSkullAttachment[2] = CreateObject(SHIP_SKULL_ATTACH, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE); + AttachObjectToObject(gShipSkullAttachment[2], gMainShipObjectId, -4.3378, -15.2887, -9.7863, 0.0, 0.0, -90.0); + + gShipSkullAttachment[3] = CreateObject(SHIP_SKULL_ATTACH, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE); + AttachObjectToObject(gShipSkullAttachment[3], gMainShipObjectId, 4.3378, -15.2887, -9.7863, 0.0, 0.0, 90.0); + + gShipRailsAttachment = CreateObject(SHIP_RAILS_ATTACH, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE); + AttachObjectToObject(gShipRailsAttachment, gMainShipObjectId, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); + + gShipLinesAttachment = CreateObject(SHIP_LINES_ATTACH, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE); + AttachObjectToObject(gShipLinesAttachment, gMainShipObjectId, -0.5468, -6.1875, -0.4375, 0.0, 0.0, 0.0); + + SetTimer("StartMovingTimer",30*1000,0); // pause at route 0 for 30 seconds + + return 1; +} + +//------------------------------------------------- + +public OnFilterScriptExit() +{ + new x=0; + + DestroyObject(gMainShipObjectId); + + x=0; + while(x != 4) { + DestroyObject(gShipSkullAttachment[x]); + x++; + } + + DestroyObject(gShipRailsAttachment); + DestroyObject(gShipLinesAttachment); + + return 1; +} + +//------------------------------------------------- + +public OnObjectMoved(objectid) +{ + if(objectid != gMainShipObjectId) return 0; + + if(gShipCurrentPoint > 0 && !(gShipCurrentPoint % 3)) { + // play some seagulls audio every 3 points + PlaySoundForPlayersInRange(6200, 100.0, gShipRoutePoints[gShipCurrentPoint][0], + gShipRoutePoints[gShipCurrentPoint][1], + gShipRoutePoints[gShipCurrentPoint][2]); + } + + gShipCurrentPoint++; + + if(gShipCurrentPoint == NUM_SHIP_ROUTE_POINTS) { + gShipCurrentPoint = 0; + + MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0], + gShipRoutePoints[gShipCurrentPoint][1], + gShipRoutePoints[gShipCurrentPoint][2], + SHIP_MOVE_SPEED / 4.0, // slower for the last route + gShipRoutePoints[gShipCurrentPoint][3], + gShipRoutePoints[gShipCurrentPoint][4], + gShipRoutePoints[gShipCurrentPoint][5]); + return 1; + } + + if(gShipCurrentPoint == 1) { + // Before heading to the first route we should wait a bit + SetTimer("StartMovingTimer",30*1000,0); // pause at route 0 for 30 seconds + return 1; + } + + /* + new tempdebug[256+1]; + format(tempdebug,256,"The ship is at route: %d", gShipCurrentPoint); + SendClientMessageToAll(0xFFFFFFFF,tempdebug);*/ + + MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0], + gShipRoutePoints[gShipCurrentPoint][1], + gShipRoutePoints[gShipCurrentPoint][2], + SHIP_MOVE_SPEED, + gShipRoutePoints[gShipCurrentPoint][3], + gShipRoutePoints[gShipCurrentPoint][4], + gShipRoutePoints[gShipCurrentPoint][5]); + + return 1; +} + +//------------------------------------------------- + + diff --git a/filterscripts/pnetstats.amx b/filterscripts/pnetstats.amx new file mode 100644 index 0000000..ffc2849 Binary files /dev/null and b/filterscripts/pnetstats.amx differ diff --git a/filterscripts/pnetstats.pwn b/filterscripts/pnetstats.pwn new file mode 100644 index 0000000..87aa548 --- /dev/null +++ b/filterscripts/pnetstats.pwn @@ -0,0 +1,78 @@ +// +// Admin player netstats display +// + +#include +#include "../include/gl_common.inc" + +#define ADMINFS_MESSAGE_COLOR 0xFF444499 +#define ADMIN_NETSTATS_DIALOGID 12898 + +new gNetStatsPlayerId = INVALID_PLAYER_ID; +new gNetStatsDisplayId = INVALID_PLAYER_ID; + +new gNetStatsTimerId = 0; + +forward NetStatsDisplay(); + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--Admin Netstats FS loaded.\n"); + return 1; +} + +//------------------------------------------------ + +public NetStatsDisplay() +{ + new netstats_str[2048+1]; + GetPlayerNetworkStats(gNetStatsDisplayId, netstats_str, 2048); + ShowPlayerDialog(gNetStatsPlayerId, ADMIN_NETSTATS_DIALOGID, DIALOG_STYLE_MSGBOX, "Player NetStats", netstats_str, "Ok", ""); +} + +//------------------------------------------------ + +public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) +{ + if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script + + if(dialogid == ADMIN_NETSTATS_DIALOGID) { + KillTimer(gNetStatsTimerId); + gNetStatsPlayerId = INVALID_PLAYER_ID; + return 1; + } + + return 0; +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256+1]; + new idx; + + if(!IsPlayerAdmin(playerid)) return 0; + + cmd = strtok(cmdtext, idx); + + // netstats command + if(strcmp("/pnetstats", cmd, true) == 0) + { + new tmp[128]; + tmp = strtok(cmdtext, idx); + if(!strlen(tmp)) { return 1; } + + gNetStatsPlayerId = playerid; + gNetStatsDisplayId = strval(tmp); + + NetStatsDisplay(); + gNetStatsTimerId = SetTimer("NetStatsDisplay", 3000, true); // this will refresh the display every 3 seconds + return 1; + } + + return 0; +} +//------------------------------------------------ diff --git a/filterscripts/pnetstats2.amx b/filterscripts/pnetstats2.amx new file mode 100644 index 0000000..32392dd Binary files /dev/null and b/filterscripts/pnetstats2.amx differ diff --git a/filterscripts/pnetstats2.pwn b/filterscripts/pnetstats2.pwn new file mode 100644 index 0000000..4b29cc3 --- /dev/null +++ b/filterscripts/pnetstats2.pwn @@ -0,0 +1,99 @@ +// +// Admin player netstats display +// Using NetStats_* functions. +// +// -Rcon login admin then: +// /pnetstats2 (playerid) +// + +#include +#include "../include/gl_common.inc" + +#define ADMINFS_MESSAGE_COLOR 0xFF444499 +#define ADMIN_NETSTATS_DIALOGID 12899 + +new gNetStatsPlayerId = INVALID_PLAYER_ID; +new gNetStatsDisplayId = INVALID_PLAYER_ID; + +new gNetStatsTimerId = 0; + +forward NetStatsDisplay(); + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--Admin Netstats FS loaded.\n"); + return 1; +} + +//------------------------------------------------ + +BuildPlayerNetstatString(playerid, ret_str[], ret_str_len) +{ + new szPlayerIpPort[64+1]; + NetStats_GetIpPort(playerid, szPlayerIpPort, 64); + + format(ret_str, ret_str_len, "IP_Port: %s\nConnected Time (ms): %d\nConnection Status: %d\nPacket Loss: %.2f\nMessages Recv: %d\nMessages Sent: %d\nMessages/sec: %d", + szPlayerIpPort, + NetStats_GetConnectedTime(playerid), + NetStats_ConnectionStatus(playerid), + NetStats_PacketLossPercent(playerid), + NetStats_MessagesReceived(playerid), + NetStats_MessagesSent(playerid), + NetStats_MessagesRecvPerSecond(playerid)); +} + +//------------------------------------------------ + +public NetStatsDisplay() +{ + new netstats_str[1024+1]; + BuildPlayerNetstatString(gNetStatsDisplayId, netstats_str, 1024); + ShowPlayerDialog(gNetStatsPlayerId, ADMIN_NETSTATS_DIALOGID, DIALOG_STYLE_MSGBOX, "Player NetStats", netstats_str, "Ok", ""); +} + +//------------------------------------------------ + +public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) +{ + if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script + + if(dialogid == ADMIN_NETSTATS_DIALOGID) { + KillTimer(gNetStatsTimerId); + gNetStatsPlayerId = INVALID_PLAYER_ID; + return 1; + } + + return 0; +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256+1]; + new idx; + + if(!IsPlayerAdmin(playerid)) return 0; + + cmd = strtok(cmdtext, idx); + + // netstats command + if(strcmp("/pnetstats2", cmd, true) == 0) + { + new tmp[128]; + tmp = strtok(cmdtext, idx); + if(!strlen(tmp)) { return 1; } + + gNetStatsPlayerId = playerid; + gNetStatsDisplayId = strval(tmp); + + NetStatsDisplay(); + gNetStatsTimerId = SetTimer("NetStatsDisplay", 3000, true); // this will refresh the display every 3 seconds + return 1; + } + + return 0; +} +//------------------------------------------------ diff --git a/filterscripts/safe_animated.amx b/filterscripts/safe_animated.amx new file mode 100644 index 0000000..cd6e5a5 Binary files /dev/null and b/filterscripts/safe_animated.amx differ diff --git a/filterscripts/safe_animated.pwn b/filterscripts/safe_animated.pwn new file mode 100644 index 0000000..96d3f02 --- /dev/null +++ b/filterscripts/safe_animated.pwn @@ -0,0 +1,212 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the new Safe with Door +// ----------------------------------------------- +// By Matite in January 2015 +// +// v1.0.1 +// * Inital release in RC1 +// +// v1.0.2 +// * Changed the Z offset in the MoveObject parameters to fix an issue with +// movement caused by rounding on some PCs +// +// This script removes the existing safe in Madd Dogg's Mansion then creates the +// new safe and door object in its place. You can then use commands to open and +// close the safe door. +// +// You can use the following commands: +// * /safe = Teleports the player to the safe in Madd Dogg's Mansion +// * /openopen = Makes the safe door open +// * /closesafe = Makes the safe door close +// +// Warning... +// This script uses a total of 2 objects +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + + +// ------------------------------------------------------------------------------ +// Defines +// ------- + +// Safe door status +#define SAFE_DOOR_OPEN (1) +#define SAFE_DOOR_CLOSED (0) + + +// ------------------------------------------------------------------------------ +// Variables +// --------- + +// Stores the created object number of the safe +new SafeObject; + +// Stores the created object number of the safe door +new SafeDoorObject; + +// Tracks the status of the safe door (ie whether it is open or closed) +new SafeDoorStatus = SAFE_DOOR_CLOSED; + + +// ------------------------------------------------------------------------------ +// Callbacks +// --------- + + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/safe", cmdtext, true, 5) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 5); + + // Set player position and facing angle + SetPlayerPos(playerid, 1230.61, -808.15, 1084.1); + SetPlayerFacingAngle(playerid, 0); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Safe And Door!", 3000, 3); + + // Exit here + return 1; + } + else if (strcmp("/opensafe", cmdtext, true, 9) == 0) + { + // Check if the safe door is already open + if (SafeDoorStatus == SAFE_DOOR_OPEN) + { + // Send a gametext message to the player and exit here + GameTextForPlayer(playerid, "~r~~h~Safe Door~n~~r~~h~Already Open!", 3000, 3); + return 1; + } + + // Animate the safe door opening (the small Z offset is required) + MoveObject(SafeDoorObject, 1230.225708, -806.648803, 1083.5 + 0.01, 0.005, 0, 0, 280); + + // Set the safe door status + SafeDoorStatus = SAFE_DOOR_OPEN; + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Safe Door Opened!", 3000, 3); + + // Exit here + return 1; + } + else if (strcmp("/closesafe", cmdtext, true, 10) == 0) + { + // Check if the safe door is already open + if (SafeDoorStatus == SAFE_DOOR_CLOSED) + { + // Send a gametext message to the player and exit here + GameTextForPlayer(playerid, "~r~~h~Safe Door~n~~r~~h~Already Closed!", 3000, 3); + return 1; + } + + // Animate the safe door closing (the small Z offset is required) + MoveObject(SafeDoorObject, 1230.225708, -806.648803, 1083.5 - 0.01, 0.005, 0, 0, 0); + + // Set the safe door status + SafeDoorStatus = SAFE_DOOR_CLOSED; + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Safe Door Closed!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- Safe and Door Filterscript by Matite"); + print(" |-- Script v1.02"); + print(" |-- 13th February 2015"); + print(" |---------------------------------------------------"); + + // Create the safe object + SafeObject = CreateObject(19618, 1230.646118, -806.418823, 1083.5, 0, 0, 0); + + // Display information in the Server Console + print(" |-- Safe object created"); + + // Create the safe door object + SafeDoorObject = CreateObject(19619, 1230.225708, -806.648803, 1083.5 - 0.01, 0, 0, 0); + + // Display information in the Server Console + print(" |-- Safe door object created"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and is not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove default GTASA safe object in Madd Dogg's Mansion office + // (we do this now incase the filterscipt was loaded after the player joined) + RemoveBuildingForPlayer(i, 2332, 1230.646118, -806.418823, 1083.5, 10.0); + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Check for valid object + if (IsValidObject(SafeObject)) + { + // Destroy the safe object + DestroyObject(SafeObject); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Safe object destroyed"); + } + + // Check for valid object + if (IsValidObject(SafeDoorObject)) + { + // Destroy the safe door object + DestroyObject(SafeDoorObject); + + // Display information in the Server Console + print(" |-- Safe door object destroyed"); + } + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Safe and Door Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove default GTASA safe object in Madd Dogg's Mansion office + RemoveBuildingForPlayer(playerid, 2332, 1230.646118, -806.418823, 1083.5, 10.0); + + // Exit here + return 1; +} + diff --git a/filterscripts/samp_anims.amx b/filterscripts/samp_anims.amx new file mode 100644 index 0000000..d6e02a5 Binary files /dev/null and b/filterscripts/samp_anims.amx differ diff --git a/filterscripts/samp_anims.pwn b/filterscripts/samp_anims.pwn new file mode 100644 index 0000000..f9a791d --- /dev/null +++ b/filterscripts/samp_anims.pwn @@ -0,0 +1,65 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the new SA-MP Animations +// ------------------------------------------------- +// By Matite in January 2015 +// +// This script tests the new SA-MP animation/pose inside the SAMP.ifp file. +// +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + +// ------------------------------------------------------------------------------ +// Callbacks +// --------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/fish", cmdtext, true, 5) == 0) + { + // Apply animation + ApplyAnimation(playerid, "SAMP", "FishingIdle", 4.1, 0, 1, 1, 1, 1); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Fishing Animation Pose!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- SA-MP Animations Filterscript by Matite"); + print(" |-- Script v1.01"); + print(" |-- 12th January 2015"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- SA-MP Animations Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + diff --git a/filterscripts/sf_building1.amx b/filterscripts/sf_building1.amx new file mode 100644 index 0000000..832ef20 Binary files /dev/null and b/filterscripts/sf_building1.amx differ diff --git a/filterscripts/sf_building1.pwn b/filterscripts/sf_building1.pwn new file mode 100644 index 0000000..f4e5371 --- /dev/null +++ b/filterscripts/sf_building1.pwn @@ -0,0 +1,176 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the new SF Building 1 +// ---------------------------------------------- +// By Matite in February 2015 +// +// +// This script creates the new SF Building 1 object and removes the existing +// GTASA building object. +// +// Warning... +// This script uses a total of: +// * 3 objects = 1 for the replacement land object, 1 for the outside object +// and 1 for the inside object +// * Enables the /sfb command to teleport the player to the SF Building 1 +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Used for messages sent to the player +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + + +// ----------------------------------------------------------------------------- +// Variables +// --------- + +// Stores the created object numbers of the replacement building objects so +// they can be destroyed when the filterscript is unloaded +new SFBuilding1Object1; // Land object +new SFBuilding1Object2; // Outside object +new SFBuilding1Object3; // Inside object + + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/sfb", cmdtext, true, 4) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 0); + + // Set player position and facing angle + SetPlayerPos(playerid, -2706.56, 870.91 + random(2), 71.86); + SetPlayerFacingAngle(playerid, 180); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~SF Building!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- SF Building 1 Filterscript"); + print(" |-- Script v1.01"); + print(" |-- 10th February 2015"); + print(" |---------------------------------------------------"); + + // Create the SF Building 1 Land object + SFBuilding1Object1 = CreateObject(19600, -2719.02, 861.211, 72.1562, 0, 0, 0); + + // Display information in the Server Console + print(" |-- SF Building 1 Land object created"); + + // Create the SF Building 1 Outside object + SFBuilding1Object2 = CreateObject(19598, -2719.02, 861.211, 72.1562, 0, 0, 0); + + // Display information in the Server Console + print(" |-- SF Building 1 Outside object created"); + + // Create the SF Building 1 Inside object + SFBuilding1Object3 = CreateObject(19599, -2719.02, 861.211, 72.1562, 0, 0, 0); + + // Display information in the Server Console + print(" |-- SF Building 1 Inside object created"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove default GTASA SF Building and LOD map objects for the player + // (so any player currently ingame does not have to rejoin for them + // to be removed when this filterscript is loaded) + RemoveBuildingForPlayer(i, 9510, -2719.02, 861.211, 72.1562, 250.0); // Building + RemoveBuildingForPlayer(i, 9671, -2719.02, 861.211, 72.1562, 250.0); // LOD + RemoveBuildingForPlayer(i, 715, -2693.24, 852.60, 71.74, 8.0); // Tree (casts a shadow inside) + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Check for valid object + if (IsValidObject(SFBuilding1Object1)) + { + // Destroy the SF Building 1 Land object + DestroyObject(SFBuilding1Object1); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- SF Building 1 Land object destroyed"); + } + + // Check for valid object + if (IsValidObject(SFBuilding1Object2)) + { + // Destroy the SF Building 1 Outside object + DestroyObject(SFBuilding1Object2); + + // Display information in the Server Console + print(" |-- SF Building 1 Outside object destroyed"); + } + + // Check for valid object + if (IsValidObject(SFBuilding1Object3)) + { + // Destroy the SF Building 1 Inside object + DestroyObject(SFBuilding1Object3); + + // Display information in the Server Console + print(" |-- SF Building 1 Inside object destroyed"); + } + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- SF Building 1 Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove default GTASA SF Building and LOD map objects for the player + RemoveBuildingForPlayer(playerid, 9510, -2719.02, 861.211, 72.1562, 250.0); // Building + RemoveBuildingForPlayer(playerid, 9671, -2719.02, 861.211, 72.1562, 250.0); // LOD + RemoveBuildingForPlayer(playerid, 715, -2693.24, 852.60, 71.74, 8.0); // Tree (casts a shadow inside) + + // Exit here (return 1 so this callback is handled in other scripts too) + return 1; +} + diff --git a/filterscripts/sf_zombotech.amx b/filterscripts/sf_zombotech.amx new file mode 100644 index 0000000..7125cd5 Binary files /dev/null and b/filterscripts/sf_zombotech.amx differ diff --git a/filterscripts/sf_zombotech.pwn b/filterscripts/sf_zombotech.pwn new file mode 100644 index 0000000..5dbf520 --- /dev/null +++ b/filterscripts/sf_zombotech.pwn @@ -0,0 +1,664 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the new SF ZomboTech Building and Lab with Elevator +// ---------------------------------------------------------------------------- +// Original elevator code by Zamaroht in 2010 +// +// Updated by Kye in 2011 +// * Added a sound effect for the elevator starting/stopping +// +// Edited by Matite in January 2015 +// * Added code to remove the existing building, add the new buildings and +// adapted the elevator code so it works in this new building +// +// +// This script creates the new SF ZomboTech building and the lab objects, removes +// the existing GTASA building object and creates an elevator that can be used to +// travel between the building foyer and the lab. +// +// You can un-comment the OnPlayerCommandText callback below to enable a simple +// teleport command (/zl) that teleports you to the ZomboTech Lab elevator. +// +// Warning... +// This script uses a total of: +// * 9 objects = 1 for the elevator, 2 for the elevator doors, 4 for the elevator +// floor doors and 2 for the buildings (replacement ZomboTech building and lab) +// * 3 3D Text Labels = 2 on the floors and 1 in the elevator +// * 1 dialog (for the elevator) +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP include +#include + +// For PlaySoundForPlayersInRange() +#include "../include/gl_common.inc" + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Movement speed of the elevator +#define ELEVATOR_SPEED (5.0) + +// Movement speed of the doors +#define DOORS_SPEED (5.0) + +// Time in ms that the elevator will wait in each floor before continuing with the queue... +// be sure to give enough time for doors to open +#define ELEVATOR_WAIT_TIME (5000) + +// Dialog ID for the ZomboTech building elevator dialog +#define DIALOG_ID (875) + +// Position defines +#define X_DOOR_CLOSED (-1951.603027) +#define X_DOOR_L_OPENED X_DOOR_CLOSED + 1.6 +#define X_DOOR_R_OPENED X_DOOR_CLOSED - 1.6 +#define GROUND_Z_COORD (47.451492) +#define X_ELEVATOR_POS (-1951.603027) +#define Y_ELEVATOR_POS (636.418334) + +// Elevator state defines +#define ELEVATOR_STATE_IDLE (0) +#define ELEVATOR_STATE_WAITING (1) +#define ELEVATOR_STATE_MOVING (2) + +// Invalid floor define +#define INVALID_FLOOR (-1) + +// ----------------------------------------------------------------------------- +// Constants +// --------- + +// Elevator floor names for the 3D text labels +static FloorNames[2][] = +{ + "Ground Floor", + "ZomboTech Lab" +}; + +// Elevator floor Z heights +static Float:FloorZOffsets[2] = +{ + 0.0, // Ground Floor + -21.628007 // ZomboTech Lab -21.598007 +}; + +// ----------------------------------------------------------------------------- +// Variables +// --------- + +// Stores the created object numbers of the replacement building and the lab so +// they can be destroyed when the filterscript is unloaded +new SFZomboTechBuildingObject; +new SFZomboTechLabObject; + +// Stores the created object numbers of the elevator, the elevator doors and +// the elevator floor doors so they can be destroyed when the filterscript +// is unloaded +new Obj_Elevator, Obj_ElevatorDoors[2], Obj_FloorDoors[2][2]; + +// Stores a reference to the 3D text labels used on each floor and inside the +// elevator itself so they can be detroyed when the filterscript is unloaded +new Text3D:Label_Elevator, Text3D:Label_Floors[2]; + +// Stores the current state of the elevator (ie ELEVATOR_STATE_IDLE, +// ELEVATOR_STATE_WAITING or ELEVATOR_STATE_MOVING) +new ElevatorState; + +// Stores the current floor the elevator is on or heading to... if the value is +// ELEVATOR_STATE_IDLE or ELEVATOR_STATE_WAITING this is the current floor. If +// the value is ELEVATOR_STATE_MOVING then it is the floor it's moving to +new ElevatorFloor; + +// Stores the elevator queue for each floor +new ElevatorQueue[2]; + +// Stores who requested the floor for the elevator queue... +// FloorRequestedBy[floor_id] = playerid; (stores who requested which floor) +new FloorRequestedBy[2]; + +// Used for a timer that makes the elevator move faster after players start +// surfing the object +new ElevatorBoostTimer; + +// ----------------------------------------------------------------------------- +// Function Forwards +// ----------------- + +// Public: +forward CallElevator(playerid, floorid); // You can use INVALID_PLAYER_ID too. +forward ShowElevatorDialog(playerid); + +// Private: +forward Elevator_Initialize(); +forward Elevator_Destroy(); + +forward Elevator_OpenDoors(); +forward Elevator_CloseDoors(); +forward Floor_OpenDoors(floorid); +forward Floor_CloseDoors(floorid); + +forward Elevator_MoveToFloor(floorid); +forward Elevator_Boost(floorid); // Increases the elevator speed until it reaches 'floorid'. +forward Elevator_TurnToIdle(); + +forward ReadNextFloorInQueue(); +forward RemoveFirstQueueFloor(); +forward AddFloorToQueue(floorid); +forward IsFloorInQueue(floorid); +forward ResetElevatorQueue(); + +forward DidPlayerRequestElevator(playerid); + +forward Float:GetElevatorZCoordForFloor(floorid); +forward Float:GetDoorsZCoordForFloor(floorid); + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +// Un-comment the OnPlayerCommandText callback below (remove the "/*" and the "*/") +// to enable a simple teleport command (/zl) which teleports the player to +// the Zombotech Lab elevator. + +/* +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/zl", cmdtext, true, 3) == 0) + { + // Set the interior + SetPlayerInterior(playerid, 0); + + // Set player position and facing angle + SetPlayerPos(playerid, -1957.11 + random(2), 644.36 + random(2), 47.6); + SetPlayerFacingAngle(playerid, 215); + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~ZomboTech Lab!", 3000, 3); + + // Exit here + return 1; + } + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} +*/ + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- SF ZomboTech Filterscript"); + print(" |-- Script v1.01"); + print(" |-- 12th January 2015"); + print(" |---------------------------------------------------"); + + // Create the SF ZomboTech Building object + SFZomboTechBuildingObject = CreateObject(19593, -1951.687500, 660.023986, 89.507797, 0, 0, 0); + + // Create the SF ZomboTech Lab object + SFZomboTechLabObject = CreateObject(19594, -1951.687500, 660.023986, 29.507797, 0, 0, 0); + + // Display information in the Server Console + print(" |-- SF ZomboTech Building and Lab objects created"); + + // Reset the elevator queue + ResetElevatorQueue(); + + // Create the elevator object, the elevator doors and the floor doors + Elevator_Initialize(); + + // Display information in the Server Console + print(" |-- SF ZomboTech Building Elevator created"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Remove default GTASA SF ZomboTech map object and LOD for the player + // (so any player currently ingame does not have to rejoin for them + // to be removed when this filterscript is loaded) + RemoveBuildingForPlayer(i, 10027, -1951.687500, 660.023986, 89.507797, 250.0); // Building + RemoveBuildingForPlayer(i, 9939, -1951.687500, 660.023986, 89.507797, 250.0); // LOD + } + } + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Check for valid object + if (IsValidObject(SFZomboTechBuildingObject)) + { + // Destroy the SF ZombotTech Building object + DestroyObject(SFZomboTechBuildingObject); + + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- SF ZomboTech Building object destroyed"); + } + + // Check for valid object + if (IsValidObject(SFZomboTechLabObject)) + { + // Destroy the SF ZomboTech Lab object + DestroyObject(SFZomboTechLabObject); + + // Display information in the Server Console + print(" |-- SF ZomboTech Lab object destroyed"); + } + + // Destroy the elevator, the elevator doors and the elevator floor doors + Elevator_Destroy(); + + // Display information in the Server Console + print(" |-- SF ZomboTech Building Elevator destroyed"); + print(" |---------------------------------------------------"); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Remove default GTASA SF ZomboTech map object and LOD for the player + RemoveBuildingForPlayer(playerid, 10027, -1951.687500, 660.023986, 89.507797, 250.0); // Building + RemoveBuildingForPlayer(playerid, 9939, -1951.687500, 660.023986, 89.507797, 250.0); // LOD + + // Exit here + return 1; +} + +public OnObjectMoved(objectid) +{ + new Float:x, Float:y, Float:z; + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + if(objectid == Obj_FloorDoors[i][0]) + { + GetObjectPos(Obj_FloorDoors[i][0], x, y, z); + + // A floor door has shut so move the elevator to the next floor in the queue + if (x == X_DOOR_CLOSED) + { + Elevator_MoveToFloor(ElevatorQueue[0]); + RemoveFirstQueueFloor(); + } + } + } + + if(objectid == Obj_Elevator) // The elevator reached the specified floor. + { + KillTimer(ElevatorBoostTimer); // Kills the timer, in case the elevator reached the floor before boost. + + FloorRequestedBy[ElevatorFloor] = INVALID_PLAYER_ID; + + Elevator_OpenDoors(); + Floor_OpenDoors(ElevatorFloor); + + GetObjectPos(Obj_Elevator, x, y, z); + Label_Elevator = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, X_ELEVATOR_POS - 1.8, Y_ELEVATOR_POS + 1.6, z - 0.6, 4.0, 0, 1); + + ElevatorState = ELEVATOR_STATE_WAITING; + SetTimer("Elevator_TurnToIdle", ELEVATOR_WAIT_TIME, 0); + } + + return 1; +} + +public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) +{ + if(dialogid == DIALOG_ID) + { + if(!response) + return 0; + + if(FloorRequestedBy[listitem] != INVALID_PLAYER_ID || IsFloorInQueue(listitem)) + GameTextForPlayer(playerid, "~r~The floor is already in the queue", 3500, 4); + else if(DidPlayerRequestElevator(playerid)) + GameTextForPlayer(playerid, "~r~You already requested the elevator", 3500, 4); + else + CallElevator(playerid, listitem); + + return 1; + } + + return 0; +} + +public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) +{ + if(!IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_YES)) + { + new Float:pos[3]; + GetPlayerPos(playerid, pos[0], pos[1], pos[2]); + + //printf("X = %0.2f | Y = %0.2f | Z = %0.2f", pos[0], pos[1], pos[2]); + + if(pos[1] < (Y_ELEVATOR_POS + 1.8) && pos[1] > (Y_ELEVATOR_POS - 1.8) && pos[0] < (X_ELEVATOR_POS + 1.8) && pos[0] > (X_ELEVATOR_POS - 1.8)) // He is using the elevator button + ShowElevatorDialog(playerid); + else // Is the player using a floor button? + { + if(pos[1] > (Y_ELEVATOR_POS + 1.81) && pos[1] < (Y_ELEVATOR_POS + 3.8) && pos[0] < (X_ELEVATOR_POS - 1.81) && pos[0] > (X_ELEVATOR_POS - 3.8)) + { + // Create variable + new i = 0; + + // Check for ground floor + if (pos[2] > (GROUND_Z_COORD - 2) && pos[2] < (GROUND_Z_COORD + 2)) + { + i = 0; + } + else i = 1; + + //printf("Floor = %d | State = %d | i = %d", ElevatorFloor, ElevatorState, i); + + // Check if the elevator is not moving and already on the requested floor + if (ElevatorState != ELEVATOR_STATE_MOVING && ElevatorFloor == i) + { + // Display a gametext message and exit here + GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~r~ZomboTech Elevator~n~~r~Is Already On~n~~r~This Floor!", 3000, 5); + return 1; + } + + //printf("Call Elevator to Floor %i", i); + + CallElevator(playerid, i); + GameTextForPlayer(playerid, "~r~Elevator called", 3500, 4); + } + } + } + + return 1; +} + +// ------------------------ Functions ------------------------ +stock Elevator_Initialize() +{ + // Initializes the elevator. + + Obj_Elevator = CreateObject(18755, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD, 0.000000, 0.000000, 270.000000); + Obj_ElevatorDoors[0] = CreateObject(18757, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD, 0.000000, 0.000000, 270.000000); + Obj_ElevatorDoors[1] = CreateObject(18756, X_ELEVATOR_POS, Y_ELEVATOR_POS, GROUND_Z_COORD, 0.000000, 0.000000, 270.000000); + + Label_Elevator = Create3DTextLabel("{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to use elevator", 0xCCCCCCAA, X_ELEVATOR_POS - 1.8, Y_ELEVATOR_POS + 1.6, GROUND_Z_COORD - 0.6, 4.0, 0, 1); + + new string[128], + Float:z; + + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + Obj_FloorDoors[i][0] = CreateObject(18757, X_ELEVATOR_POS, Y_ELEVATOR_POS + 0.245, GetDoorsZCoordForFloor(i), 0.000000, 0.000000, 270.000000); + Obj_FloorDoors[i][1] = CreateObject(18756, X_ELEVATOR_POS, Y_ELEVATOR_POS + 0.245, GetDoorsZCoordForFloor(i), 0.000000, 0.000000, 270.000000); + + format(string, sizeof(string), "{CCCCCC}[%s]\n{CCCCCC}Press '{FFFFFF}~k~~CONVERSATION_YES~{CCCCCC}' to call", FloorNames[i]); + + if(i == 0) + z = 47.460277; + else + z = 25.820274; + + Label_Floors[i] = Create3DTextLabel(string, 0xCCCCCCAA, X_ELEVATOR_POS - 2.5, Y_ELEVATOR_POS + 2.5, z - 0.2, 10.5, 0, 1); + } + + // Open ground floor doors: + Floor_OpenDoors(0); + Elevator_OpenDoors(); + + return 1; +} + +stock Elevator_Destroy() +{ + // Destroys the elevator and the elevator doors + DestroyObject(Obj_Elevator); + DestroyObject(Obj_ElevatorDoors[0]); + DestroyObject(Obj_ElevatorDoors[1]); + + // Destroy the 3D text label inside the elevator + Delete3DTextLabel(Label_Elevator); + + // Loop + for(new i; i < sizeof(Obj_FloorDoors); i ++) + { + // Destroy the elevator floor doors and the floor 3D text labels + DestroyObject(Obj_FloorDoors[i][0]); + DestroyObject(Obj_FloorDoors[i][1]); + Delete3DTextLabel(Label_Floors[i]); + } + + return 1; +} + +stock Elevator_OpenDoors() +{ + // Opens the elevator's doors. + + new Float:x, Float:y, Float:z; + + GetObjectPos(Obj_ElevatorDoors[0], x, y, z); + MoveObject(Obj_ElevatorDoors[0], X_DOOR_L_OPENED, y, z, DOORS_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_DOOR_R_OPENED, y, z, DOORS_SPEED); + + return 1; +} + +stock Elevator_CloseDoors() +{ + // Closes the elevator's doors. + + if(ElevatorState == ELEVATOR_STATE_MOVING) + return 0; + + new Float:x, Float:y, Float:z; + + GetObjectPos(Obj_ElevatorDoors[0], x, y, z); + MoveObject(Obj_ElevatorDoors[0], X_DOOR_CLOSED, y, z, DOORS_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_DOOR_CLOSED, y, z, DOORS_SPEED); + + return 1; +} + +stock Floor_OpenDoors(floorid) +{ + // Opens the doors at the specified floor. + + MoveObject(Obj_FloorDoors[floorid][0], X_DOOR_L_OPENED, Y_ELEVATOR_POS + 0.245, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + MoveObject(Obj_FloorDoors[floorid][1], X_DOOR_R_OPENED, Y_ELEVATOR_POS + 0.245, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + + PlaySoundForPlayersInRange(6401, 50.0, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid) + 5.0); + + return 1; +} + +stock Floor_CloseDoors(floorid) +{ + // Closes the doors at the specified floor. + + MoveObject(Obj_FloorDoors[floorid][0], X_ELEVATOR_POS, Y_ELEVATOR_POS + 0.245, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + MoveObject(Obj_FloorDoors[floorid][1], X_ELEVATOR_POS, Y_ELEVATOR_POS + 0.245, GetDoorsZCoordForFloor(floorid), DOORS_SPEED); + + PlaySoundForPlayersInRange(6401, 50.0, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid) + 5.0); + + return 1; +} + +stock Elevator_MoveToFloor(floorid) +{ + // Moves the elevator to specified floor (doors are meant to be already closed). + + ElevatorState = ELEVATOR_STATE_MOVING; + ElevatorFloor = floorid; + + // Move the elevator slowly, to give time to clients to sync the object surfing. Then, boost it up: + MoveObject(Obj_Elevator, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetElevatorZCoordForFloor(floorid), 0.25); + MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), 0.25); + MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), 0.25); + Delete3DTextLabel(Label_Elevator); + + ElevatorBoostTimer = SetTimerEx("Elevator_Boost", 2000, 0, "i", floorid); + + return 1; +} + +public Elevator_Boost(floorid) +{ + // Increases the elevator's speed until it reaches 'floorid' + StopObject(Obj_Elevator); + StopObject(Obj_ElevatorDoors[0]); + StopObject(Obj_ElevatorDoors[1]); + + MoveObject(Obj_Elevator, X_ELEVATOR_POS, Y_ELEVATOR_POS, GetElevatorZCoordForFloor(floorid), ELEVATOR_SPEED); + MoveObject(Obj_ElevatorDoors[0], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED); + MoveObject(Obj_ElevatorDoors[1], X_ELEVATOR_POS, Y_ELEVATOR_POS, GetDoorsZCoordForFloor(floorid), ELEVATOR_SPEED); + + return 1; +} + +public Elevator_TurnToIdle() +{ + ElevatorState = ELEVATOR_STATE_IDLE; + ReadNextFloorInQueue(); + + return 1; +} + +stock RemoveFirstQueueFloor() +{ + // Removes the data in ElevatorQueue[0], and reorders the queue accordingly. + + for(new i; i < sizeof(ElevatorQueue) - 1; i ++) + ElevatorQueue[i] = ElevatorQueue[i + 1]; + + ElevatorQueue[sizeof(ElevatorQueue) - 1] = INVALID_FLOOR; + + return 1; +} + +stock AddFloorToQueue(floorid) +{ + // Adds 'floorid' at the end of the queue. + + // Scan for the first empty space: + new slot = -1; + for(new i; i < sizeof(ElevatorQueue); i ++) + { + if(ElevatorQueue[i] == INVALID_FLOOR) + { + slot = i; + break; + } + } + + if(slot != -1) + { + ElevatorQueue[slot] = floorid; + + // If needed, move the elevator. + if(ElevatorState == ELEVATOR_STATE_IDLE) + ReadNextFloorInQueue(); + + return 1; + } + + return 0; +} + +stock ResetElevatorQueue() +{ + // Resets the queue. + + for(new i; i < sizeof(ElevatorQueue); i ++) + { + ElevatorQueue[i] = INVALID_FLOOR; + FloorRequestedBy[i] = INVALID_PLAYER_ID; + } + + return 1; +} + +stock IsFloorInQueue(floorid) +{ + // Checks if the specified floor is currently part of the queue. + + for(new i; i < sizeof(ElevatorQueue); i ++) + if(ElevatorQueue[i] == floorid) + return 1; + + return 0; +} + +stock ReadNextFloorInQueue() +{ + // Reads the next floor in the queue, closes doors, and goes to it. + + if(ElevatorState != ELEVATOR_STATE_IDLE || ElevatorQueue[0] == INVALID_FLOOR) + return 0; + + Elevator_CloseDoors(); + Floor_CloseDoors(ElevatorFloor); + + return 1; +} + +stock DidPlayerRequestElevator(playerid) +{ + for(new i; i < sizeof(FloorRequestedBy); i ++) + if(FloorRequestedBy[i] == playerid) + return 1; + + return 0; +} + +stock ShowElevatorDialog(playerid) +{ + new string[512]; + for(new i; i < sizeof(ElevatorQueue); i ++) + { + if(FloorRequestedBy[i] != INVALID_PLAYER_ID) + strcat(string, "{FF0000}"); + + strcat(string, FloorNames[i]); + strcat(string, "\n"); + } + + ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "ZomboTech Elevator...", string, "Accept", "Cancel"); + + return 1; +} + +stock CallElevator(playerid, floorid) +{ + // Calls the elevator (also used with the elevator dialog). + + if(FloorRequestedBy[floorid] != INVALID_PLAYER_ID || IsFloorInQueue(floorid)) + return 0; + + FloorRequestedBy[floorid] = playerid; + AddFloorToQueue(floorid); + + return 1; +} + +stock Float:GetElevatorZCoordForFloor(floorid) + return (GROUND_Z_COORD + FloorZOffsets[floorid]); + +stock Float:GetDoorsZCoordForFloor(floorid) + return (GROUND_Z_COORD + FloorZOffsets[floorid]); diff --git a/filterscripts/skinchanger.amx b/filterscripts/skinchanger.amx new file mode 100644 index 0000000..0da31ee Binary files /dev/null and b/filterscripts/skinchanger.amx differ diff --git a/filterscripts/skinchanger.pwn b/filterscripts/skinchanger.pwn new file mode 100644 index 0000000..b612dfe --- /dev/null +++ b/filterscripts/skinchanger.pwn @@ -0,0 +1,366 @@ +// +// Admin player skin changer using previews. For SA-MP 0.3x and above. +// - Kye 2012 +// + +#include +#include "../include/gl_common.inc" + +#define TOTAL_ITEMS 312 +#define SELECTION_ITEMS 21 +#define ITEMS_PER_LINE 7 + +#define HEADER_TEXT "Skins" +#define NEXT_TEXT "Next" +#define PREV_TEXT "Prev" + +#define DIALOG_BASE_X 75.0 +#define DIALOG_BASE_Y 130.0 +#define DIALOG_WIDTH 550.0 +#define DIALOG_HEIGHT 180.0 +#define SPRITE_DIM_X 60.0 +#define SPRITE_DIM_Y 70.0 + +new gTotalItems = TOTAL_ITEMS; +new PlayerText:gCurrentPageTextDrawId[MAX_PLAYERS]; +new PlayerText:gHeaderTextDrawId[MAX_PLAYERS]; +new PlayerText:gBackgroundTextDrawId[MAX_PLAYERS]; +new PlayerText:gNextButtonTextDrawId[MAX_PLAYERS]; +new PlayerText:gPrevButtonTextDrawId[MAX_PLAYERS]; +new PlayerText:gSelectionItems[MAX_PLAYERS][SELECTION_ITEMS]; +new gSelectionItemsTag[MAX_PLAYERS][SELECTION_ITEMS]; +new gItemAt[MAX_PLAYERS]; + +new gItemList[TOTAL_ITEMS] = { +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49, +50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96, +97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131, +132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166, +167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201, +202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236, +237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271, +272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299, +300,301,302,303,304,305,306,307,308,309,310,311 +}; + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--Admin Player Skin Changer Loaded\n"); + return 1; +} + +//------------------------------------------------ + +GetNumberOfPages() +{ + if((gTotalItems >= SELECTION_ITEMS) && (gTotalItems % SELECTION_ITEMS) == 0) + { + return (gTotalItems / SELECTION_ITEMS); + } + else return (gTotalItems / SELECTION_ITEMS) + 1; +} + +//------------------------------------------------ + +PlayerText:CreateCurrentPageTextDraw(playerid, Float:Xpos, Float:Ypos) +{ + new PlayerText:txtInit; + txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, "0/0"); + PlayerTextDrawUseBox(playerid, txtInit, 0); + PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1); + PlayerTextDrawFont(playerid, txtInit, 1); + PlayerTextDrawSetShadow(playerid, txtInit, 0); + PlayerTextDrawSetOutline(playerid, txtInit, 1); + PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF); + PlayerTextDrawShow(playerid, txtInit); + return txtInit; +} + +//------------------------------------------------ +// Creates a button textdraw and returns the textdraw ID. + +PlayerText:CreatePlayerDialogButton(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, button_text[]) +{ + new PlayerText:txtInit; + txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, button_text); + PlayerTextDrawUseBox(playerid, txtInit, 1); + PlayerTextDrawBoxColor(playerid, txtInit, 0x000000FF); + PlayerTextDrawBackgroundColor(playerid, txtInit, 0x000000FF); + PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1); + PlayerTextDrawFont(playerid, txtInit, 1); + PlayerTextDrawSetShadow(playerid, txtInit, 0); // no shadow + PlayerTextDrawSetOutline(playerid, txtInit, 0); + PlayerTextDrawColor(playerid, txtInit, 0x4A5A6BFF); + PlayerTextDrawSetSelectable(playerid, txtInit, 1); + PlayerTextDrawAlignment(playerid, txtInit, 2); + PlayerTextDrawTextSize(playerid, txtInit, Height, Width); // The width and height are reversed for centering.. something the game does + PlayerTextDrawShow(playerid, txtInit); + return txtInit; +} + +//------------------------------------------------ + +PlayerText:CreatePlayerHeaderTextDraw(playerid, Float:Xpos, Float:Ypos, header_text[]) +{ + new PlayerText:txtInit; + txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, header_text); + PlayerTextDrawUseBox(playerid, txtInit, 0); + PlayerTextDrawLetterSize(playerid, txtInit, 1.25, 3.0); + PlayerTextDrawFont(playerid, txtInit, 0); + PlayerTextDrawSetShadow(playerid, txtInit, 0); + PlayerTextDrawSetOutline(playerid, txtInit, 1); + PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF); + PlayerTextDrawShow(playerid, txtInit); + return txtInit; +} + +//------------------------------------------------ + +PlayerText:CreatePlayerBackgroundTextDraw(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height) +{ + new PlayerText:txtBackground = CreatePlayerTextDraw(playerid, Xpos, Ypos, + " ~n~"); // enough space for everyone + PlayerTextDrawUseBox(playerid, txtBackground, 1); + PlayerTextDrawBoxColor(playerid, txtBackground, 0x4A5A6BBB); + PlayerTextDrawLetterSize(playerid, txtBackground, 5.0, 5.0); + PlayerTextDrawFont(playerid, txtBackground, 0); + PlayerTextDrawSetShadow(playerid, txtBackground, 0); + PlayerTextDrawSetOutline(playerid, txtBackground, 0); + PlayerTextDrawColor(playerid, txtBackground,0x000000FF); + PlayerTextDrawTextSize(playerid, txtBackground, Width, Height); + PlayerTextDrawBackgroundColor(playerid, txtBackground, 0x4A5A6BBB); + PlayerTextDrawShow(playerid, txtBackground); + return txtBackground; +} + +//------------------------------------------------ +// Creates a model preview sprite + +PlayerText:CreateModelPreviewTextDraw(playerid, modelindex, Float:Xpos, Float:Ypos, Float:width, Float:height) +{ + new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, Xpos, Ypos, ""); // it has to be set with SetText later + PlayerTextDrawFont(playerid, txtPlayerSprite, TEXT_DRAW_FONT_MODEL_PREVIEW); + PlayerTextDrawColor(playerid, txtPlayerSprite, 0xFFFFFFFF); + PlayerTextDrawBackgroundColor(playerid, txtPlayerSprite, 0x88888899); + PlayerTextDrawTextSize(playerid, txtPlayerSprite, width, height); // Text size is the Width:Height + PlayerTextDrawSetPreviewModel(playerid, txtPlayerSprite, modelindex); + PlayerTextDrawSetSelectable(playerid, txtPlayerSprite, 1); + PlayerTextDrawShow(playerid,txtPlayerSprite); + return txtPlayerSprite; +} + +//------------------------------------------------ + +DestroyPlayerModelPreviews(playerid) +{ + new x=0; + while(x != SELECTION_ITEMS) { + if(gSelectionItems[playerid][x] != PlayerText:INVALID_TEXT_DRAW) { + PlayerTextDrawDestroy(playerid, gSelectionItems[playerid][x]); + gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW; + } + x++; + } +} + +//------------------------------------------------ + +ShowPlayerModelPreviews(playerid) +{ + new x=0; + new Float:BaseX = DIALOG_BASE_X; + new Float:BaseY = DIALOG_BASE_Y - (SPRITE_DIM_Y * 0.33); // down a bit + new linetracker = 0; + + new itemat = GetPVarInt(playerid, "skinc_page") * SELECTION_ITEMS; + + // Destroy any previous ones created + DestroyPlayerModelPreviews(playerid); + + while(x != SELECTION_ITEMS && itemat < gTotalItems) { + if(linetracker == 0) { + BaseX = DIALOG_BASE_X + 25.0; // in a bit from the box + BaseY += SPRITE_DIM_Y + 1.0; // move on the Y for the next line + } + gSelectionItems[playerid][x] = CreateModelPreviewTextDraw(playerid, gItemList[itemat], BaseX, BaseY, SPRITE_DIM_X, SPRITE_DIM_Y); + gSelectionItemsTag[playerid][x] = gItemList[itemat]; + BaseX += SPRITE_DIM_X + 1.0; // move on the X for the next sprite + linetracker++; + if(linetracker == ITEMS_PER_LINE) linetracker = 0; + itemat++; + x++; + } +} + +//------------------------------------------------ + +UpdatePageTextDraw(playerid) +{ + new PageText[64+1]; + format(PageText, 64, "%d/%d", GetPVarInt(playerid,"skinc_page") + 1, GetNumberOfPages()); + PlayerTextDrawSetString(playerid, gCurrentPageTextDrawId[playerid], PageText); +} + +//------------------------------------------------ + +CreateSelectionMenu(playerid) +{ + gBackgroundTextDrawId[playerid] = CreatePlayerBackgroundTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y + 20.0, DIALOG_WIDTH, DIALOG_HEIGHT); + gHeaderTextDrawId[playerid] = CreatePlayerHeaderTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y, HEADER_TEXT); + gCurrentPageTextDrawId[playerid] = CreateCurrentPageTextDraw(playerid, DIALOG_WIDTH - 30.0, DIALOG_BASE_Y + 15.0); + gNextButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 30.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, NEXT_TEXT); + gPrevButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 90.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, PREV_TEXT); + + ShowPlayerModelPreviews(playerid); + UpdatePageTextDraw(playerid); +} + +//------------------------------------------------ + +DestroySelectionMenu(playerid) +{ + DestroyPlayerModelPreviews(playerid); + + PlayerTextDrawDestroy(playerid, gHeaderTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gBackgroundTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gCurrentPageTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gNextButtonTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gPrevButtonTextDrawId[playerid]); + + gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; +} + +//------------------------------------------------ + +HandlePlayerItemSelection(playerid, selecteditem) +{ + // In this case we change the player's skin + if(gSelectionItemsTag[playerid][selecteditem] >= 0 && gSelectionItemsTag[playerid][selecteditem] < 319) { + SetPlayerSkin(playerid, gSelectionItemsTag[playerid][selecteditem]); + return; + } +} + +//------------------------------------------------ + +public OnPlayerConnect(playerid) +{ + // Init all of the textdraw related globals + gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + + for(new x=0; x < SELECTION_ITEMS; x++) { + gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW; + } + + gItemAt[playerid] = 0; + + return 1; // Allow other scripts to keep processing OnPlayerConnect +} + +//------------------------------------------- +// Even though only Player* textdraws are used in this script, +// OnPlayerClickTextDraw is still required to handle ESC + +public OnPlayerClickTextDraw(playerid, Text:clickedid) +{ + if(GetPVarInt(playerid, "skinc_active") == 0) return 0; + + // Handle: They cancelled (with ESC) + if(clickedid == Text:INVALID_TEXT_DRAW) { + DestroySelectionMenu(playerid); + SetPVarInt(playerid, "skinc_active", 0); + PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); + return 1; + } + + return 0; +} + +//------------------------------------------------ + +public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) +{ + if(GetPVarInt(playerid, "skinc_active") == 0) return 0; + + new curpage = GetPVarInt(playerid, "skinc_page"); + + // Handle: next button + if(playertextid == gNextButtonTextDrawId[playerid]) { + if(curpage < (GetNumberOfPages() - 1)) { + SetPVarInt(playerid, "skinc_page", curpage + 1); + ShowPlayerModelPreviews(playerid); + UpdatePageTextDraw(playerid); + PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); + } else { + PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); + } + return 1; + } + + // Handle: previous button + if(playertextid == gPrevButtonTextDrawId[playerid]) { + if(curpage > 0) { + SetPVarInt(playerid, "skinc_page", curpage - 1); + ShowPlayerModelPreviews(playerid); + UpdatePageTextDraw(playerid); + PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); + } else { + PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); + } + return 1; + } + + // Search in the array of textdraws used for the items + new x=0; + while(x != SELECTION_ITEMS) { + if(playertextid == gSelectionItems[playerid][x]) { + HandlePlayerItemSelection(playerid, x); + PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); + DestroySelectionMenu(playerid); + CancelSelectTextDraw(playerid); + SetPVarInt(playerid, "skinc_active", 0); + return 1; + } + x++; + } + + return 0; +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256+1]; + new idx; + + if(!IsPlayerAdmin(playerid)) return 0; + + cmd = strtok(cmdtext, idx); + + if(strcmp("/skinchange", cmd, true) == 0) + { + // If there was a previously created selection menu, destroy it + DestroySelectionMenu(playerid); + + SetPVarInt(playerid, "skinc_active", 1); + //SetPVarInt(playerid, "skinc_page", 0); // will reset the page back to the first + + CreateSelectionMenu(playerid); + SelectTextDraw(playerid, 0xACCBF1FF); + return 1; + } + + return 0; +} +//------------------------------------------------ diff --git a/filterscripts/stunt_island.amx b/filterscripts/stunt_island.amx new file mode 100644 index 0000000..3aa1335 Binary files /dev/null and b/filterscripts/stunt_island.amx differ diff --git a/filterscripts/stunt_island.pwn b/filterscripts/stunt_island.pwn new file mode 100644 index 0000000..d542468 --- /dev/null +++ b/filterscripts/stunt_island.pwn @@ -0,0 +1,1092 @@ +// ----------------------------------------------------------------------------- +// Example Filterscript for the new Stunt Island +// --------------------------------------------- +// By Matite and Kye in January 2015 +// +// Updated to v1.02 by Matite in February 2015 +// * Added code to display the current lap record details when the player +// types the /si teleport command +// +// This script creates a Modular Island with a stunt set made of the new half tube +// objects. The location is just off the coast in the northern part of the map. It +// also enables a teleport (/si) to get there and AutoFix (/af) for vehicles. +// +// Warning, this script... +// * Uses a total of 467 player objects +// * Adds 6 x Infernuses +// * Has a teleport (/si) command enabled by default +// * Enables AutoFix (/af) for all players by default +// * Enables 10x NOS for all Infernuses by default +// * Enables adding 10x NOS to all Infernuses by using the fire key +// * Disables vehicle collisions for the Infernuses created by this script +// +// Note: you can enable the /flip command by removing the code comment lines +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// Includes +// -------- + +// SA-MP Include +#include + +// ----------------------------------------------------------------------------- +// Defines +// ------- + +// Used for chat text messages +#define COLOR_MESSAGE_YELLOW 0xFFDD00AA + +// Number of map specific vehicles created by this script +#define NUM_SI_VEHICLES 6 + +// ----------------------------------------------------------------------------- +// Forwards +// -------- + +// Used for the autofix timer (this timer runs all the time) +forward SIAutoFix(); +forward IsSIInfernus(vehicleid); + +// ----------------------------------------------------------------------------- +// Variables +// --------- + +// Stores the vehicle number of each Infernus created by this filterscript so +// they can be deleted if the filterscript is unloaded +new SIInfernus[NUM_SI_VEHICLES]; + +// Tracks whether the player has AutoFix disabled +new SIAutoFixDisabled[MAX_PLAYERS]; + +// Stores a reference to the AutoFix timer so it can be killed when this +// filterscript is unloaded +new SIAutoFixTimer; + +// Stores the race checkpoint locations for the Stunt Island +new Float:StuntIslandCPs[26][3] = +{ + // X Position Y Position Z Position + // ------------------------------------------- + + {121.96, 3422.62, 7.49}, + {262.83, 3422.62, 40.86}, + {295.66, 3422.62, 82.13}, + {332.11, 3257.69, 81.25}, + {299.93, 3337.11, 62.03}, + {311.17, 3475.42, 62.03}, + {311.17, 3647.12, 84.18}, + {322.48, 3698.05, 125.61}, + {29.69, 3698.05, 27.91}, + {73.18, 3666.20, 32.08}, + {241.21, 3679.01, 31.72}, + {241.21, 3369.28, 31.72}, + {159.44, 3298.87, 108.01}, + {159.44, 3440.01, 84.34}, + {159.44, 3514.15, 60.68}, + {159.44, 3679.18, 82.83}, + {247.58, 3739.98, 71.60}, + {235.02, 3607.64, 67.86}, + {174.86, 3494.73, 67.86}, + {130.26, 3406.86, 52.24}, + {119.19, 3362.98, 40.44}, + {108.01, 3304.27, 35.76}, + {123.23, 3217.41, 35.76}, + {139.88, 3341.60, 16.22}, + {183.17, 3456.39, 16.22}, + {110.25, 3498.03, 11.18} +}; + +// Stores the players current race checkpoint +new SIPlayerCP[MAX_PLAYERS]; + +// Stores the players race start time so it can be subtracted +// from the end race time to get the total race time +new SIPlayerStartTime[MAX_PLAYERS]; + +// Stores the fastest lap time in seconds +new FastestLapTime = 999; + +// Stores the name of the player who has the fastest lap time +new FastestLapName[MAX_PLAYER_NAME + 1]; + +// ----------------------------------------------------------------------------- +// Callbacks +// --------- + +public OnPlayerStateChange(playerid, newstate, oldstate) +{ + // Check if the new player state is driver or passenger + if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) + { + // Get the players vehicle ID + new player_vehicle = GetPlayerVehicleID(playerid); + + // Check if the player is driving one of the Infernuses created by this filterscript + if (IsSIInfernus(player_vehicle)) + { + // Disable vehicle collisions and set PVar + DisableRemoteVehicleCollisions(playerid, true); + SetPVarInt(playerid, "SIVehicleCols", 1); + } + } + else + { + // Check if the PVar is set (player had vehicle collisions disabled) + if (GetPVarInt(playerid, "SIVehicleCols")) + { + // Enable vehicle collisions and set PVar + DisableRemoteVehicleCollisions(playerid, false); + SetPVarInt(playerid, "SIVehicleCols", 0); + } + } + + // Exit here (return 1 so this callback is handled in other filterscripts) + return 1; +} + +public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) +{ + // Check for FIRE key + if (newkeys & KEY_FIRE) + { + // Fire Key is usually the Left Mouse Button + // ----------------------------------------- + + // Check if player is in any vehicle + if (!IsPlayerInAnyVehicle(playerid)) return 1; + + // Do not allow passengers to use this on people driving + if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1; + + // Check if the vehicle model is an Infernus + if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 411) + { + // Add 10x NOS + AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); + + // Debug + //printf("-->Added 10x NOS to Vehicle Number %d for Player ID %d", GetPlayerVehicleID(playerid), playerid); + } + } + + // Exit here (return 1 so this callback is handled in other filterscripts) + return 1; +} + +public OnPlayerEnterRaceCheckpoint(playerid) +{ + // Get the player pos + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + + // Increase current checkpoint + SIPlayerCP[playerid]++; + + // Debug + //printf("-->Player ID %d Current CP is %d of %d", playerid, SIPlayerCP[playerid], sizeof(StuntIslandCPs)); + + // Check if the race checkpoint is the start line + if (SIPlayerCP[playerid] == 1) + { + // Reset current checkpoint (in case the player drove back to the start CP and did not type /si) + SIPlayerCP[playerid] = 1; + + // Store the players race start time + SIPlayerStartTime[playerid] = gettime(); + + // Debug + //printf("-->Race start time for Player %d is %d", playerid, SIPlayerStartTime[playerid]); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~~h~Race Timer Started!", 3000, 3); + + // Format chat text message for all + new strTempString[64]; + new PlayerName[MAX_PLAYER_NAME + 1]; + GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); + format(strTempString, sizeof(strTempString), "* %s (ID:%d) started their timed lap.", PlayerName, playerid); + SendClientMessageToAll(COLOR_MESSAGE_YELLOW, strTempString); + + // Play a sound + PlayerPlaySound(playerid, 1139, x, y, z); + + // Create next checkpoint + SetPlayerRaceCheckpoint(playerid, 0, StuntIslandCPs[SIPlayerCP[playerid]][0], StuntIslandCPs[SIPlayerCP[playerid]][1], StuntIslandCPs[SIPlayerCP[playerid]][2], StuntIslandCPs[SIPlayerCP[playerid] + 1][0], StuntIslandCPs[SIPlayerCP[playerid] + 1][1], StuntIslandCPs[SIPlayerCP[playerid] + 1][2], 12.0); + } + // Check if the race checkpoint is the finish line + else if (SIPlayerCP[playerid] == sizeof(StuntIslandCPs)) + { + // Get the total lap time + new TotalLapTime = gettime() - SIPlayerStartTime[playerid]; + + // Get player name and store + new PlayerName[MAX_PLAYER_NAME + 1]; + GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); + + // Create variable + new strTempString[128]; + + // Check if the players total lap time is faster than the current fastest lap time + if (TotalLapTime < FastestLapTime) + { + // Check if no previous fastest lap record exists + if (FastestLapTime == 999) + { + // Format chat text messages for all + format(strTempString, sizeof(strTempString), "** %s (ID:%d) completed their timed lap in %d seconds and set a new record.", PlayerName, playerid, TotalLapTime); + SendClientMessageToAll(COLOR_MESSAGE_YELLOW, strTempString); + } + else + { + // Format chat text messages for all + format(strTempString, sizeof(strTempString), "** %s (ID:%d) completed their timed lap in %d seconds beating the existing record", PlayerName, playerid, TotalLapTime); + SendClientMessageToAll(COLOR_MESSAGE_YELLOW, strTempString); + format(strTempString, sizeof(strTempString), "* of %d seconds previously set by %s.", FastestLapTime, FastestLapName); + SendClientMessageToAll(COLOR_MESSAGE_YELLOW, strTempString); + } + + // Store new fastest lap time + FastestLapTime = TotalLapTime; + + // Store new fastest lap time name + format(FastestLapName, sizeof(FastestLapName), "%s", PlayerName); + } + else + { + // Format chat text message for all + format(strTempString, sizeof(strTempString), "* %s (ID:%d) completed their timed lap in %d seconds.", PlayerName, playerid, TotalLapTime); + SendClientMessageToAll(COLOR_MESSAGE_YELLOW, strTempString); + } + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~~h~Finished!", 3000, 3); + + // Play a sound + PlayerPlaySound(playerid, 1139, x, y, z); + + // Set current checkpoint + SIPlayerCP[playerid] = 0; + + // Create start checkpoint + SetPlayerRaceCheckpoint(playerid, 1, StuntIslandCPs[SIPlayerCP[playerid]][0], StuntIslandCPs[SIPlayerCP[playerid]][1], StuntIslandCPs[SIPlayerCP[playerid]][2], StuntIslandCPs[SIPlayerCP[playerid] + 1][0], StuntIslandCPs[SIPlayerCP[playerid] + 1][1], StuntIslandCPs[SIPlayerCP[playerid] + 1][2], 12.0); + } + // Check if the race finish line is next + else if (SIPlayerCP[playerid] == sizeof(StuntIslandCPs) - 1) + { + // Send a gametext message to the player + GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~~h~Finish Line Is Next!", 3000, 3); + + // Play a sound + PlayerPlaySound(playerid, 1138, x, y, z); + + // Create next checkpoint (finish line) + SetPlayerRaceCheckpoint(playerid, 1, StuntIslandCPs[SIPlayerCP[playerid]][0], StuntIslandCPs[SIPlayerCP[playerid]][1], StuntIslandCPs[SIPlayerCP[playerid]][2], -1, -1, -1, 12.0); + } + else + { + // Play a sound + PlayerPlaySound(playerid, 1138, x, y, z); + + // Create next checkpoint + SetPlayerRaceCheckpoint(playerid, 0, StuntIslandCPs[SIPlayerCP[playerid]][0], StuntIslandCPs[SIPlayerCP[playerid]][1], StuntIslandCPs[SIPlayerCP[playerid]][2], StuntIslandCPs[SIPlayerCP[playerid] + 1][0], StuntIslandCPs[SIPlayerCP[playerid] + 1][1], StuntIslandCPs[SIPlayerCP[playerid] + 1][2], 12.0); + } + + // Exit here + return 1; +} + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + // Check command text + if (strcmp("/si", cmdtext, true, 3) == 0) + { + // Set the player interior + SetPlayerInterior(playerid, 0); + + // Check if the player is in any vehicle + if (IsPlayerInAnyVehicle(playerid)) + { + // In a Vehicle + // ------------ + + // Set vehicle position and facing angle + SetVehiclePos(GetPlayerVehicleID(playerid), 27.24 + random(2), 3422.45, 6.2); + SetVehicleZAngle(GetPlayerVehicleID(playerid), 270); + + // Link vehicle to interior + LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0); + } + else + { + // On Foot + // ------- + + // Set player position and facing angle + SetPlayerPos(playerid, 27.24 + random(2), 3422.45, 6.2); + SetPlayerFacingAngle(playerid, 270); + } + + // Fix camera position after teleporting + SetCameraBehindPlayer(playerid); + + // Display chat text message to the player + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* You teleported to the Stunt Island... drive into the checkpoint to start your timed lap."); + + // Check if there is a previous lap record + if (FastestLapTime != 999) + { + // Create variable + new strTempString[128]; + + // Format and display chat text message to the player + format(strTempString, sizeof(strTempString), "* The current record is %d seconds previously set by %s.", FastestLapTime, FastestLapName); + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString); + } + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~b~~h~Stunt Island!", 3000, 3); + + // Set current checkpoint + SIPlayerCP[playerid] = 0; + + // Create start checkpoint + SetPlayerRaceCheckpoint(playerid, 1, StuntIslandCPs[SIPlayerCP[playerid]][0], StuntIslandCPs[SIPlayerCP[playerid]][1], StuntIslandCPs[SIPlayerCP[playerid]][2], StuntIslandCPs[SIPlayerCP[playerid] + 1][0], StuntIslandCPs[SIPlayerCP[playerid] + 1][1], StuntIslandCPs[SIPlayerCP[playerid] + 1][2], 12.0); + + // Exit here + return 1; + } + else if (strcmp("/af", cmdtext, true, 3) == 0) + { + // Check if AutoFix is enabled for the player + if (SIAutoFixDisabled[playerid] == 0) + { + // Set flag + SIAutoFixDisabled[playerid] = 1; + + // Display a chat text message to the player + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* You disabled AutoFix for your vehicle."); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~g~~h~AutoFix Disabled!", 3000, 3); + } + else + { + // Set flag + SIAutoFixDisabled[playerid] = 0; + + // Display a chat text message to the player + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* You enabled AutoFix for your vehicle."); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~g~~h~AutoFix Enabled!", 3000, 3); + } + + // Exit here + return 1; + } + /* + else if (strcmp("/flip", cmdtext, true, 5) == 0) + { + // Check to see if the player is not a driver of any vehicle + if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) + { + // Send chat text message to the player and exit here + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* You must be the driver of a vehicle before using the /flip command."); + return 1; + } + + // Create variables + new Float:x; + new Float:y; + new Float:z; + new Float:a; + new playervid = GetPlayerVehicleID(playerid); + + // Get Vehicle Pos + GetVehiclePos(playervid, x, y, z); + GetVehicleZAngle(playervid, a); + + // Flip the vehicle + SetVehiclePos(playervid, x, y, z + 2); + SetVehicleZAngle(playervid, a); + + // Display a chat text message to the player + SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Your vehicle has been flipped."); + + // Send a gametext message to the player + GameTextForPlayer(playerid, "~g~~h~Vehicle Flipped!", 3000, 3); + + // Exit here + return 1; + }*/ + + // Exit here (return 0 as the command was not handled in this filterscript) + return 0; +} + +public OnVehicleSpawn(vehicleid) +{ + // Check if the vehicle is an Infernus + if (GetVehicleModel(vehicleid) == 411) + { + // Add 10x NOS to the vehicle + AddVehicleComponent(vehicleid, 1010); + } + + // Return 0 so this callback is processed by other filterscripts and the gamemode + return 0; +} + +public OnFilterScriptInit() +{ + // Display information in the Server Console + print("\n"); + print(" |---------------------------------------------------"); + print(" |--- Stunt Island Filterscript by Matite and Kye"); + print(" |-- Script v1.02"); + print(" |-- 13th February 2015"); + print(" |---------------------------------------------------"); + + // Loop + for (new i = 0; i < MAX_PLAYERS; i++) + { + // Check if the player is connected and not a NPC + if (IsPlayerConnected(i) && !IsPlayerNPC(i)) + { + // Create stunt island objects for the player + // (so any player currently ingame does not have to rejoin for them + // to appear when this filterscript is loaded) + CreateSIObjects(i); + } + } + + // Create NUM_SI_VEHICLES Infernuses + for (new i = 0; i < NUM_SI_VEHICLES; i++) + { + // Create an Infernus and remember the vehicle number so it can be + // deleted when this filterscript is unloaded + SIInfernus[i] = CreateVehicle(411, 89.45, 3445.0 + (i * 6.0), 5.05, 90.0, -1, -1, 30); + + // Check that the vehicle was created ok + if(SIInfernus[i] != INVALID_VEHICLE_ID) + { + // Add 10x NOS to the Infernus + AddVehicleComponent(SIInfernus[i], 1010); + } + } + + // Start the AutoFix timer (every 1.803 seconds the timer is triggered) + SIAutoFixTimer = SetTimer("SIAutoFix", 1803, 1); + + // Exit here + return 1; +} + +public OnFilterScriptExit() +{ + // Display information in the Server Console + print(" |---------------------------------------------------"); + print(" |-- Stunt Island Filterscript Unloaded"); + print(" |---------------------------------------------------"); + + // Delete 6 Infernuses + for (new i = 0; i < NUM_SI_VEHICLES; i++) + { + // Delete the Infernus vehicles created by this filterscript + DestroyVehicle(SIInfernus[i]); + } + + // Kill the AutoFix timer + KillTimer(SIAutoFixTimer); + + // Exit here + return 1; +} + +public OnPlayerConnect(playerid) +{ + // Create stunt island objects for the player + CreateSIObjects(playerid); + + // Exit here + return 1; +} + +CreateSIObjects(playerid) +{ + // Create variable + new TempObjectNumber; + + // Create stunt island player objects (with draw distance of 999m) + CreatePlayerObject(playerid,19672,331.9166,3396.5845,85.9599,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19532,77.5000,3570.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19542,335.0000,3570.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19540,335.0000,3757.5000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19532,7.5000,3500.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19535,77.5000,3422.5000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19532,7.5000,3640.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19532,-62.5000,3570.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19539,335.0000,3663.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19533,77.5000,3678.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19533,77.5000,3461.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19542,7.5000,3835.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19533,-62.5000,3678.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19531,-132.5000,3570.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19538,-132.5000,3678.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19532,-132.5000,3500.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19534,-62.5000,3500.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19534,-62.5000,3640.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19541,-62.4998,3835.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19541,84.9997,3827.5000,4.3078,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19538,-132.5000,3461.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19532,-132.5000,3640.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19533,-62.5000,3461.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19532,7.5000,3422.5000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19532,-132.5000,3422.5000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19538,-132.5000,3383.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19542,-55.0000,3227.5000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19545,-62.5000,3383.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19543,-202.5000,3383.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19533,-202.5000,3461.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19541,15.0001,3352.5000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19541,77.5000,3835.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19541,-62.5000,3165.0000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19542,-132.5000,3165.0000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19541,-202.5000,3165.0000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19539,-210.0000,3383.7500,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19541,-210.0000,3422.5000,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19539,-210.0000,3461.2500,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19541,-210.0000,3499.9998,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19532,-202.5000,3570.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19533,-202.5000,3678.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19542,-210.0000,3570.0000,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19541,-210.0000,3640.0000,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19539,-210.0000,3678.7500,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19541,-202.4998,3710.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19540,335.0000,3257.5000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19546,85.0000,3352.5000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19547,-132.5000,3290.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19546,-54.9999,3352.5000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19543,-62.5000,3321.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19543,-62.5000,3258.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19536,-132.5000,3196.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19543,-62.5000,3196.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19540,-55.0000,3165.0000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19542,-210.0000,3290.0000,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19543,-202.5000,3321.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19543,-202.5000,3258.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19543,-202.5000,3196.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19539,-210.0000,3196.2500,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19546,84.9999,3757.5000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19532,77.5000,3772.5000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19539,178.7500,3757.5000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19540,85.0000,3835.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19540,-69.9998,3835.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19546,-69.9998,3710.0000,4.3080,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19532,-62.4999,3772.5000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19539,-163.7498,3710.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19539,-69.9998,3803.7500,4.3077,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19539,335.0000,3726.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19529,7.5000,3570.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19539,241.2500,3757.5000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19539,303.7500,3757.5000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19539,241.2500,3257.5000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19539,303.7500,3257.5000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19535,-62.5000,3422.5000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19535,-202.5000,3422.5000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19535,-202.5000,3500.0000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19535,-202.5000,3640.0000,4.3077,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19535,77.5000,3640.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,149.4099,3422.5000,-40.2988,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19646,300.0856,3261.5845,83.4814,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19642,124.1813,3422.5000,8.8521,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19647,134.1813,3422.5000,8.8520,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19650,96.9146,3422.5000,6.1717,0.0000,-10.0000,0.0000,999.0); + CreatePlayerObject(playerid,19643,114.1813,3422.5000,8.8521,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19659,-15.6602,3682.0776,29.3538,0.0000,0.0000,0.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19665,311.1857,3531.0288,86.7789,0.0000,0.0000,-90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "YellowDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19667,305.6357,3426.5845,95.3124,0.0000,0.0000,-90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "BlueDirt1", 0); + + CreatePlayerObject(playerid,19664,70.0058,3666.1621,31.6038,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19663,331.9166,3381.5845,81.2314,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19661,326.6671,3417.2505,83.4814,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19662,337.7673,3671.4116,87.1412,0.0000,0.0000,90.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19651,284.1701,3276.5845,73.4814,0.0000,0.0000,90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,266.0011,3406.5845,53.4814,0.0000,0.0000,180.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + CreatePlayerObject(playerid,19660,316.0011,3245.9185,83.4814,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,188.5509,3422.5000,25.7300,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19649,203.5318,3422.5000,26.3325,0.0000,20.0000,180.0000,999.0); + CreatePlayerObject(playerid,19674,200.6326,3498.2903,17.2481,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19676,140.8339,3498.2903,12.0060,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19673,231.6195,3422.5000,36.5668,0.0000,15.0000,180.0000,999.0); + CreatePlayerObject(playerid,19675,144.5353,3422.5000,9.2890,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19678,120.0057,3697.9932,51.5540,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19675,154.9452,3422.5000,10.6383,0.0000,5.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19675,165.1978,3422.5000,12.8897,0.0000,10.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19675,175.2152,3422.5000,16.0262,0.0000,15.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19670,255.9339,3422.5000,-7.4172,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19673,241.1739,3422.5000,39.5792,0.0000,10.0000,180.0000,999.0); + CreatePlayerObject(playerid,19673,250.9545,3422.5000,41.7474,0.0000,5.0000,180.0000,999.0); + CreatePlayerObject(playerid,19673,260.8867,3422.5000,43.0549,0.0000,0.0000,180.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,266.0011,3406.5845,73.4814,0.0000,0.0000,180.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + CreatePlayerObject(playerid,19649,291.0011,3422.5000,83.4814,0.0000,-0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19670,291.0011,3422.5000,33.4567,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19684,314.6369,3697.9932,126.3243,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19682,213.1957,3717.7407,29.3538,0.0000,0.0000,-135.0000,999.0); + CreatePlayerObject(playerid,19681,157.1870,3668.5852,29.3538,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19686,260.6396,3739.9441,70.3298,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19685,181.5493,3697.9929,58.8229,0.0000,-30.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19663,331.9166,3331.5845,81.2314,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,331.9167,3356.5845,33.4567,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19663,331.9166,3281.5845,81.2314,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19646,300.0856,3271.5845,83.4814,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19670,331.9166,3306.5845,33.4567,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,300.0856,3301.5845,63.4814,0.0000,-0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19649,300.0856,3351.5845,63.4814,0.0000,-0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19649,300.0856,3401.5845,63.4814,0.0000,-0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19670,300.0855,3356.5845,13.4567,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,300.0856,3306.5845,13.4567,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,311.1857,3451.5845,63.4814,0.0000,-0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19649,311.1857,3501.5845,63.4814,0.0000,-0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19670,311.1857,3466.5845,13.4567,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,311.1858,3516.5845,13.4567,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,311.1857,3575.2466,87.1413,0.0000,-0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19663,311.1858,3625.2466,84.8912,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19670,311.1857,3560.2466,37.1166,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19661,316.4353,3660.9126,87.1412,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19670,311.1857,3625.2466,32.6165,0.0000,0.0000,90.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,358.9323,3682.0776,97.1412,0.0000,0.0000,-90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,358.9323,3682.0776,117.1413,0.0000,0.0000,-90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19667,95.0057,3729.8225,46.0054,-90.0000,0.0000,0.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "BlueDirt1", 0); + + CreatePlayerObject(playerid,19662,337.7672,3692.7434,127.1412,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19684,290.5576,3697.9929,119.8723,0.0000,15.0000,180.0000,999.0); + CreatePlayerObject(playerid,19649,257.7041,3697.9929,101.8476,0.0000,-30.0000,0.0000,999.0); + CreatePlayerObject(playerid,19649,214.4028,3697.9929,76.8476,0.0000,-30.0000,0.0000,999.0); + CreatePlayerObject(playerid,19685,157.4701,3697.9929,52.3709,0.0000,-15.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19670,149.8595,3697.9929,1.6564,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19670,343.0168,3682.0776,37.1165,0.0000,0.0000,90.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19667,95.0057,3729.8225,34.9053,-90.0000,0.0000,0.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "BlueDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19668,124.6504,3397.5898,84.0644,0.0000,15.0000,-90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "BlueDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19666,159.4614,3413.4658,108.9914,0.0000,0.0000,90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "YellowDirt1", 0); + + CreatePlayerObject(playerid,19680,70.0058,3697.9932,29.3538,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19670,25.0058,3697.9932,-20.6709,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19649,20.0058,3697.9932,29.3539,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19659,-15.6602,3682.0776,34.8538,180.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19649,20.0058,3666.1621,29.3538,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19649,120.0058,3666.1621,29.3538,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19670,25.0058,3666.1621,-20.6709,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19664,241.2924,3679.2480,31.6038,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,185.1914,3693.1628,29.3538,0.0000,0.0000,-135.0000,999.0); + CreatePlayerObject(playerid,19661,236.0429,3714.9141,29.3538,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19670,125.0058,3666.1621,-20.6709,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19648,241.2924,3599.2480,29.3538,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19644,110.4799,3498.2903,11.5691,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19670,241.2924,3679.2480,-16.1709,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19647,241.2924,3569.2480,29.3539,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19664,241.2924,3489.2480,31.6038,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,241.2924,3489.2480,-16.1709,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19663,241.2924,3419.2480,27.1038,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19646,241.2924,3459.2480,29.3538,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19646,241.2924,3449.2480,29.3538,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19664,241.2924,3369.2480,31.6038,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,241.2924,3369.2480,-16.1709,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19663,241.2924,3319.2480,27.1038,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19661,236.0429,3283.5820,29.3538,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19661,235.9641,3283.5449,34.8538,-180.0000,0.0000,179.0000,999.0); + CreatePlayerObject(playerid,19649,200.3770,3278.3325,29.3538,0.0000,-0.0000,-0.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,175.3770,3294.2480,39.3538,0.0000,0.0000,0.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,175.3770,3294.2480,59.3538,0.0000,0.0000,0.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,175.3769,3294.2480,79.3538,0.0000,0.0000,0.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,175.3770,3294.2480,44.8538,180.0000,0.0000,-180.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,175.3769,3294.2480,99.3538,0.0000,0.0000,0.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + CreatePlayerObject(playerid,19670,185.3770,3278.3325,-20.6709,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19661,164.7110,3283.5820,109.3538,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19649,159.4614,3319.2480,109.3538,0.0000,-0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19649,159.4614,3369.2480,109.3538,0.0000,-0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19670,159.4614,3364.2480,59.3291,0.0000,0.0000,90.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19666,159.4614,3487.1279,85.3316,0.0000,0.0000,90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "YellowDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19666,159.4614,3560.7900,61.6717,0.0000,0.0000,90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "YellowDirt1", 0); + + CreatePlayerObject(playerid,19670,119.1004,3385.7981,-1.9767,0.0000,0.0000,90.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19649,159.4614,3442.9102,85.6940,0.0000,-0.0000,-90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "YellowDirt1", 0); + + CreatePlayerObject(playerid,19684,159.4614,3667.4851,81.6925,0.0000,-30.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,159.4614,3634.6316,63.6678,0.0000,30.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19684,159.4614,3691.5645,88.1445,0.0000,-15.0000,90.0000,999.0); + CreatePlayerObject(playerid,19661,164.7109,3734.6946,88.9614,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19670,159.4614,3714.0286,38.9367,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19661,283.7699,3734.6946,69.5128,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19684,187.8412,3739.9441,88.1445,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19649,224.2404,3739.9441,79.2371,0.0000,-15.0000,180.0000,999.0); + CreatePlayerObject(playerid,19670,273.1040,3739.9441,19.4881,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19646,289.0194,3719.0288,69.5128,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19661,283.7699,3734.6946,75.0128,180.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19682,286.5965,3701.8474,69.5128,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19681,237.4409,3645.8386,69.5129,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19649,262.0187,3673.8430,69.5129,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19649,235.0180,3608.6575,69.5129,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,235.0180,3558.6575,69.5129,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19682,232.5950,3521.4763,69.5129,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,130.2005,3429.9766,59.7885,0.0000,-15.0000,90.0000,999.0); + CreatePlayerObject(playerid,19682,208.2971,3497.1785,69.5129,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19649,171.1159,3494.7554,69.5129,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19646,222.1594,3507.6140,69.5129,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19662,135.4500,3489.5059,69.5129,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19684,130.2004,3466.3757,68.6959,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19670,258.4832,3670.3076,19.4881,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19686,108.0004,3345.2810,37.9402,0.0000,0.0000,-90.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19649,119.1004,3381.6802,46.8476,0.0000,-15.0000,90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "BlueDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19668,113.5504,3349.2935,71.1235,0.0000,15.0000,-90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "BlueDirt1", 0); + + CreatePlayerObject(playerid,19663,108.0004,3257.8167,34.8733,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,130.2004,3473.6985,19.3535,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,108.0003,3332.8167,-12.9014,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,216.7155,3422.5000,35.9592,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19672,275.3560,3419.4604,50.1579,0.0000,0.0000,-36.0000,999.0); + CreatePlayerObject(playerid,19672,281.1376,3401.6663,54.0688,0.0000,0.0000,72.0000,999.0); + CreatePlayerObject(playerid,19672,266.0011,3390.6689,58.0268,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19672,250.8645,3401.6663,61.8254,0.0000,0.0000,-72.0000,999.0); + CreatePlayerObject(playerid,19672,256.6462,3419.4604,65.9731,0.0000,0.0000,-144.0000,999.0); + CreatePlayerObject(playerid,19672,256.6462,3419.4604,85.7634,0.0000,0.0000,-144.0000,999.0); + CreatePlayerObject(playerid,19672,275.3560,3419.4604,69.9482,0.0000,0.0000,-36.0000,999.0); + CreatePlayerObject(playerid,19672,281.1376,3401.6663,73.8591,0.0000,0.0000,72.0000,999.0); + CreatePlayerObject(playerid,19672,266.0011,3390.6689,77.8171,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19672,250.8645,3401.6663,81.6157,0.0000,0.0000,-72.0000,999.0); + CreatePlayerObject(playerid,19672,276.0011,3422.5000,88.0673,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19672,305.9753,3422.5000,88.0673,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19672,327.3069,3417.8904,87.9516,0.0000,0.0000,-45.0000,999.0); + CreatePlayerObject(playerid,19550,7.5000,3710.0000,4.3077,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19672,331.9166,3366.5771,85.9599,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,331.9166,3316.5845,85.9599,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,331.9166,3346.5918,85.9599,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,331.9166,3266.5923,85.9599,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,331.9166,3296.5999,85.9599,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,327.3070,3245.2786,88.2336,0.0000,0.0000,-135.0000,999.0); + CreatePlayerObject(playerid,19672,304.6953,3245.2788,88.1757,0.0000,0.0000,135.0000,999.0); + CreatePlayerObject(playerid,19672,297.0461,3285.9395,86.1250,0.0000,0.0000,126.0000,999.0); + CreatePlayerObject(playerid,19672,279.2520,3291.7209,82.0771,0.0000,0.0000,16.0000,999.0); + CreatePlayerObject(playerid,19672,268.2546,3276.5845,78.2285,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,279.2520,3261.4480,73.9912,0.0000,0.0000,-20.0000,999.0); + CreatePlayerObject(playerid,19672,297.0460,3267.2297,70.2106,0.0000,0.0000,54.0000,999.0); + CreatePlayerObject(playerid,19672,300.0856,3286.5845,68.0976,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,300.0856,3316.5479,68.0976,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,300.0001,3336.5508,68.3325,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,300.0001,3366.5588,68.3325,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,300.0001,3386.5305,68.3325,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,300.0001,3416.5354,68.3325,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,311.1857,3436.5845,68.1464,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,311.1857,3466.5889,68.1464,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,311.1857,3486.5654,68.1464,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,311.1857,3516.5720,68.1464,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,311.1857,3531.8862,91.8754,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,311.1857,3560.2422,91.8754,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,311.1857,3590.2336,91.8754,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,311.1858,3610.2466,89.8444,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,311.1858,3640.2439,89.8444,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,315.7955,3661.5525,91.7584,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19540,85.0000,3257.5000,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19540,-210.0000,3165.0000,4.3077,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19540,-210.0000,3710.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,338.4071,3670.7717,91.8683,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19672,346.0564,3691.4324,93.9506,0.0000,0.0000,54.0000,999.0); + CreatePlayerObject(playerid,19672,363.8504,3697.2141,97.8625,0.0000,0.0000,-18.0000,999.0); + CreatePlayerObject(playerid,19672,374.8478,3682.0776,101.8288,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,363.8505,3666.9409,105.8737,0.0000,0.0000,18.0000,999.0); + CreatePlayerObject(playerid,19672,346.0564,3672.7227,109.8370,0.0000,0.0000,-54.0000,999.0); + CreatePlayerObject(playerid,19672,346.0564,3672.7227,129.7860,0.0000,0.0000,-54.0000,999.0); + CreatePlayerObject(playerid,19672,363.8505,3666.9409,125.8226,0.0000,0.0000,18.0000,999.0); + CreatePlayerObject(playerid,19672,374.8478,3682.0776,121.7777,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,363.8504,3697.2141,117.8115,0.0000,0.0000,-18.0000,999.0); + CreatePlayerObject(playerid,19672,346.0564,3691.4324,113.8996,0.0000,0.0000,54.0000,999.0); + CreatePlayerObject(playerid,19672,338.4071,3693.3833,131.7450,0.0000,0.0000,-45.0000,999.0); + CreatePlayerObject(playerid,19672,311.7588,3697.9929,130.6222,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,287.1232,3697.9929,123.3002,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,269.3201,3697.9929,113.6222,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,243.3627,3697.9929,98.6212,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,226.0258,3697.9929,88.6012,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,200.0598,3697.9929,73.6839,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,178.2511,3697.9929,62.4286,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,154.6358,3697.9929,56.6647,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,35.0058,3697.9932,34.0287,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,5.0128,3697.9932,34.0287,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,5.0128,3666.1621,34.0287,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,35.0058,3666.1621,34.0287,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,55.0236,3666.1621,36.0365,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,85.0416,3666.1621,36.0365,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,105.0083,3666.1621,34.0287,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,134.9800,3666.1621,34.0287,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,159.4567,3669.6313,34.0726,0.0000,0.0000,27.0000,999.0); + CreatePlayerObject(playerid,19672,174.5848,3682.5562,34.1170,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19672,195.7980,3703.7695,34.1170,0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19672,215.5406,3718.6057,33.9744,0.0000,0.0000,18.0000,999.0); + CreatePlayerObject(playerid,19672,234.7318,3717.1240,34.0809,0.0000,0.0000,-36.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3694.2480,36.0042,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3664.2678,36.0042,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3504.2703,36.0042,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3474.2324,36.0042,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3434.2769,32.0711,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3404.2515,32.0711,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3384.2493,36.0140,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3354.2383,36.0140,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3334.2317,32.0321,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3304.2390,31.9984,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,215.3770,3278.3325,33.8870,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,185.3680,3278.3325,33.8870,0.0000,0.0000,-0.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,175.3770,3294.2480,64.8538,180.0000,0.0000,-180.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + TempObjectNumber = CreatePlayerObject(playerid,19652,175.3769,3294.2480,84.8538,180.0000,0.0000,-180.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "GreenDirt1", 0); + + CreatePlayerObject(playerid,19672,159.4614,3304.2480,114.0335,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,164.0711,3282.9424,113.9617,0.0000,0.0000,-45.0000,999.0); + CreatePlayerObject(playerid,19672,184.7318,3281.3721,112.0262,0.0000,0.0000,36.0000,999.0); + CreatePlayerObject(playerid,19672,190.5135,3299.1663,107.8524,0.0000,0.0000,-72.0000,999.0); + CreatePlayerObject(playerid,19672,175.3769,3310.1636,103.8580,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,160.2404,3299.1663,100.0933,0.0000,0.0000,72.0000,999.0); + CreatePlayerObject(playerid,19672,166.0220,3281.3721,95.9705,0.0000,0.0000,-36.0000,999.0); + CreatePlayerObject(playerid,19672,159.4614,3334.2378,114.0335,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4614,3354.2266,114.0335,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4614,3384.2668,114.0335,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4614,3412.5928,114.0335,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4614,3486.2449,90.4535,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4614,3559.9297,66.7921,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4614,3579.7673,44.2265,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4615,3427.9221,90.4296,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4615,3457.8840,90.4296,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4613,3620.2524,60.4987,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4613,3646.2703,75.5153,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4613,3668.8413,87.1338,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4613,3693.7808,93.1308,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,190.6684,3739.9441,92.3369,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19672,210.4541,3739.9441,87.6401,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19672,239.4345,3739.9441,79.8874,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19672,263.4093,3739.9441,74.7607,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19672,285.5501,3699.5776,74.1313,-0.0000,0.0000,63.0000,999.0); + CreatePlayerObject(playerid,19672,272.6253,3684.4497,74.1723,-0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19672,251.4121,3663.2366,74.1261,-0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19672,236.5759,3643.4939,74.1149,-0.0000,0.0000,72.0000,999.0); + CreatePlayerObject(playerid,19672,235.0180,3623.6575,74.2145,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,235.0180,3593.5452,74.2145,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,235.0180,3573.5925,74.2145,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,235.0180,3543.6985,74.2145,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,231.5486,3519.2065,74.1295,-0.0000,0.0000,63.0000,999.0); + CreatePlayerObject(playerid,19672,205.9522,3496.3135,74.1754,-0.0000,0.0000,18.0000,999.0); + CreatePlayerObject(playerid,19672,186.1409,3494.8167,74.1754,-0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,156.0972,3494.8167,74.1754,-0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,134.8101,3490.1458,74.2067,-0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19672,130.2005,3463.4688,72.9750,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,130.2005,3443.7839,68.1349,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,130.2005,3414.7671,60.4308,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,129.9005,3396.0225,56.9608,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,119.1004,3395.4226,55.3437,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,119.1004,3366.4854,47.5958,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,118.8004,3347.7910,44.0340,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,108.0004,3342.5022,42.2326,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,108.0004,3272.8323,39.8413,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,108.0004,3242.8140,39.7832,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,241.2924,3629.2480,29.3538,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,241.2925,3539.2480,29.3539,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19642,241.2924,3589.2480,29.3539,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19642,241.2924,3579.2480,29.3539,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,241.7848,3542.6001,-22.0166,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,241.2924,3624.2480,-20.6709,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3524.2693,34.0474,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3554.2651,34.0474,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3614.2158,34.0474,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,241.2924,3644.2666,34.0474,0.0000,0.0000,-90.0000,999.0); + + TempObjectNumber = CreatePlayerObject(playerid,19649,159.4614,3516.5723,62.0340,0.0000,-0.0000,-90.0000,999.0); + SetPlayerObjectMaterial(playerid, TempObjectNumber, 0, 19659, "MatTubes", "YellowDirt1", 0); + + CreatePlayerObject(playerid,19672,159.4615,3501.5842,66.7697,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19672,159.4615,3531.5461,66.7697,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19685,159.4614,3577.6987,39.1911,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19685,159.4614,3601.7781,45.6431,0.0000,15.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19646,159.4614,3709.0286,88.9614,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19646,159.4614,3719.0286,88.9614,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19670,235.0180,3533.6575,19.4881,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,235.0180,3613.6575,19.4881,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,159.4614,3447.9102,35.6692,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,159.4614,3521.5723,12.0093,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,159.4614,3570.0881,-11.5234,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19661,164.7110,3734.6946,94.4614,-180.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19670,316.0011,3240.6689,33.4567,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19550,272.4998,3570.0000,4.3080,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19550,147.4997,3570.0000,4.3080,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19550,272.4998,3445.0000,4.3080,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19550,272.4998,3320.0000,4.3080,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19549,85.0002,3273.7500,4.3077,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19542,334.9997,3445.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19542,334.9997,3320.0000,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19550,147.4997,3445.0000,4.3080,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19550,147.4997,3320.0000,4.3080,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,762,159.2296,3364.1545,8.0631,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,621,172.3828,3530.9956,4.1185,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,621,210.9594,3632.0981,4.1185,0.0000,0.0000,-81.0000,999.0); + CreatePlayerObject(playerid,621,216.5798,3372.2180,4.1185,0.0000,0.0000,-55.0000,999.0); + CreatePlayerObject(playerid,621,169.0373,3244.0442,4.1185,0.0000,0.0000,21.0000,999.0); + CreatePlayerObject(playerid,621,348.5469,3253.4072,4.1185,0.0000,0.0000,71.0000,999.0); + CreatePlayerObject(playerid,762,159.7794,3569.8127,8.0631,0.0000,0.0000,40.0000,999.0); + CreatePlayerObject(playerid,762,311.5156,3624.8386,8.0631,0.0000,0.0000,78.0000,999.0); + CreatePlayerObject(playerid,762,298.8590,3306.5583,8.0631,0.0000,0.0000,126.0000,999.0); + CreatePlayerObject(playerid,762,24.2674,3664.7112,8.0631,0.0000,0.0000,169.0000,999.0); + CreatePlayerObject(playerid,762,159.5200,3713.7891,8.0631,0.0000,0.0000,-140.0000,999.0); + CreatePlayerObject(playerid,762,290.4150,3422.7559,8.0631,0.0000,0.0000,-175.0000,999.0); + CreatePlayerObject(playerid,762,240.0694,3678.5208,8.0631,0.0000,0.0000,122.0000,999.0); + CreatePlayerObject(playerid,762,107.5217,3293.8779,9.0631,0.0000,0.0000,50.0000,999.0); + CreatePlayerObject(playerid,621,60.2490,3681.9932,4.1185,0.0000,0.0000,36.0000,999.0); + CreatePlayerObject(playerid,621,313.2220,3679.3630,4.1185,0.0000,0.0000,82.0000,999.0); + CreatePlayerObject(playerid,621,267.0584,3501.8621,4.1185,0.0000,0.0000,27.0000,999.0); + CreatePlayerObject(playerid,621,263.6267,3280.8892,4.1185,0.0000,0.0000,-52.0000,999.0); + CreatePlayerObject(playerid,621,318.7102,3387.3503,4.1185,0.0000,0.0000,42.0000,999.0); + CreatePlayerObject(playerid,621,131.9952,3640.5090,4.1185,0.0000,0.0000,121.0000,999.0); + CreatePlayerObject(playerid,3509,87.8005,3438.1350,4.1266,0.0000,0.0000,-45.0000,999.0); + CreatePlayerObject(playerid,3509,87.8005,3407.0583,4.1266,0.0000,0.0000,62.0000,999.0); + CreatePlayerObject(playerid,19649,108.0004,3307.8167,37.1233,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19684,139.8314,3245.2810,36.3063,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19649,139.8315,3281.6802,27.3989,0.0000,-15.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19686,139.8315,3318.0793,18.4916,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19661,145.0810,3451.2097,17.6746,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19649,139.8315,3355.5437,17.6746,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19649,139.8315,3405.5437,17.6746,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19646,139.8315,3435.5437,17.6746,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19649,180.7469,3456.4592,17.6746,0.0000,0.0000,180.0000,999.0); + CreatePlayerObject(playerid,19662,216.4129,3461.7087,17.6746,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19662,216.4129,3493.0408,17.6746,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19646,221.6624,3477.3748,17.6746,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19649,170.8531,3498.2903,14.6323,0.0000,-5.0000,0.0000,999.0); + CreatePlayerObject(playerid,19648,130.4799,3498.2903,11.5691,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,19642,120.4800,3498.2903,11.5691,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19650,93.7424,3498.2903,6.9995,0.0000,-19.0000,0.0000,999.0); + CreatePlayerObject(playerid,19534,77.5000,3500.0000,4.3077,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,3509,87.8005,3513.5872,4.1266,0.0000,0.0000,-45.0000,999.0); + CreatePlayerObject(playerid,3509,87.8005,3482.5103,4.1266,0.0000,0.0000,62.0000,999.0); + CreatePlayerObject(playerid,19672,108.0004,3322.8167,41.8230,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,108.0004,3292.8167,41.8230,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,112.6100,3221.5107,41.8151,0.0000,0.0000,135.0000,999.0); + CreatePlayerObject(playerid,19672,135.2216,3221.5107,41.8151,0.0000,0.0000,-135.0000,999.0); + CreatePlayerObject(playerid,19672,139.8314,3244.9832,40.9682,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,139.8314,3267.9055,35.9077,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,139.8314,3296.8618,28.1914,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,139.8314,3317.8293,23.2563,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,139.8314,3340.5437,22.4207,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,139.8314,3370.5759,22.4207,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,139.8314,3390.5437,22.4207,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,139.8314,3420.5437,22.4207,-0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19672,144.4411,3451.8496,22.4207,-0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19672,165.7469,3456.4592,22.4207,-0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,195.7418,3456.4592,22.4207,-0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,217.0527,3461.0688,22.4207,-0.0000,0.0000,45.0000,999.0); + CreatePlayerObject(playerid,19672,217.0528,3493.6804,22.4207,-0.0000,0.0000,-45.0000,999.0); + CreatePlayerObject(playerid,19672,185.5585,3498.2903,20.4852,-0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19672,155.6512,3498.2903,17.9867,-0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19670,108.0004,3257.8167,-17.4014,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,139.8314,3232.8167,-12.9015,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,139.8315,3330.5437,-32.3501,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,139.8315,3410.5437,-32.3501,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19670,185.7469,3456.4592,-32.3501,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19670,175.5944,3498.2903,-34.9671,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19659,123.9158,3222.1506,37.1233,0.0000,0.0000,90.0000,999.0); + CreatePlayerObject(playerid,19542,147.4997,3257.5000,4.3080,0.0000,0.0000,-90.0000,999.0); + CreatePlayerObject(playerid,19543,77.5002,3383.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19536,7.5000,3461.2500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19536,7.5000,3803.7500,4.3077,0.0000,0.0000,0.0000,999.0); + CreatePlayerObject(playerid,19550,147.4997,3695.0000,4.3080,0.0000,0.0000,-0.0000,999.0); + CreatePlayerObject(playerid,19550,272.4998,3695.0000,4.3080,0.0000,0.0000,-180.0000,999.0); + CreatePlayerObject(playerid,621,236.0952,3742.8730,4.1185,0.0000,0.0000,125.0000,999.0); + CreatePlayerObject(playerid,19536,7.5000,3383.7500,4.3077,0.0000,0.0000,0.0000,999.0); + + // Exit here + return 1; +} + +public SIAutoFix() +{ + // AutoFix Timer + // ------------- + + // Loop + for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) + { + // Check if the player is connected, is not a NPC and has AutoFix enabled + if (IsPlayerConnected(playerid) && !IsPlayerNPC(playerid) && SIAutoFixDisabled[playerid] == 0) + { + // Check if player is the driver of the vehicle + if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) + { + // Get vehicle health + new Float:CurVehicleHealth; + new playervid = GetPlayerVehicleID(playerid); + GetVehicleHealth(playervid, CurVehicleHealth); + + // Check if the vehicles health is less than 990... if so repair the vehicle + // (repairs bodywork and sets vehicle health to 1000) + if (CurVehicleHealth < 990) RepairVehicle(playervid); + } + } + } + + // Exit here + return 1; +} + +// return true if provide vehicleid is an infernus created by this script +IsSIInfernus(vehicleid) +{ + for (new i = 0; i < NUM_SI_VEHICLES; i++) + { + if(SIInfernus[i] == vehicleid) return true; + } + return false; +} + diff --git a/filterscripts/test_cmds.amx b/filterscripts/test_cmds.amx new file mode 100644 index 0000000..ee8875c Binary files /dev/null and b/filterscripts/test_cmds.amx differ diff --git a/filterscripts/test_cmds.pwn b/filterscripts/test_cmds.pwn new file mode 100644 index 0000000..a8275e6 --- /dev/null +++ b/filterscripts/test_cmds.pwn @@ -0,0 +1,1952 @@ +//------------------------------------------------- +// +// SA-MP 0.3+ commands for internal testing. +// These were left in the distribution in case +// anyone found the snippets useful for their +// own scripts. +// Don't load this script on a public server +// as it could break your existing scripts. +// Kye 2009-2015 +// +//------------------------------------------------- + +#pragma tabsize 0 + +#include +#include +#include + +#include "../include/gl_common.inc" + +new Text3D:textid; +new PlayerText3D:player3dtextid; + +new savanna=0; +new blade=0; +new fence=0; + +new unfreezeplayer=0; +new testlbplayer=0; + +new edit_objectid = INVALID_OBJECT_ID; +new vehicleid_tokill = 0; + +// For testing text material/texture replacements +new test_tex_objects[128]; +new text_counter = 0; +new text_update_timer = -1; +new text_update_player = INVALID_PLAYER_ID; + +forward UnFreezeMe(); +forward ShowTestDialog(); +forward TimedVehicleDeath(); +forward UpdateTextTimer(); + +#define AMMUNATION_SMGS_DIALOG "\ +Weapon\tAmount\tPrice\n\ +{FFFFFF}MP5\t90\t{FF0000}$3500\ +" + +new Text:txtSpriteTest[5]; + +new test_actor_id = INVALID_ACTOR_ID; + +//------------------------------------------------- + +SpawnVehicle_InfrontOfPlayer(playerid, vehiclemodel, color1, color2) +{ + new Float:x,Float:y,Float:z; + new Float:facing; + new Float:distance; + + GetPlayerPos(playerid, x, y, z); + GetPlayerFacingAngle(playerid, facing); + + new Float:size_x,Float:size_y,Float:size_z; + GetVehicleModelInfo(vehiclemodel, VEHICLE_MODEL_INFO_SIZE, size_x, size_y, size_z); + + distance = size_x + 0.5; + + x += (distance * floatsin(-facing, degrees)); + y += (distance * floatcos(-facing, degrees)); + + facing += 90.0; + if(facing > 360.0) facing -= 360.0; + + return CreateVehicle(vehiclemodel, x, y, z + (size_z * 0.25), facing, color1, color2, -1); +} + +//------------------------------------------------- + +stock CreateExplosionEx(Float:X, Float:Y, Float:Z, type, Float:Radius, virtualworld) +{ + new x; + while(x != MAX_PLAYERS) { + if(IsPlayerConnected(x)) { + if(virtualworld == -1 || virtualworld == GetPlayerVirtualWorld(x)) { + CreateExplosionForPlayer(x, X, Y, Z, type, Radius); + } + } + x++; + } +} + +//------------------------------------------------- + +public UnFreezeMe() +{ + TogglePlayerControllable(unfreezeplayer,1); +} + +//------------------------------------------------- + +public ShowTestDialog() +{ + new listitems[] = "{FFFFFF}1\t{55EE55}Deagle\n{FFFFFF}2\t{55EE55}Sawnoff\n{FFFFFF}3\t{55EE55}Pistol\n{FFFFFF}4\t{55EE55}Grenade\n{FFFFFF}5\t{55EE55}Parachute\n6\t{55EE55}Lorikeet"; + ShowPlayerDialog(testlbplayer,2,DIALOG_STYLE_LIST,"{448844}List of weapons:",listitems,"Select","Cancel"); +} + +//------------------------------------------------- + +TabListDialogTest(playerid) +{ + new listitems[] = + "Deagle\t$5000\t100\n" \ + "Sawnoff\t$5000\t100\n" \ + "Pistol\t$1000\t50\n" \ + "M4\t$10000\t100\n" \ + "MP5\t$7500\t200\n" \ + "Grenade\t$500\t1\n" \ + "Parachute\t$10000\t1\n" \ + "Lorikeet\t$50000\t500\n"; + + ShowPlayerDialog(playerid,2,DIALOG_STYLE_TABLIST,"Buy Weapon",listitems,"Select","Cancel"); +} + +//------------------------------------------------- + +TabListHeadersDialogTest(playerid) +{ + new listitems[] = + "Weapon\tPrice\tAmmo\n" \ + "Deagle\t$5000\t100\n" \ + "Sawnoff\t$5000\t100\n" \ + "Pistol\t$1000\t50\n" \ + "M4\t$10000\t100\n" \ + "MP5\t$7500\t200\n" \ + "Grenade\t$500\t1\n" \ + "Parachute\t$10000\t1\n" \ + "Lorikeet\t$50000\t500\n"; + + ShowPlayerDialog(playerid,2,DIALOG_STYLE_TABLIST_HEADERS,"Buy Weapon",listitems,"Select","Cancel"); +} + +//------------------------------------------------- + +public TimedVehicleDeath() +{ + if(vehicleid_tokill > 0) { + DestroyVehicle(vehicleid_tokill); + } +} + +//------------------------------------------------- + +public UpdateTextTimer() +{ + new textdisp[256+1]; + format(textdisp,256,"Dynamic Update (%d)", text_counter); + text_counter++; + + SetPlayerObjectMaterialText(text_update_player, test_tex_objects[0], textdisp, 0, OBJECT_MATERIAL_SIZE_512x128, "Courier New", 48, 1, 0xFF000000, 0, 0); +} + +//------------------------------------------------- + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256+1]; + new idx; + cmd = strtok(cmdtext, idx); + new engine,lights,alarm,doors,bonnet,boot,objective; + + //if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script + + if(strcmp(cmd, "/player2v", true) == 0) + { + new tmp[256]; + new tmp2[256]; + tmp = strtok(cmdtext,idx); + tmp2 = strtok(cmdtext,idx); + PutPlayerInVehicle(strval(tmp),strval(tmp2),0); + return 1; + } + + if(strcmp( cmd, "/vc", true ) == 0 ) + { + new tmp[256]; + new created_vehicle_id; + tmp = strtok( cmdtext, idx ); + + created_vehicle_id = SpawnVehicle_InfrontOfPlayer(playerid, strval(tmp), -1, -1); + + new msg[128+1]; + format(msg,128,"Created vehicle: %d",created_vehicle_id); + SendClientMessage(playerid,0xAAAAAAAA,msg); + + return 1; + } + + + if(strcmp( cmd, "/weap", true ) == 0 ) + { + new tmp[256]; + tmp = strtok( cmdtext, idx ); + GivePlayerWeapon(playerid, strval(tmp), 9999); + return 1; + } + + if(strcmp( cmd, "/dvehicle", true ) == 0 ) + { + new tmp[256]; + tmp = strtok( cmdtext, idx ); + + DestroyVehicle( strval(tmp) ); + + new msg[256]; + format(msg,256,"Destroyed vehicle: %d",strval(tmp)); + SendClientMessage(playerid,0xAAAAAAAA,msg); + + return 1; + } + + if(strcmp( cmd, "/goto", true ) == 0) + { + new tmp[256]; + + tmp = strtok(cmdtext,idx); + if(!strlen(tmp)) { return 1; } + + new Float:X, Float:Y, Float:Z; + + if(GetPlayerVehicleID(playerid)) + { + GetPlayerPos( strval(tmp), X, Y, Z ); + SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z ); + } else { + GetPlayerPos( strval(tmp), X, Y, Z ); + SetPlayerPos( playerid, X+2, Y+2, Z ); + } + + return 1; + } + + if(strcmp(cmd, "/bring", true) == 0) + { + new tmp[256]; + + tmp = strtok(cmdtext, idx); + + if(!strlen(tmp)) { return 1; } + + new Float:X, Float:Y, Float:Z; + + if(GetPlayerVehicleID(strval(tmp))) + { + GetPlayerPos(playerid, X, Y, Z); + SetVehiclePos(GetPlayerVehicleID(strval(tmp)), X+2, Y+2, Z); + } else { + GetPlayerPos(playerid, X, Y, Z); + SetPlayerPos(strval(tmp), X+2, Y+2, Z); + } + + return 1; + } + + if(strcmp(cmd, "/me2v", true) == 0) + { + new tmp[256]; + tmp = strtok(cmdtext,idx); + PutPlayerInVehicle(playerid,strval(tmp),0); + return 1; + } + + if(strcmp(cmd, "/tpzero", true) == 0) + { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + SetVehiclePos(vid,0.0,0.0,10.0); + } + return 1; + } + + if(strcmp(cmd, "/myvw", true) == 0) + { + new tmp[256]; + tmp = strtok(cmdtext,idx); + SetPlayerVirtualWorld(playerid,strval(tmp)); + return 1; + } + + if(strcmp( cmd, "/fight", true ) == 0) + { + new tmp[256]; + new name[128]; + + tmp = strtok(cmdtext, idx); + new style = strval(tmp); + SetPlayerFightingStyle(playerid, style); + GetPlayerName(playerid,name,128); + format(tmp, 256, "(%s) fighting style changed to %d", name, style); + SendClientMessageToAll(0x4499CCFF,tmp); + return 1; + } + + if(strcmp( cmd, "/myfacingangle", true ) == 0) + { + new Float:angle; + new tmp[256]; + GetPlayerFacingAngle(playerid,angle); + format(tmp, 256, "Facing: %f",angle); + SendClientMessage(playerid,0x4499CCFF,tmp); + return 1; + } + + if(strcmp(cmd, "/crime", true) == 0) { + new tmp[256]; + new tmp2[256]; + tmp = strtok(cmdtext,idx); + tmp2 = strtok(cmdtext,idx); + PlayCrimeReportForPlayer(playerid, strval(tmp), strval(tmp2)); + return 1; + } + + if(strcmp(cmd, "/repairmycar", true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if (vid) RepairVehicle(vid); + return 1; + } + + if(strcmp(cmd, "/bv", true) == 0) + { + new tmp[128], iCar, string[128]; + + tmp = strtok(cmdtext, idx); + + if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "DO: /bv [vehicleid]"); + + iCar = strval(tmp); + + new File:file = fopen("badvehicles.txt",io_append); + format(string,sizeof(string),"%d\r\n", iCar); + fwrite(file,string); + fclose(file); + + GetPlayerName(playerid,tmp,128); + format(string, sizeof(string), "Veh ID %i marked as bad vehicle by %s", iCar, tmp); + SendClientMessageToAll(0xFFFFFFFF, string); + return 1; + } + + if(strcmp(cmd, "/weapskill", true) == 0) { + new tmp[256]; + new tmp2[256]; + tmp = strtok(cmdtext,idx); + tmp2 = strtok(cmdtext,idx); + SetPlayerSkillLevel(playerid, strval(tmp), strval(tmp2)); + return 1; + } + + if(strcmp(cmd, "/labelonvehicle", true) == 0) { + new vid = GetPlayerVehicleID(playerid); + textid = Create3DTextLabel("My Vehicle\nOwned by me\nNo Fuel\nRunning on vapour",0xEEEEEE50,0.0,0.0,0.0,15.0,0); + Attach3DTextLabelToVehicle(textid, vid, 0.0, -1.6, -0.35); // tail of the vehicle toward the ground + return 1; + } + + if(strcmp(cmd, "/labelonplayer", true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + textid = Create3DTextLabel("Player Label",0xFFFFFFFF,0.0,0.0,0.0,40.0,0); + Attach3DTextLabelToPlayer(textid, strval(tmp), 0.0, 0.0, -0.4); + return 1; + } + + if(strcmp(cmd, "/manylabels", true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + new x=0; + while(x!=50) { + Create3DTextLabel("Mah Labels",0xFFFFFFFF,X,Y,Z,100.0,0); + Z = Z + 0.1; + x++; + } + return 1; + } + + if(strcmp(cmd, "/dellabel", true) == 0) { + Delete3DTextLabel(textid); + return 1; + } + + if(strcmp(cmd, "/playerlabel", true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos( playerid, X, Y, Z ); + player3dtextid = CreatePlayer3DTextLabel(playerid,"Hello\nI'm at your position",0x008080FF,X,Y,Z,40.0); + SendClientMessage(playerid, 0xFFFFFFFF, "I created a player label at your position."); + return 1; + } + + if(strcmp(cmd, "/playerlabelveh", true) == 0) { + new vid = GetPlayerVehicleID(playerid); + player3dtextid = CreatePlayer3DTextLabel(playerid,"im in your vehicles\nand hiding behind the walls",0x008080FF,0.0,-1.6,-0.35,20.0,INVALID_PLAYER_ID,vid,1); + return 1; + } + + if(strcmp(cmd, "/playerlabelpl", true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + player3dtextid = CreatePlayer3DTextLabel(playerid,"Hello Testing",0x008080FF,0.0,0.0,0.0,30.0,strval(tmp)); + return 1; + } + + if(strcmp(cmd, "/delplayerlabel", true) == 0) { + DeletePlayer3DTextLabel(playerid, player3dtextid); + return 1; + } + + if(strcmp(cmd, "/updateplayerlabel", true) == 0) { + UpdatePlayer3DTextLabelText(playerid, player3dtextid, 0xFFFFFFFF, ""); + return 1; + } + + if(strcmp(cmd, "/carmodtest", true) == 0) { + // spawns a couple of cars in Grove with mods applied + savanna = CreateVehicle(567,2509.1343,-1686.2330,13.2296,47.3679,16,16,10000); + AddVehicleComponent(savanna,1189); //Front Bumper + AddVehicleComponent(savanna,1187); //Rear Bumper + AddVehicleComponent(savanna,1129); //Exhaust + AddVehicleComponent(savanna,1102); //Left Side Skirt + AddVehicleComponent(savanna,1133); //Right Side Skirt + AddVehicleComponent(savanna,1078); //Wheels + AddVehicleComponent(savanna,1010); //Nitro 10x + AddVehicleComponent(savanna,1087); //Hydrolics + + blade = CreateVehicle(536,2509.8462,-1671.8666,13.1510,348.3512,16,16,10000); + AddVehicleComponent(blade,1182); //Front Bumper + AddVehicleComponent(blade,1184); //Rear Bumper + AddVehicleComponent(blade,1104); //Exhaust + AddVehicleComponent(blade,1108); //Left Side Skirt + AddVehicleComponent(blade,1107); //Right Side Skirt + AddVehicleComponent(blade,1078); //Wheels + AddVehicleComponent(blade,1010); //Nitro 10x + AddVehicleComponent(blade,1087); //Hydrolics + return 1; + } + + if(strcmp(cmd, "/addnitro", true) == 0) { + new vid = GetPlayerVehicleID(playerid); + AddVehicleComponent(vid, 1010); + return 1; + } + + + if(strcmp(cmd, "/remnitro", true) == 0) { + new vid = GetPlayerVehicleID(playerid); + RemoveVehicleComponent(vid, 1010); + return 1; + } + + if(strcmp(cmd, "/paintjob", true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + new vid = GetPlayerVehicleID(playerid); + ChangeVehiclePaintjob(vid,strval(tmp)); + return 1; + } + + if(strcmp(cmd, "/longtd", true) == 0) { + new st4[256]; + new st5[256]; + new st6[256]; + new st7[1024]; + + format(st4,sizeof(st4),"0123456789012345678901234567890123456789~n~012345678901234567890123456789~n~01234567890123456789~n~0123456789~n~0123456789012345678901234567890123456789~n~01234567890123456789~n~01234567890123456789~n~01234567890123456789~n~"); + format(st5,sizeof(st5),"0123456789012345678901234567890123456789~n~012345678901234567890123456789~n~01234567890123456789~n~0123456789~n~0123456789012345678901234567890123456789~n~01234567890123456789~n~01234567890123456789~n~01234567890123456789~n~"); + format(st6,sizeof(st6),"0123456789012345678901234567890123456789~n~012345678901234567890123456789~n~01234567890123456789~n~0123456789~n~0123456789012345678901234567890123456789~n~01234567890123456789~n~01234567890123456789~n~01234567890123456789"); + format(st7,sizeof(st7),"%s %s %s~n~LEN(%d)",st4,st5,st6,strlen(st4)+strlen(st5)+strlen(st6)); + + new Text:Stats = TextDrawCreate(10.0, 10.0, st7); + TextDrawTextSize(Stats, 400.0, 400.0); + TextDrawUseBox(Stats,0); + TextDrawBoxColor(Stats,0xFFFFFFFF); + TextDrawFont(Stats,1); + TextDrawLetterSize(Stats,0.5,0.5); + TextDrawShowForPlayer(playerid,Stats); + return 1; + } + + if(strcmp(cmd, "/testmsgbox", true) == 0) { + ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Welcome","Welcome to the SA-MP 0.3 server. This is test_cmds.pwn /testmsgbox\nHope it's useful to you.","OK",""); + return 1; + } + + if(strcmp(cmd, "/testmsgbox2", true) == 0) { + ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Welcome","Welcome:\tInfo\nTest:\t\tTabulated\nLine:\t\tHello","OK","Cancel"); + return 1; + } + + if(strcmp(cmd, "/testinputbox", true) == 0) { + new loginmsg[256+1]; + new loginname[MAX_PLAYER_NAME+1]; + GetPlayerName(playerid,loginname,MAX_PLAYER_NAME); + format(loginmsg,256,"Welcome to the SA-MP 0.3 server.\n\n{EEEE88}Account:\t{FFFFFF}%s\n\n{FFFFFF}Please enter your password below:",loginname); + ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{EE7777}Login to SA-MP",loginmsg,"Login","Cancel"); + return 1; + } + + if(strcmp(cmd, "/testpassbox", true) == 0) { + new loginmsg[256+1]; + new loginname[MAX_PLAYER_NAME+1]; + GetPlayerName(playerid,loginname,MAX_PLAYER_NAME); + format(loginmsg,256,"Welcome to the SA-MP 0.3 server.\n\n{EEEE88}Account:\t{FFFFFF}%s\n\n{FFFFFF}Please enter your password below:",loginname); + ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{EE7777}Login to SA-MP",loginmsg,"Login","Cancel"); + return 1; + } + + if(strcmp(cmd, "/testlistbox", true) == 0) { + new listitems[] = "{FFFFFF}1\t{55EE55}Deagle\n{FFFFFF}2\t{55EE55}Sawnoff\n{FFFFFF}3\t{55EE55}Pistol\n{FFFFFF}4\t{55EE55}Grenade\n{FFFFFF}5\t{55EE55}Parachute\n6\t{55EE55}Lorikeet"; + ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,"{448844}List of weapons:",listitems,"Select","Cancel"); + return 1; + } + + if(strcmp(cmd, "/testtablist", true) == 0) { + TabListDialogTest(playerid); + return 1; + } + + if(strcmp(cmd, "/testtablistheaders", true) == 0) { + TabListHeadersDialogTest(playerid); + return 1; + } + + if(strcmp(cmd, "/testtablistcrash", true) == 0) { + //ShowPlayerDialog(playerid,2,DIALOG_STYLE_TABLIST_HEADERS,"{FFFF00}SMGs", "Weapon\tAmount\tPrice\n{FFFFFF}MP5\t90\t{FF0000}$3500","Buy", "Go Back"); + ShowPlayerDialog(playerid,2,DIALOG_STYLE_TABLIST_HEADERS,"{FFFF00}SMGs", AMMUNATION_SMGS_DIALOG, "Buy", "Go Back"); + return 1; + } + + if(strcmp(cmd, "/testclosebox", true) == 0) { + ShowPlayerDialog(playerid,-1,0,"","","",""); + return 1; + } + + if(strcmp(cmd, "/setfacingzero", true) == 0) { + SetPlayerFacingAngle(playerid, 0.0); + return 1; + } + + if(strcmp(cmd, "/detachtrailer", true) == 0) { + new vid = GetPlayerVehicleID(playerid); + DetachTrailerFromVehicle(vid); + return 1; + } + + if(strcmp(cmd, "/testformat", true) == 0) { + new strtest[256]; + new File:f = fopen("test.txt",io_write); + format(strtest,256,"[chat] %d %s\r\n",24,"þÿÿþ"); + SendClientMessage(playerid,0xFFFFFFFF,strtest); + fwrite(f,strtest); + format(strtest,256,"[chat] %d %s\r\n",34," þÿÿþ"); + SendClientMessage(playerid,0xFFFFFFFF,strtest); + fwrite(f,strtest); + fclose(f); + return 1; + } + + if(strcmp(cmd, "/setskin", true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + SetPlayerSkin(playerid,strval(tmp)); + return 1; + } + + if(strcmp(cmd, "/setvars", true) == 0) { + SetPVarInt(playerid,"num_test",7001); + SetPVarString(playerid,"additional_tag","Hello World"); + SetPVarFloat(playerid,"some_float",1001.0); + SendClientMessage(playerid,0xFFFFFFFF, "Vars set"); + return 1; + } + + if(strcmp(cmd, "/modvars", true) == 0) { + SetPVarInt(playerid,"num_test",8001); + SetPVarString(playerid,"additional_tag","World Hello"); + SetPVarFloat(playerid,"some_float",6901.0); + SendClientMessage(playerid,0xFFFFFFFF, "Vars modded"); + return 1; + } + + if(strcmp(cmd, "/getvars", true) == 0) { + + new tst_IntRet; + new Float:tst_FloatRet; + new tst_StrRet[256]; + new tst_DispStr[256]; + + tst_IntRet = GetPVarInt(playerid,"num_test"); + tst_FloatRet = GetPVarFloat(playerid,"some_float"); + GetPVarString(playerid,"additional_tag",tst_StrRet,256); + + format(tst_DispStr,256,"num_test: %d some_float: %f additional_tag: %s",tst_IntRet,tst_FloatRet,tst_StrRet); + SendClientMessage(playerid,0xFFFFFFFF, tst_DispStr); + + return 1; + } + + if(strcmp(cmd, "/delvars", true) == 0) { + DeletePVar(playerid,"num_test"); + DeletePVar(playerid,"additional_tag"); + DeletePVar(playerid,"some_float"); + SendClientMessage(playerid,0xFFFFFFFF, "Vars deleted"); + return 1; + } + + if(strcmp(cmd, "/pvarlist", true) == 0) { + SendPVarListToPlayer(playerid); + return 1; + } + + if(strcmp(cmd, "/kill",true) == 0) { + SetPlayerHealth(playerid,0.0); + return 1; + } + + if(strcmp(cmd, "/kickallnpc",true) == 0) { + new p=0; + while(p!=MAX_PLAYERS) { + if(IsPlayerConnected(p) && IsPlayerNPC(p)) Kick(p); + p++; + } + return 1; + } + + if(strcmp(cmd, "/startengine",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); + } + return 1; + } + if(strcmp(cmd, "/stopengine",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective); + } + return 1; + } + + if(strcmp(cmd, "/openboot",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective); + } + return 1; + } + if(strcmp(cmd, "/closeboot",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective); + } + return 1; + } + if(strcmp(cmd, "/openbonnet",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective); + } + return 1; + } + if(strcmp(cmd, "/closebonnet",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective); + } + return 1; + } + if(strcmp(cmd, "/alarmon",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective); + } + return 1; + } + if(strcmp(cmd, "/alarmoff",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective); + } + return 1; + } + if(strcmp(cmd, "/lightson",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective); + } + return 1; + } + if(strcmp(cmd, "/lightsoff",true) == 0) { + new vid = GetPlayerVehicleID(playerid); + if(vid != INVALID_VEHICLE_ID) { + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective); + } + return 1; + } + + if(strcmp(cmd, "/holdobjectid",true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + SetPlayerAttachedObject(playerid,0,strval(tmp),6); + SetPlayerAttachedObject(playerid,1,strval(tmp),5); + //SetPlayerAttachedObject(playerid, 0, 1254,2, 0.1,0.05,0,0,90,0); + return 1; + } + + if(strcmp(cmd, "/removeheld",true) == 0) { + new zz=0; + while(zz!=MAX_PLAYER_ATTACHED_OBJECTS) { + if(IsPlayerAttachedObjectSlotUsed(playerid, zz)) { + RemovePlayerAttachedObject(playerid, zz); + } + zz++; + } + return 1; + } + + if(strcmp(cmd, "/attachobj",true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + new obj = CreateObject(strval(tmp),0.0,0.0,0.0,0.0,0.0,0.0,200.0); + AttachObjectToVehicle(obj,GetPlayerVehicleID(playerid),0.0,0.0,1.0,0.0,0.0,0.0); + return 1; + } + + if(strcmp(cmd, "/attachtome",true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + new obj = CreateObject(strval(tmp),0.0,0.0,0.0,0.0,0.0,0.0,200.0); + AttachObjectToPlayer(obj,playerid,0.0,0.0,2.0,0.0,0.0,0.0); + return 1; + } + + if(strcmp(cmd, "/mapicontest",true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + SetPlayerCheckpoint(playerid,X,Y,Z,5.0); + SetPlayerMapIcon(playerid, 1, X+50.0, Y, Z, 52, 0, MAPICON_LOCAL_CHECKPOINT); + SetPlayerMapIcon(playerid, 2, X+100.0, Y, Z, 53, 0, MAPICON_LOCAL_CHECKPOINT); + SetPlayerMapIcon(playerid, 3, X+150.0, Y, Z, 54, 0, MAPICON_LOCAL_CHECKPOINT); + SetPlayerMapIcon(playerid, 4, X+200.0, Y, Z, 55, 0, MAPICON_LOCAL_CHECKPOINT); + SetPlayerMapIcon(playerid, 5, X+250.0, Y, Z, 0, 0x00FF00FF); + return 1; + } + + if(strcmp(cmd, "/mapicondel",true) == 0) { + RemovePlayerMapIcon(playerid, 1); + RemovePlayerMapIcon(playerid, 2); + RemovePlayerMapIcon(playerid, 3); + RemovePlayerMapIcon(playerid, 4); + RemovePlayerMapIcon(playerid, 5); + return 1; + } + + if(strcmp(cmd, "/mapicontest2",true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + RemovePlayerMapIcon(playerid, 0); + SetPlayerMapIcon(playerid, 0, X, Y, Z, 33, 0, MAPICON_GLOBAL); + RemovePlayerMapIcon(playerid, 2); + SetPlayerMapIcon(playerid, 2, X+100.0, Y, Z, 55, 0, MAPICON_LOCAL); + return 1; + } + + if(strcmp(cmd, "/setweap",true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + SetPlayerArmedWeapon(playerid,strval(tmp)); + return 1; + } + + if(strcmp(cmd, "/jetpack",true) == 0) { + SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK); + return 1; + } + + if(strcmp(cmd, "/crobj",true) == 0) { + new Float:X, Float:Y, Float:Z; + new tmp[256]; + GetPlayerPos(playerid, X, Y, Z); + tmp = strtok(cmdtext,idx); + CreateObject(strval(tmp),X+1.0,Y+1.0,Z+0.5,0.0,0.0,0.0,200.0); + return 1; + } + + if(strcmp(cmd, "/dropaudio",true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls", X, Y, Z, 40.0, true); + return 1; + } + + if(strcmp(cmd, "/officefloor",true) == 0) { + SetPlayerPos(playerid,1786.0645,-1298.7510,104.2); + return 1; + } + + if(strcmp(cmd, "/lvpd",true) == 0) { + SetPlayerInterior(playerid, 3); + SetPlayerPos(playerid,237.5571,148.7559,1005.4703); + return 1; + } + + if(strcmp(cmd, "/kill",true) == 0) { + SetPlayerHealth(playerid,0.0); + return 1; + } + + if(strcmp(cmd, "/atrailer",true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + AttachTrailerToVehicle(strval(tmp),GetPlayerVehicleID(playerid)); + return 1; + } + + if(strcmp(cmd, "/dtrailer",true) == 0) { + if(GetVehicleTrailer(GetPlayerVehicleID(playerid)) != 0) { + DetachTrailerFromVehicle(GetPlayerVehicleID(playerid)); + } + return 1; + } + + if(strcmp(cmd, "/cfence",true) == 0) { + SetPlayerPos(playerid,2496.40, -1664.84, 13.19); + if(!fence) fence = CreateObject(1410, 2496.80, -1661.88, 13.4, 0.00, 0.00, 0.00); + return 1; + } + + if(strcmp(cmd, "/mfence1",true) == 0) { + MoveObject(fence, 2494.56, -1664.12, 13.4, 1.0, 0.00, 0.00, -90.0); + return 1; + } + + if(strcmp(cmd, "/mfence2",true) == 0) { + MoveObject(fence, 2496.80, -1661.88, 13.4, 1.0, 0.00, 0.00, 0.00); + return 1; + } + + if(strcmp(cmd, "/usecell",true) == 0) { + SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE); + //SetPlayerAttachedObject(playerid, 4, 330, 6); // 4 = attachment slot, 330 = cellphone model, 6 = right hand + return 1; + } + + if(strcmp(cmd, "/stopcell",true) == 0) { + SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE); + RemovePlayerAttachedObject(playerid, 4); + return 1; + } + + if(strcmp(cmd, "/objvehst",true) == 0) { + new objveh; + new objatt; + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + objveh = CreateVehicle(563, X+2.0, Y+2.0, Z, 0.0, 0, 0, -1); + objatt = CreateObject(19277, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 200.0); + AttachObjectToVehicle(objatt, objveh, 2.0, 0.15, 0.0, 0.0, 0.0, 90.0); + return 1; + } + + if(strcmp(cmd, "/uncontrol", true) == 0) { + TogglePlayerControllable(playerid, 0); + unfreezeplayer = playerid; + //SetTimer("UnFreezeMe",5000,0); + return 1; + } + + if(strcmp(cmd, "/recontrol", true) == 0) { + TogglePlayerControllable(playerid, 1); + return 1; + } + + if(strcmp(cmd, "/objlim1", true) == 0) { + new Float:X, Float:Y, Float:Z; + new lp=0; + GetPlayerPos(playerid, X, Y, Z); + while(lp != 999) { + CreateObject(1656, X, Y, Z, 0.00, 0.00, 0.00, 1000.0); + Y += 0.25; + lp++; + } + return 1; + } + + if(strcmp(cmd, "/kkeys", true) == 0) { + new message[256+1]; + format(message, 256, "{FFFFFF}Left Key: {FFFF00}~k~~GO_LEFT~ {FFFFFF}Right Key: {FFFF00}~k~~GO_RIGHT~ {FFFFFF}Fire Key: {FFFF00}~k~~PED_FIREWEAPON~"); + SendClientMessage(playerid, 0xFFFFFFFF, message); + return 1; + } + + if(strcmp(cmd, "/timeddlg", true) == 0) { + testlbplayer = playerid; + SetTimer("ShowTestDialog",5000,0); + return 1; + } + + if(strcmp(cmd, "/editattach",true) == 0) { + if(!IsPlayerAttachedObjectSlotUsed(playerid, 0)) { + SetPlayerAttachedObject(playerid,0,19006,2); // red sunglasses to head bone + } + SendClientMessage(playerid, 0xFFFFFFFF, "Hint: Use {FFFF00}~k~~PED_SPRINT~{FFFFFF} to look around."); + EditAttachedObject(playerid, 0); + return 1; + } + + if(strcmp(cmd, "/editobject",true) == 0) { + if(edit_objectid == INVALID_OBJECT_ID) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + edit_objectid = CreateObject(1656,X+1.0,Y+1.0,Z+0.5,0.0,0.0,0.0,200.0); + } + SendClientMessage(playerid, 0xFFFFFFFF, "Hint: Use {FFFF00}~k~~PED_SPRINT~{FFFFFF} to look around."); + EditObject(playerid, edit_objectid); + return 1; + } + + if(strcmp(cmd, "/selobj",true) == 0) { + SendClientMessage(playerid, 0xFFFFFFFF, "Hint: Use {FFFF00}~k~~PED_SPRINT~{FFFFFF} to look around."); + SelectObject(playerid); + return 1; + } + + if(strcmp(cmd, "/canceledit",true) == 0) { + CancelEdit(playerid); + return 1; + } + + if(strcmp(cmd, "/editpobject",true) == 0) { + if(edit_objectid == INVALID_OBJECT_ID) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + edit_objectid = CreatePlayerObject(playerid,19522,X+1.0,Y+1.0,Z+0.5,0.0,0.0,0.0,200.0); + } + SendClientMessage(playerid, 0xFFFFFFFF, "Hint: Use {FFFF00}~k~~PED_SPRINT~{FFFFFF} to look around."); + EditPlayerObject(playerid, edit_objectid); + return 1; + } + + if(strcmp(cmd, "/cam_on_obj",true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + if(edit_objectid == INVALID_OBJECT_ID) { + edit_objectid = CreateObject(19320,X+1.0,Y+1.0,Z+0.5,0.0,0.0,0.0,200.0); + } + //TogglePlayerSpectating(playerid, 1); + AttachCameraToObject(playerid, edit_objectid); + MoveObject(edit_objectid, X, Y + 2000.0, Z + 400.0, 20.0); + return 1; + } + + if(strcmp(cmd, "/cam_on_train",true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + if(edit_objectid == INVALID_OBJECT_ID) { + edit_objectid = CreateObject(19320,X+1.0,Y+1.0,Z+0.5,0.0,0.0,0.0,200.0); + } + TogglePlayerSpectating(playerid, 1); + AttachObjectToVehicle(edit_objectid, 9, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0); + PlayerSpectateVehicle(playerid, 9); + AttachCameraToObject(playerid, edit_objectid); + return 1; + } + + if(strcmp(cmd, "/cam_interp",true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + InterpolateCameraPos(playerid, X, Y, Z, X + 100.0, Y + 100.0, Z + 20.0, 10000); + return 1; + } + + if(strcmp(cmd, "/cam_interp_look",true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + InterpolateCameraPos(playerid, X, Y, Z, X + 100.0, Y + 100.0, Z + 20.0, 10000); + InterpolateCameraLookAt(playerid, X, Y, Z, 0.0, 0.0, 0.0, 10000); + return 1; + } + + if(strcmp(cmd, "/cam_behind",true) == 0) { + SetCameraBehindPlayer(playerid); + return 1; + } + + if(strcmp(cmd, "/respawn_veh",true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + SetVehicleToRespawn(strval(tmp)); + return 1; + } + + if(strcmp(cmd, "/crplain", true) == 0) { + CreateObject(19003, 416.54, 1655.75, 700.00, 0.00, 0.00, 0.00, 200.0); + CreateObject(4561, -26.98, 1639.33, 98.03, 0.00, 0.00, 0.00, 1000.0); + return 1; + } + + if(strcmp(cmd, "/testplain", true) == 0) { + CreateObject(19003, 416.54, 1655.75, 700.00, 0.00, 0.00, 0.00); + + if(GetPlayerVehicleID(playerid)) { + SetVehiclePos(GetPlayerVehicleID(playerid), 416.54, 1655.75, 705.00); + } + else { + SetPlayerPos(playerid, 416.54, 1655.75, 710.00); + } + return 1; + } + + if(strcmp(cmd, "/testplain2", true) == 0) { + CreateObject(10766, 168.86, 1686.77, 44.86, 0.00, 0.00, 0.00, 1000.0); + CreateObject(10766, 168.86, 1532.52, 44.86, 0.00, 0.00, 0.00, 1000.0); + + if(GetPlayerVehicleID(playerid)) { + SetVehiclePos(GetPlayerVehicleID(playerid), 162.9956, 1606.2555, 55.3197); + } + else { + SetPlayerPos(playerid, 162.9956, 1606.2555, 55.3197); + } + return 1; + } + + if(strcmp(cmd, "/clicktd",true) == 0) { + new Text:txtTestText1; + + txtTestText1 = TextDrawCreate(320.0, 100.0, "Test Text 1"); + TextDrawUseBox(txtTestText1, 1); + TextDrawBoxColor(txtTestText1, 0x00000044); + TextDrawFont(txtTestText1, 3); + TextDrawSetShadow(txtTestText1,0); // no shadow + TextDrawSetOutline(txtTestText1,2); // thickness 1 + TextDrawBackgroundColor(txtTestText1,0x000000FF); + TextDrawColor(txtTestText1,0xFFFFFFFF); + TextDrawAlignment(txtTestText1,2); // centered + TextDrawLetterSize(txtTestText1,0.5,1.5); + TextDrawTextSize(txtTestText1, 20.0, 200.0); // reverse width and height for rockstar (only for centered td's) + TextDrawSetSelectable(txtTestText1, 1); + TextDrawShowForPlayer(playerid,txtTestText1); + + new Text:txtSprite1; + txtSprite1 = TextDrawCreate(200.0, 220.0, "samaps:map"); // Text is txdfile:texture + TextDrawFont(txtSprite1, 4); // Font ID 4 is the sprite draw font + TextDrawColor(txtSprite1,0xFFFFFFFF); + TextDrawTextSize(txtSprite1,200.0,200.0); // Text size is the Width:Height + TextDrawSetSelectable(txtSprite1, 1); + TextDrawShowForPlayer(playerid,txtSprite1); + + SelectTextDraw(playerid, 0x9999BBBB); + return 1; + } + + if(strcmp(cmd, "/playertd",true) == 0) { + /* + new PlayerText:PlayerTestText1; + PlayerTestText1 = CreatePlayerTextDraw(playerid, 320.0, 100.0, "Test Text 1"); + PlayerTextDrawUseBox(playerid,PlayerTestText1, 1); + PlayerTextDrawBoxColor(playerid,PlayerTestText1, 0x00000044); + PlayerTextDrawFont(playerid,PlayerTestText1, 3); + PlayerTextDrawSetShadow(playerid,PlayerTestText1,0); // no shadow + PlayerTextDrawSetOutline(playerid,PlayerTestText1,2); // thickness 1 + PlayerTextDrawBackgroundColor(playerid, PlayerTestText1,0x000000FF); + PlayerTextDrawColor(playerid,PlayerTestText1,0xFFFFFFFF); + //PlayerTextDrawAlignment(playerid,PlayerTestText1,2); // centered + PlayerTextDrawLetterSize(playerid,PlayerTestText1,0.5,1.5); + PlayerTextDrawTextSize(playerid,PlayerTestText1, 50.0, 200.0); // reverse width and height for rockstar (only for centered td's) + PlayerTextDrawSetSelectable(playerid,PlayerTestText1,1); + PlayerTextDrawShow(playerid,PlayerTestText1);*/ + + //SelectTextDraw(playerid, 0x9999BBBB); + return 1; + } + + if(strcmp(cmd, "/canceltd",true) == 0) { + CancelSelectTextDraw(playerid); + return 1; + } + + if(strcmp(cmd, "/timed_vd", true) == 0) { + vehicleid_tokill = GetPlayerVehicleID(playerid); + SetTimer("TimedVehicleDeath",3000,0); + return 1; + } + + if(strcmp(cmd, "/vmodelsize", true) == 0) { + new Float:X, Float:Y, Float:Z; + new VehicleId = GetPlayerVehicleID(playerid); + new message[256+1]; + if(!VehicleId || VehicleId == INVALID_VEHICLE_ID) { + SendClientMessage(playerid, 0xFFFFFFFF, "/vmodelsize : Be in a vehicle to use this command." ); + return 1; + } + new VehicleModel = GetVehicleModel(VehicleId); + GetVehicleModelInfo(VehicleModel, VEHICLE_MODEL_INFO_SIZE, X, Y, Z); + format(message, 256, "Vehicle(%d) Size: %.4f, %.4f, %.4f", VehicleModel, X, Y, Z); + SendClientMessage(playerid, 0xFFFFFFFF, message); + return 1; + } + + + if(strcmp(cmd, "/crptex",true) == 0) { + new lp=0; + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + X+=1.0; + while(lp != 128) { + test_tex_objects[lp] = CreatePlayerObject(playerid,19372,X,Y,Z+0.5,0.0,0.0,0.0,0.0); + //SetPlayerObjectMaterial(playerid, test_tex_objects[lp], 0, 0, "null", "null", 0); + + if(lp % 2 == 0) { + SetPlayerObjectMaterial(playerid, test_tex_objects[lp], 0, 19325, "all_walls", "stormdrain3_nt", 0xFF00FF00); + } else { + SetPlayerObjectMaterial(playerid, test_tex_objects[lp], 0, 19371, "all_walls", "stormdrain3_nt", 0xFF551155); + } + + X+=2.0; + lp++; + } + } + + if(strcmp(cmd, "/crpmix",true) == 0) { + new lp=0; + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + X+=1.0; + new szId[256+1]; + while(lp != 128) { + test_tex_objects[lp] = CreatePlayerObject(playerid,19371,X,Y,Z+0.5,0.0,0.0,0.0,300.0); + //format(szId, 256, "Text Here: {00FF00}%d", lp); + //SetPlayerObjectMaterialText(playerid, test_tex_objects[lp], szId, 0, OBJECT_MATERIAL_SIZE_512x512, "Verdana", 60, 1, 0xFF5555FF, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); + if(lp % 2 == 0) { + SetPlayerObjectMaterial(playerid, test_tex_objects[lp], 0, 19371, "all_walls", "stormdrain3_nt", 0xFF55AA55); + } else { + format(szId, 256, "Text: {00FF00}%d", lp); + SetPlayerObjectMaterialText(playerid, test_tex_objects[lp], szId, 0, OBJECT_MATERIAL_SIZE_512x256, "Verdana", 60, 1, 0xFF5555FF, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); + } + X+=2.0; + lp++; + } + return 1; + } + + if(strcmp(cmd, "/crptext",true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + X+=1.0; + + test_tex_objects[0] = CreatePlayerObject(playerid,19479,X,Y,Z+0.5,0.0,0.0,0.0,300.0); + SetObjectMaterialText(test_tex_objects[0], "Dynamic Update (0)", 0, OBJECT_MATERIAL_SIZE_512x128, "Courier New", 48, 1, 0xFF000000, 0, 0); + X+=3.0; + + // This is a dynamic update material text + if(text_update_timer == -1) { + text_update_timer = SetTimer("UpdateTextTimer", 1000, 1); + text_update_player = playerid; + } + + test_tex_objects[1] = CreatePlayerObject(playerid,19479,X,Y,Z+4.0,0.0,0.0,0.0,300.0); + SetPlayerObjectMaterialText(playerid, test_tex_objects[1], "ABDSJFUEGI\nABDRJCFEGI\n{DDDDDD}Center", 0, OBJECT_MATERIAL_SIZE_512x256, "GTAWEAPON3", 70, 0, 0xFF00FF00, 0xFF444477, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); + X+=3.0; + + test_tex_objects[2] = CreatePlayerObject(playerid,19480,X,Y,Z+4.0,0.0,0.0,0.0,300.0); + SetPlayerObjectMaterialText(playerid, test_tex_objects[2], "Blue Text\nVerdana\nAlpha BG\n{DDDDDD}Center", 0, OBJECT_MATERIAL_SIZE_512x256, "Verdana", 60, 1, 0xFF000000, 0xFFFFFFFF, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); + X+=3.0; + + test_tex_objects[3] = CreatePlayerObject(playerid,19481,X,Y,Z+4.0,0.0,0.0,0.0,300.0); + SetPlayerObjectMaterialText(playerid, test_tex_objects[3], "Blue Text\nArial\nAlpha BG\n{DDDDDD}Center", 0, OBJECT_MATERIAL_SIZE_512x256, "Arial", 60, 1, 0xFF000000, 0xFFCDD704, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); + X+=3.0; + + test_tex_objects[4] = CreatePlayerObject(playerid,19482,X,Y,Z+4.0,0.0,0.0,0.0,300.0); + SetPlayerObjectMaterialText(playerid, test_tex_objects[4], "Blue Text\nVerdana\nAlpha BG\n{DDDDDD}Center", 0, OBJECT_MATERIAL_SIZE_512x256, "Verdana", 60, 1, 0xFF000000, 0xFFCDD704, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); + X+=3.0; + + test_tex_objects[5] = CreatePlayerObject(playerid,19483,X,Y,Z+4.0,0.0,0.0,0.0,300.0); + SetPlayerObjectMaterialText(playerid, test_tex_objects[5], "Blue Text\nArial\nAlpha BG\n{DDDDDD}Center", 0, OBJECT_MATERIAL_SIZE_512x256, "Arial", 60, 1, 0xFF000000, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); + X+=3.0; + + //EditPlayerObject(playerid, test_tex_objects[0]); + return 1; + } + + if(strcmp(cmd, "/delptex",true) == 0) { + new lp=0; + while(lp != 128) { + if(IsValidPlayerObject(playerid, test_tex_objects[lp])) { + DestroyPlayerObject(playerid, test_tex_objects[lp]); + } + lp++; + } + if(text_update_timer >= 0) { + KillTimer(text_update_timer); + text_update_timer = -1; + } + return 1; + } + + // Damian's bed that crashed because material object id and original object id were the same + if(strcmp(cmd, "/crashbed",true) == 0) { + new objbed1=0; + new objbed2=0; + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + + // 14446 + //0:18028:cj_bar2:CJ_nastybar_D2:000000; + //2:18646:matcolours:blue:000fff; + objbed1 = CreatePlayerObject(playerid,14446,X,Y,Z+0.1,0.0,0.0,0.0,300.0); + SetPlayerObjectMaterial(playerid, objbed1, 0, 18028, "cj_bar2", "CJ_nastybar_D2", 0xFF000000); + SetPlayerObjectMaterial(playerid, objbed1, 2, 18646, "matcolours", "blue", 0xFF000fff); + + // 14446 + //0:0:none:none:000000; + //1:0:none:none:0000ff; + //2:14446:carter_block:zebra_skin:000000; + objbed2 = CreatePlayerObject(playerid,14446,X,Y+2.0,Z+0.1,0.0,0.0,0.0,300.0); + SetPlayerObjectMaterial(playerid, objbed2, 0, 0, "none", "none", 0xFF000000); + SetPlayerObjectMaterial(playerid, objbed2, 1, 0, "none", "none", 0xFF0000FF); + //SetPlayerObjectMaterial(playerid, objbed2, 2, 18646, "matcolours", "blue", 0xFFFFFFFF); + SetPlayerObjectMaterial(playerid, objbed2, 2, 14446, "carter_block", "mp_carter_wall", 0xFFFFFFFF); + + return 1; + } + + // Damian's house object that is crashing in 0.3x + if(strcmp(cmd, "/crash_hobj",true) == 0) { + new objcab=0; + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + + //2385 + //;index_id:model_id:txd_name:txd_txt:txd_color(0 if no color); + //;0:2748:pizza_furn:CJ_WOOD6:0; + //;1:2748:pizza_furn:CJ_WOOD6:A78D84; + //;2:2748:pizza_furn:CJ_WOOD6:A78D84; + objcab = CreatePlayerObject(playerid,2385,X,Y,Z+0.1,0.0,0.0,0.0,0.0); + + SetPlayerObjectMaterial(playerid, objcab, 0, 2748, "pizza_furn", "CJ_WOOD6", 0); + SetPlayerObjectMaterial(playerid, objcab, 1, 2748, "pizza_furn", "CJ_WOOD6", 0xFFA78D84); + SetPlayerObjectMaterial(playerid, objcab, 2, 2748, "pizza_furn", "CJ_WOOD6", 0xFFA78D84); + + /* + SetPlayerObjectMaterial(playerid, objcab, 0, -1, "none", "none", 0xFF00AA00); + SetPlayerObjectMaterial(playerid, objcab, 1, -1, "none", "none", 0xFF00AA00); + SetPlayerObjectMaterial(playerid, objcab, 2, -1, "none", "none", 0xFF00AA00);*/ + + return 1; + } + + if(strcmp(cmd, "/kickmessage", true) == 0) { + KickWithMessage(playerid, "Bye!"); + return 1; + } + + if(strcmp(cmd, "/animindex", true) == 0) { + new msg[256+1]; + new animlib[64+1]; + new animname[64+1]; + new tmp[256+1]; + tmp = strtok(cmdtext,idx); + GetAnimationName(strval(tmp), animlib, 64, animname, 64); + format(msg,sizeof(msg),"AnimIndex: %d is %s:%s", strval(tmp), animlib, animname); + SendClientMessage(playerid, 0xFFFFFFFF, msg); + return 1; + } + + if(strcmp(cmd, "/weapdata", true) == 0) { + new msg[256+1]; + new x=0; + new weaponret; + new ammoret; + while(x!=13) { + GetPlayerWeaponData(playerid, x, weaponret, ammoret); + format(msg,sizeof(msg),"WeapSlot(%d) %d:%d", x, weaponret, ammoret); + SendClientMessage(playerid, 0xFFFFFFFF, msg); + x++; + } + return 1; + } + + if(strcmp(cmd, "/explosion", true) == 0) { + new tmp[256]; + tmp = strtok(cmdtext,idx); + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + CreateExplosionEx(X+10.0, Y+10.0, Z+10.0, 1, 2.0, strval(tmp)); + return 1; + } + + if(strcmp(cmd, "/flatbedcontainer",true) == 0) { + new create_flatbed = SpawnVehicle_InfrontOfPlayer(playerid, 578, -1, -1); + new obj = CreateObject(19321,0.0,0.0,0.0,0.0,0.0,0.0); + AttachObjectToVehicle(obj,create_flatbed,-0.0165,-2.0660,1.2442,0.0,0.0,0.0); + return 1; + } + + if(strcmp(cmd, "/disablevcol",true) == 0) { + DisableRemoteVehicleCollisions(playerid, 1); + return 1; + } + + if(strcmp(cmd, "/enablevcol",true) == 0) { + DisableRemoteVehicleCollisions(playerid, 0); + return 1; + } + + if(strcmp(cmd, "/disablecamtarget",true) == 0) { + EnablePlayerCameraTarget(playerid, 0); + return 1; + } + + if(strcmp(cmd, "/enablecamtarget",true) == 0) { + EnablePlayerCameraTarget(playerid, 1); + return 1; + } + + if(strcmp(cmd, "/poolsize", true) == 0) { + new msg[256+1]; + new HigestPlayerId = GetPlayerPoolSize(); + new HigestVehicleId = GetVehiclePoolSize(); + format(msg,sizeof(msg),"PlayerPoolSize: %d", HigestPlayerId); + SendClientMessage(playerid, 0xFFFFFFFF, msg); + format(msg,sizeof(msg),"VehiclePoolSize: %d", HigestVehicleId); + SendClientMessage(playerid, 0xFFFFFFFF, msg); + return 1; + } + + if(strcmp(cmd, "/sirenstate", true ) == 0) + { + if( GetPlayerVehicleID(playerid) && GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID && + GetVehicleParamsSirenState(GetPlayerVehicleID(playerid)) == VEHICLE_PARAMS_ON ) + { + SendClientMessage(playerid, 0xFFFFFFFF, "Siren is ON"); + } + else { + SendClientMessage(playerid, 0xFFFFFFFF, "Siren is OFF"); + } + + return 1; + } + + if(strcmp(cmd, "/opencardoors", true ) == 0) + { + if(GetPlayerVehicleID(playerid) && GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID) + { + SetVehicleParamsCarDoors(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON); + } + /* + if(GetPlayerCameraTargetVehicle(playerid) != INVALID_VEHICLE_ID) + { + SetVehicleParamsCarDoors(GetPlayerCameraTargetVehicle(playerid), VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON); + }*/ + return 1; + } + + if(strcmp(cmd, "/closecardoors", true ) == 0) + { + if(GetPlayerVehicleID(playerid) && GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID) + { + SetVehicleParamsCarDoors(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF); + } + /* + if(GetPlayerCameraTargetVehicle(playerid) != INVALID_VEHICLE_ID) + { + SetVehicleParamsCarDoors(GetPlayerCameraTargetVehicle(playerid), VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF); + }*/ + return 1; + } + + if(strcmp(cmd, "/opencarwindows", true ) == 0) + { + if(GetPlayerVehicleID(playerid) && GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID) + { + SetVehicleParamsCarWindows(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF); + } + return 1; + } + + if(strcmp(cmd, "/closecarwindows", true ) == 0) + { + if(GetPlayerVehicleID(playerid) && GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID) + { + SetVehicleParamsCarWindows(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON); + } + return 1; + } + + if(strcmp(cmd, "/spritetest", true ) == 0) + { + txtSpriteTest[0] = TextDrawCreate(100.0, 100.0, "ld_grav:timer"); // Text is txdfile:texture + TextDrawFont(txtSpriteTest[0], 4); // Font ID 4 is the sprite draw font + TextDrawColor(txtSpriteTest[0],0xFFFFFFFF); + TextDrawTextSize(txtSpriteTest[0],100.0,100.0); // Text size is the Width:Height + TextDrawShowForPlayer(playerid,txtSpriteTest[0]); + + txtSpriteTest[1] = TextDrawCreate(200.0, 100.0, "ld_grav:bee2"); // Text is txdfile:texture + TextDrawFont(txtSpriteTest[1], 4); // Font ID 4 is the sprite draw font + TextDrawColor(txtSpriteTest[1],0xFFFFFFFF); + TextDrawTextSize(txtSpriteTest[1],100.0,100.0); // Text size is the Width:Height + TextDrawShowForPlayer(playerid,txtSpriteTest[1]); + + txtSpriteTest[2] = TextDrawCreate(100.0, 200.0, "ld_slot:r_69"); // Text is txdfile:texture + TextDrawFont(txtSpriteTest[2], 4); // Font ID 4 is the sprite draw font + TextDrawColor(txtSpriteTest[2],0xFFFFFFFF); + TextDrawTextSize(txtSpriteTest[2],100.0,100.0); // Text size is the Width:Height + TextDrawShowForPlayer(playerid,txtSpriteTest[2]); + + txtSpriteTest[3] = TextDrawCreate(200.0, 200.0, "ld_slot:cherry"); // Text is txdfile:texture + TextDrawFont(txtSpriteTest[3], 4); // Font ID 4 is the sprite draw font + TextDrawColor(txtSpriteTest[3],0xFFFFFFFF); + TextDrawTextSize(txtSpriteTest[3],100.0,100.0); // Text size is the Width:Height + TextDrawShowForPlayer(playerid,txtSpriteTest[3]); + + txtSpriteTest[4] = TextDrawCreate(100.0, 300.0, "ld_card:cd9d"); // Text is txdfile:texture + TextDrawFont(txtSpriteTest[4], 4); // Font ID 4 is the sprite draw font + TextDrawColor(txtSpriteTest[4],0xFFFFFFFF); + TextDrawTextSize(txtSpriteTest[4],100.0,100.0); // Text size is the Width:Height + TextDrawShowForPlayer(playerid,txtSpriteTest[4]); + + return 1; + } + + if(strcmp(cmd, "/delspritetest", true ) == 0) + { + TextDrawDestroy(txtSpriteTest[0]); + TextDrawDestroy(txtSpriteTest[1]); + TextDrawDestroy(txtSpriteTest[2]); + TextDrawDestroy(txtSpriteTest[3]); + TextDrawDestroy(txtSpriteTest[4]); + return 1; + } + + if(strcmp(cmd, "/removeallbuilding", true ) == 0) + { + RemoveBuildingForPlayer(playerid, -1, 0.0, 0.0, 0.0, 6000.0); + return 1; + } + + if(strcmp(cmd, "/actoratme", true ) == 0) + { + new Float:X, Float:Y, Float:Z, Float:fang; + GetPlayerPos(playerid, X, Y, Z); + GetPlayerFacingAngle(playerid, fang); + test_actor_id = CreateActor(305, X+1.0, Y+1.0, Z+0.5, fang); + //SetActorInvulnerable(test_actor_id); + SetActorVirtualWorld(test_actor_id, GetPlayerVirtualWorld(playerid)); + return 1; + } + + if(strcmp(cmd, "/actorground", true) == 0) { + ApplyActorAnimation(test_actor_id, "BEACH", "ParkSit_M_loop", 4.0, 1, 1, 1, 1, -1); + return 1; + } + + if(strcmp(cmd, "/actorclear", true) == 0) { + ClearActorAnimations(test_actor_id); + return 1; + } + + if(strcmp(cmd, "/actorface", true) == 0) { + new Float:fang; + GetPlayerFacingAngle(playerid, fang); + SetActorFacingAngle(test_actor_id, fang); + return 1; + } + + if(strcmp(cmd, "/actorpos", true) == 0) { + new Float:X, Float:Y, Float:Z; + GetPlayerPos(playerid, X, Y, Z); + SetActorPos(test_actor_id, X+1.0, Y+1.0, Z); + return 1; + } + + return 0; +} + +//------------------------------------------- + +forward KickPublic(playerid); +public KickPublic(playerid) { Kick(playerid); } + +//------------------------------------------- + +KickWithMessage(playerid, message[]) +{ + SendClientMessage(playerid, 0xFF4444FF, message); + SetTimerEx("KickPublic", 1000, 0, "d", playerid); +} + +//------------------------------------------- + +public OnPlayerClickTextDraw(playerid, Text:clickedid) +{ + new msg[256+1]; + format(msg,sizeof(msg),"(TextDraw) You selected: %d", int:clickedid); + SendClientMessage(playerid, 0xFFFFFFFF, msg); +} + +//------------------------------------------- + +public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) +{ + new msg[256+1]; + format(msg,sizeof(msg),"(PlayerTextDraw) You selected: %d", int:playertextid); + SendClientMessage(playerid, 0xFFFFFFFF, msg); +} + +//------------------------------------------- +// Sends a list of all PVars to the player as +// client messages. + +SendPVarListToPlayer(playerid) +{ + new ubound = GetPVarsUpperIndex(playerid); + new x=0; + new name[40+1]; + new line[128+1]; + + SendClientMessage(playerid,0xF000F0F0, "---Player Vars List---"); + while(x != ubound) { + if(GetPVarNameAtIndex(playerid,x,name,40)) { + if(Util_GetPVarEntryAsString(playerid,name,line,128)) { + SendClientMessage(playerid,0xFFFFFFFF,line); + } + } + x++; + } +} + +//------------------------------------------- +// return PVar entry as 'name'='value' string + +stock Util_GetPVarEntryAsString(playerid, name[], ret[], len) +{ + new Float:fValue; + new iValue; + new szStrValue[1024+1]; // this might require greater size if you store large strings in PVars + new type; + ret[0] = EOS; + + type = GetPVarType(playerid, name); + if(type != PLAYER_VARTYPE_NONE) { + switch(type) + { + case PLAYER_VARTYPE_STRING: + { + GetPVarString(playerid,name,szStrValue,1024); + format(ret,len,"%s=%s",name,szStrValue); + } + case PLAYER_VARTYPE_INT: + { + iValue = GetPVarInt(playerid,name); + format(ret,len,"%s=%d",name,iValue); + } + case PLAYER_VARTYPE_FLOAT: + { + fValue = GetPVarFloat(playerid,name); + format(ret,len,"%s=%f",name,fValue); + } + } + return 1; + } + return 0; +} + +//------------------------------------------- +// Fills the provided string with all the player's PVars +// seperated by the specified 'delimiter' + +stock Util_CreatePVarList(playerid, retstr[], len, delimiter[]) +{ + if(!IsPlayerConnected(playerid)) return 0; + + new x=0; + new remaining_string=len; + new line[2048+1]; + new name[40+1]; + retstr[0] = EOS; + + new ubound = GetPVarsUpperIndex(playerid); + + while(x != ubound) { + if(GetPVarNameAtIndex(playerid,x,name,40)) { + if(Util_GetPVarEntryAsString(playerid,name,line,2048)) { + // if there is enough space, concat this line to the return string + if(remaining_string > (strlen(line) + strlen(delimiter))) { + strcat(retstr,line); + strcat(retstr,delimiter); + remaining_string -= (strlen(line) + strlen(delimiter)); + } + } + } + x++; + } + + return 1; +} + +//------------------------------------------- +// Test reapplying vehicle mods on respawn + +public OnVehicleSpawn(vehicleid) +{ + if(vehicleid == savanna) { + AddVehicleComponent(savanna,1189); //Front Bumper + AddVehicleComponent(savanna,1187); //Rear Bumper + AddVehicleComponent(savanna,1129); //Exhaust + AddVehicleComponent(savanna,1102); //Left Side Skirt + AddVehicleComponent(savanna,1133); //Right Side Skirt + AddVehicleComponent(savanna,1078); //Wheels + AddVehicleComponent(savanna,1010); //Nitro 10x + AddVehicleComponent(savanna,1087); //Hydraulics + } + else if(vehicleid == blade) { + AddVehicleComponent(blade,1182); //Front Bumper + AddVehicleComponent(blade,1184); //Rear Bumper + AddVehicleComponent(blade,1104); //Exhaust + AddVehicleComponent(blade,1108); //Left Side Skirt + AddVehicleComponent(blade,1107); //Right Side Skirt + AddVehicleComponent(blade,1078); //Wheels + AddVehicleComponent(blade,1010); //Nitro 10x + AddVehicleComponent(blade,1087); //Hydraulics + } +} + +//------------------------------------------- +// Example of handling dialog responses. + +public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) +{ + if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script + + if(dialogid == 0) { // Our example msgbox + if(response) { + SendClientMessage(playerid,0xFFFFFFFF,"You selected OK"); + } else { + SendClientMessage(playerid,0xFFFFFFFF,"You selected Cancel"); + } + return 1; // we processed this. no need for other filterscripts to process it. + } + + if(dialogid == 1) { // Our example inputbox + if(response) { + new message[256+1]; + format(message, 256, "You replied: %s", inputtext); + SendClientMessage(playerid, 0xFFFFFFFF, message); + } else { + SendClientMessage(playerid, 0xFFFFFFFF, "You selected Cancel"); + } + return 1; // we processed it. + } + + if(dialogid == 2) { // Our example listbox + if(response) { + new message[256+1]; + format(message, 256, "You selected item %d:", listitem); + SendClientMessage(playerid, 0xFFFFFFFF, message); + SendClientMessage(playerid, 0xFFFFFFFF, inputtext); + } else { + SendClientMessage(playerid, 0xFFFFFFFF, "You selected Cancel"); + } + return 1; // we processed it. + } + + return 0; // we didn't handle anything. +} + +//------------------------------------------- +// Example of handling scoreboard click. + +public OnPlayerClickPlayer(playerid, clickedplayerid, source) +{ + if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script + + new message[256+1]; + format(message, 256, "You clicked on player %d", clickedplayerid); + SendClientMessage(playerid, 0xFFFFFFFF, message); + return 1; +} + +//------------------------------------------- + +public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ) +{ + new message[256+1]; + format(message, 256, "You place marker at point: %f %f %f", fX, fY, fZ); + SendClientMessage(playerid, 0xFFFFFFFF, message); + SetPlayerPos(playerid, fX, fY, fZ); +} + +//------------------------------------------- +/* +public OnPlayerEditAttachedObject( playerid, response, index, modelid, boneid, + Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, + Float:fRotX, Float:fRotY, Float:fRotZ, + Float:fScaleX, Float:fScaleY, Float:fScaleZ ) +{ + SendClientMessage(playerid, 0xFFFFFFFF, "You finished editing an attached object"); + SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ); + return 1; +}*/ + +//------------------------------------------- + +public OnPlayerEditObject( playerid, playerobject, objectid, response, +Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ ) +{ + if(!playerobject) { + if(!IsValidObject(objectid)) return; + MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ); + } else { + if(!IsValidPlayerObject(playerid, objectid)) return; + MovePlayerObject(playerid, objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ); + } + + if(response == EDIT_RESPONSE_FINAL || response == EDIT_RESPONSE_CANCEL) { + // put them back in selection mode after they click save + SelectObject(playerid); + } +} + +//------------------------------------------- + +public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ) +{ + new message[256+1]; + + if(type == SELECT_OBJECT_GLOBAL_OBJECT) { + if(!IsValidObject(objectid)) return 0; + format(message,sizeof(message),"(Object) You selected: %d model: %d Pos: %.4f,%.4f,%.4f", objectid, modelid, fX, fY, fZ); + SendClientMessage(playerid, 0xFFFFFFFF, message); + EditObject(playerid, objectid); + return 1; + } + + if(type == SELECT_OBJECT_PLAYER_OBJECT) { + if(!IsValidPlayerObject(playerid, objectid)) return 0; + format(message,sizeof(message),"(Player Object) You selected: %d model: %d Pos: %.4f,%.4f,%.4f", objectid, modelid, fX, fY, fZ); + SendClientMessage(playerid, 0xFFFFFFFF, message); + EditPlayerObject(playerid, objectid); + return 1; + } + + return 0; +} + +//------------------------------------------- +/* +public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) +{ + new message[256+1]; + new weaponname[64+1]; + new File:file = fopen("playershots.txt",io_append); + + GetWeaponName(weaponid, weaponname, 64); + + if(hittype == BULLET_HIT_TYPE_PLAYER) { + format(message,256,"Shooter(%d) hit Player(%d) PlayerAnim: %d Using: %s [%.2f, %.2f, %.2f]\r\n", playerid, hitid, + GetPlayerAnimationIndex(hitid), weaponname, fX, fY, fZ); + } + else if(hittype == BULLET_HIT_TYPE_VEHICLE) { + format(message,256,"Shooter(%d) hit Vehicle(%d) Using: %s [%.2f, %.2f, %.2f]\r\n",playerid, hitid, weaponname, fX, fY, fZ); + } + else if(hittype == BULLET_HIT_TYPE_NONE) { + format(message,256,"Shooter(%d) hit World Using: %s [%.2f, %.2f, %.2f]\r\n",playerid,weaponname,fX,fY,fZ); + } + else { + format(message,256,"Shooter(%d) hit Object(%d) Using: %s [%.2f, %.2f, %.2f]\r\n",playerid, hitid, weaponname, fX, fY, fZ); + } + + fwrite(file, message); + fclose(file); + + //new LastVectors[128+1]; + //new Float:OriginX, Float:OriginY, Float:OriginZ; + //new Float:HitX, Float:HitY, Float:HitZ; + //GetPlayerLastShotVectors(playerid, OriginX, OriginY, OriginZ, HitX, HitY, HitZ); + //format(LastVectors, 128, "Last Vectors: [%.2f, %.2f, %.2f] [%.2f, %.2f, %.2f]", OriginX, OriginY, OriginZ, HitX, HitY, HitZ); + //SendClientMessage(playerid, 0xFFFFFFFF, LastVectors); + + SendClientMessage(playerid, 0xFFFFFFFF, message); + return 1; +}*/ + +//------------------------------------------- +/* +new LastShotTime = 0; +new LastShotWeapon = 0; + +public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) +{ + new message[128+1]; + + if(!LastShotTime) { + LastShotTime = GetTickCount(); + return 1; + } + + if(weaponid == LastShotWeapon) { + format(message, 128, "WeaponId: %d LastShotDelta: %d", weaponid, GetTickCount() - LastShotTime); + SendClientMessage(playerid, 0xFFFFFFFF, message); + printf("%s", message); + } + + LastShotWeapon = weaponid; + LastShotTime = GetTickCount(); + + return 1; +}*/ + +//------------------------------------------- +// Example of TakeDamage +/* +public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) +{ + new File:file = fopen("playershots.txt",io_append); + new message[256+1]; + new weapname[64+1]; + + if(issuerid != INVALID_PLAYER_ID) { + GetWeaponName(weaponid, weapname, 64); + format(message, 256, "PlayerTakeDamage(%d) from Player(%d) (%f) weapon: (%s) bodypart: %d\r\n", playerid, issuerid, amount, weapname, bodypart); + SendClientMessageToAll(0xFFFFFFFF, message); + } + else { + format(message, 256, "PlayerTakeDamage(%d) (%f) from: %d\r\n", playerid, amount, weaponid); + SendClientMessageToAll(0xFFFFFFFF, message); + } + + fwrite(file, message); + fclose(file); +}*/ + +//------------------------------------------- +// Example of GiveDamage +/* +public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart) +{ + new File:file = fopen("playershots.txt",io_append); + new message[256+1]; + new weapname[64+1]; + + GetWeaponName(weaponid, weapname, 64); + format(message, 256, "PlayerGiveDamage(%d) to Player(%d) (%f) weapon: (%s) bodypart: %d\r\n", playerid, damagedid, amount, weapname, bodypart); + + fwrite(file, message); + fclose(file); + SendClientMessageToAll(0xFFFFFFFF, message); +}*/ + + +//------------------------------------------- +/* +public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart) +{ + new message[256+1]; + new weapname[64+1]; + + GetWeaponName(weaponid, weapname, 64); + format(message, 256, "PlayerGiveDamageActor(%d) to Actor(%d) (%f) weapon: (%s) bodypart: %d\r\n", playerid, damaged_actorid, amount, weapname, bodypart); + SendClientMessageToAll(0xFFFFFFFF, message); + + if(IsValidActor(damaged_actorid)) { + new Float:fActorHealth; + GetActorHealth(damaged_actorid, fActorHealth); + fActorHealth -= amount; + if(fActorHealth < 0.0) fActorHealth = 0.0; + SetActorHealth(damaged_actorid, fActorHealth); + } +} +*/ +//------------------------------------------- + +/* +public OnPlayerDeath(playerid, killerid, reason) +{ + SendDeathMessage(killerid, playerid, reason); + return 1; +}*/ + +//------------------------------------------- +/* +public OnEnterExitModShop(playerid, enterexit, interiorid) +{ + new message[256+1]; + if(enterexit) { + format(message, 256, "You entered modshop at interior %d", interiorid); + SendClientMessage(playerid, 0xFFFFFFFF, message); + } else { + format(message, 256, "You exited the modshop"); + SendClientMessage(playerid, 0xFFFFFFFF, message); + } + return 1; +} +*/ +//------------------------------------------- + +/* +public OnVehicleDamageStatusUpdate(vehicleid, playerid) +{ + new panel, doors, lights, tires; + new update_msg[128+1]; + + if(!IsPlayerAdmin(playerid)) return 0; + + GetVehicleDamageStatus(vehicleid,panel,doors,lights,tires); + format(update_msg,128,"VehicleDamage[ID:%d PN:0x%x DR:0x%x LT:0x%x TR:0x%x]",vehicleid,panel,doors,lights,tires); + SendClientMessage(playerid,0xFFFFFFFF,update_msg); + + return 1; +}*/ + +//------------------------------------------- + +/* +public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z) +{ + new update_msg[128+1]; + new Float:X, Float:Y, Float:Z; + + //if(!IsPlayerAdmin(playerid)) return 0; + + GetVehiclePos(vehicleid, X, Y, Z); + + format(update_msg,128,"NoDriverVehicleUpdate(playerid=%d vehicle=%d passenger=%d cur_pos: %.2f %.2f %.2f new_pos: %.2f %.2f %.2f)", + playerid, vehicleid, passenger_seat, X, Y, Z, new_x, new_y, new_z); + + SendClientMessageToAll(0xFFFFFFFF,update_msg); + + return 1; +}*/ + +//------------------------------------------- + diff --git a/filterscripts/vspawner.amx b/filterscripts/vspawner.amx new file mode 100644 index 0000000..12406c7 Binary files /dev/null and b/filterscripts/vspawner.amx differ diff --git a/filterscripts/vspawner.pwn b/filterscripts/vspawner.pwn new file mode 100644 index 0000000..5d278c8 --- /dev/null +++ b/filterscripts/vspawner.pwn @@ -0,0 +1,387 @@ +// +// Admin vehicle spawner using previews. For SA-MP 0.3x and above. +// - Kye 2012 +// + +#include +#include "../include/gl_common.inc" + +#define TOTAL_ITEMS 207 +#define SELECTION_ITEMS 21 +#define ITEMS_PER_LINE 7 + +#define HEADER_TEXT "Vehicles" +#define NEXT_TEXT "Next" +#define PREV_TEXT "Prev" + +#define DIALOG_BASE_X 75.0 +#define DIALOG_BASE_Y 130.0 +#define DIALOG_WIDTH 550.0 +#define DIALOG_HEIGHT 180.0 +#define SPRITE_DIM_X 60.0 +#define SPRITE_DIM_Y 70.0 + +new gTotalItems = TOTAL_ITEMS; +new PlayerText:gCurrentPageTextDrawId[MAX_PLAYERS]; +new PlayerText:gHeaderTextDrawId[MAX_PLAYERS]; +new PlayerText:gBackgroundTextDrawId[MAX_PLAYERS]; +new PlayerText:gNextButtonTextDrawId[MAX_PLAYERS]; +new PlayerText:gPrevButtonTextDrawId[MAX_PLAYERS]; +new PlayerText:gSelectionItems[MAX_PLAYERS][SELECTION_ITEMS]; +new gSelectionItemsTag[MAX_PLAYERS][SELECTION_ITEMS]; +new gItemAt[MAX_PLAYERS]; + +new gItemList[TOTAL_ITEMS] = { +400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430, +431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,450,451,452,453,454,455,456,457,458,459,460,461, +462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492, +493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523, +524,525,526,527,528,529,530,531,532,533,534,535,536,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554, +555,556,557,558,559,560,561,562,563,564,565,566,567,568,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585, +586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611 +}; + +//------------------------------------------------ + +public OnFilterScriptInit() +{ + print("\n--Admin Vehicle Spawner Loaded\n"); + return 1; +} + +//------------------------------------------------ + +GetNumberOfPages() +{ + if((gTotalItems >= SELECTION_ITEMS) && (gTotalItems % SELECTION_ITEMS) == 0) + { + return (gTotalItems / SELECTION_ITEMS); + } + else return (gTotalItems / SELECTION_ITEMS) + 1; +} + +//------------------------------------------------ + +PlayerText:CreateCurrentPageTextDraw(playerid, Float:Xpos, Float:Ypos) +{ + new PlayerText:txtInit; + txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, "0/0"); + PlayerTextDrawUseBox(playerid, txtInit, 0); + PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1); + PlayerTextDrawFont(playerid, txtInit, 1); + PlayerTextDrawSetShadow(playerid, txtInit, 0); + PlayerTextDrawSetOutline(playerid, txtInit, 1); + PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF); + PlayerTextDrawShow(playerid, txtInit); + return txtInit; +} + +//------------------------------------------------ +// Creates a button textdraw and returns the textdraw ID. + +PlayerText:CreatePlayerDialogButton(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, button_text[]) +{ + new PlayerText:txtInit; + txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, button_text); + PlayerTextDrawUseBox(playerid, txtInit, 1); + PlayerTextDrawBoxColor(playerid, txtInit, 0x000000FF); + PlayerTextDrawBackgroundColor(playerid, txtInit, 0x000000FF); + PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1); + PlayerTextDrawFont(playerid, txtInit, 1); + PlayerTextDrawSetShadow(playerid, txtInit, 0); // no shadow + PlayerTextDrawSetOutline(playerid, txtInit, 0); + PlayerTextDrawColor(playerid, txtInit, 0x4A5A6BFF); + PlayerTextDrawSetSelectable(playerid, txtInit, 1); + PlayerTextDrawAlignment(playerid, txtInit, 2); + PlayerTextDrawTextSize(playerid, txtInit, Height, Width); // The width and height are reversed for centering.. something the game does + PlayerTextDrawShow(playerid, txtInit); + return txtInit; +} + +//------------------------------------------------ + +PlayerText:CreatePlayerHeaderTextDraw(playerid, Float:Xpos, Float:Ypos, header_text[]) +{ + new PlayerText:txtInit; + txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, header_text); + PlayerTextDrawUseBox(playerid, txtInit, 0); + PlayerTextDrawLetterSize(playerid, txtInit, 1.25, 3.0); + PlayerTextDrawFont(playerid, txtInit, 0); + PlayerTextDrawSetShadow(playerid, txtInit, 0); + PlayerTextDrawSetOutline(playerid, txtInit, 1); + PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF); + PlayerTextDrawShow(playerid, txtInit); + return txtInit; +} + +//------------------------------------------------ + +PlayerText:CreatePlayerBackgroundTextDraw(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height) +{ + new PlayerText:txtBackground = CreatePlayerTextDraw(playerid, Xpos, Ypos, + " ~n~"); // enough space for everyone + PlayerTextDrawUseBox(playerid, txtBackground, 1); + PlayerTextDrawBoxColor(playerid, txtBackground, 0x00000099); + PlayerTextDrawLetterSize(playerid, txtBackground, 5.0, 5.0); + PlayerTextDrawFont(playerid, txtBackground, 0); + PlayerTextDrawSetShadow(playerid, txtBackground, 0); + PlayerTextDrawSetOutline(playerid, txtBackground, 0); + PlayerTextDrawColor(playerid, txtBackground,0x000000FF); + PlayerTextDrawTextSize(playerid, txtBackground, Width, Height); + PlayerTextDrawBackgroundColor(playerid, txtBackground, 0x00000099); + PlayerTextDrawShow(playerid, txtBackground); + return txtBackground; +} + +//------------------------------------------------ +// Creates a model preview sprite + +PlayerText:CreateModelPreviewTextDraw(playerid, modelindex, Float:Xpos, Float:Ypos, Float:width, Float:height) +{ + new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, Xpos, Ypos, ""); // it has to be set with SetText later + PlayerTextDrawFont(playerid, txtPlayerSprite, TEXT_DRAW_FONT_MODEL_PREVIEW); + PlayerTextDrawColor(playerid, txtPlayerSprite, 0xFFFFFFFF); + PlayerTextDrawBackgroundColor(playerid, txtPlayerSprite, 0x000000EE); + PlayerTextDrawTextSize(playerid, txtPlayerSprite, width, height); // Text size is the Width:Height + PlayerTextDrawSetPreviewModel(playerid, txtPlayerSprite, modelindex); + PlayerTextDrawSetPreviewRot(playerid,txtPlayerSprite, -16.0, 0.0, -55.0); + PlayerTextDrawSetSelectable(playerid, txtPlayerSprite, 1); + PlayerTextDrawShow(playerid,txtPlayerSprite); + return txtPlayerSprite; +} + +//------------------------------------------------ + +DestroyPlayerModelPreviews(playerid) +{ + new x=0; + while(x != SELECTION_ITEMS) { + if(gSelectionItems[playerid][x] != PlayerText:INVALID_TEXT_DRAW) { + PlayerTextDrawDestroy(playerid, gSelectionItems[playerid][x]); + gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW; + } + x++; + } +} + +//------------------------------------------------ + +ShowPlayerModelPreviews(playerid) +{ + new x=0; + new Float:BaseX = DIALOG_BASE_X; + new Float:BaseY = DIALOG_BASE_Y - (SPRITE_DIM_Y * 0.33); // down a bit + new linetracker = 0; + + new itemat = GetPVarInt(playerid, "vspawner_page") * SELECTION_ITEMS; + + // Destroy any previous ones created + DestroyPlayerModelPreviews(playerid); + + while(x != SELECTION_ITEMS && itemat < gTotalItems) { + if(linetracker == 0) { + BaseX = DIALOG_BASE_X + 25.0; // in a bit from the box + BaseY += SPRITE_DIM_Y + 1.0; // move on the Y for the next line + } + gSelectionItems[playerid][x] = CreateModelPreviewTextDraw(playerid, gItemList[itemat], BaseX, BaseY, SPRITE_DIM_X, SPRITE_DIM_Y); + gSelectionItemsTag[playerid][x] = gItemList[itemat]; + BaseX += SPRITE_DIM_X + 1.0; // move on the X for the next sprite + linetracker++; + if(linetracker == ITEMS_PER_LINE) linetracker = 0; + itemat++; + x++; + } +} + +//------------------------------------------------ + +UpdatePageTextDraw(playerid) +{ + new PageText[64+1]; + format(PageText, 64, "%d/%d", GetPVarInt(playerid,"vspawner_page") + 1, GetNumberOfPages()); + PlayerTextDrawSetString(playerid, gCurrentPageTextDrawId[playerid], PageText); +} + +//------------------------------------------------ + +CreateSelectionMenu(playerid) +{ + gBackgroundTextDrawId[playerid] = CreatePlayerBackgroundTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y + 20.0, DIALOG_WIDTH, DIALOG_HEIGHT); + gHeaderTextDrawId[playerid] = CreatePlayerHeaderTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y, HEADER_TEXT); + gCurrentPageTextDrawId[playerid] = CreateCurrentPageTextDraw(playerid, DIALOG_WIDTH - 30.0, DIALOG_BASE_Y + 15.0); + gNextButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 30.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, NEXT_TEXT); + gPrevButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 90.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, PREV_TEXT); + + ShowPlayerModelPreviews(playerid); + UpdatePageTextDraw(playerid); +} + +//------------------------------------------------ + +DestroySelectionMenu(playerid) +{ + DestroyPlayerModelPreviews(playerid); + + PlayerTextDrawDestroy(playerid, gHeaderTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gBackgroundTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gCurrentPageTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gNextButtonTextDrawId[playerid]); + PlayerTextDrawDestroy(playerid, gPrevButtonTextDrawId[playerid]); + + gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; +} + +//------------------------------------------------ + +SpawnVehicle_InfrontOfPlayer(playerid, vehiclemodel, color1, color2) +{ + new Float:x,Float:y,Float:z; + new Float:facing; + new Float:distance; + + GetPlayerPos(playerid, x, y, z); + GetPlayerFacingAngle(playerid, facing); + + new Float:size_x,Float:size_y,Float:size_z; + GetVehicleModelInfo(vehiclemodel, VEHICLE_MODEL_INFO_SIZE, size_x, size_y, size_z); + + distance = size_x + 0.5; + + x += (distance * floatsin(-facing, degrees)); + y += (distance * floatcos(-facing, degrees)); + + facing += 90.0; + if(facing > 360.0) facing -= 360.0; + + return CreateVehicle(vehiclemodel, x, y, z + (size_z * 0.25), facing, color1, color2, -1); +} + +//------------------------------------------------ + +HandlePlayerItemSelection(playerid, selecteditem) +{ + // In this case we're spawning a vehicle for them + SpawnVehicle_InfrontOfPlayer(playerid, gSelectionItemsTag[playerid][selecteditem], -1, -1); +} + +//------------------------------------------------ + +public OnPlayerConnect(playerid) +{ + // Init all of the textdraw related globals + gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; + + for(new x=0; x < SELECTION_ITEMS; x++) { + gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW; + } + + gItemAt[playerid] = 0; + + return 1; // Allow other scripts to keep processing OnPlayerConnect +} + +//------------------------------------------- +// Even though only Player* textdraws are used in this script, +// OnPlayerClickTextDraw is still required to handle ESC + +public OnPlayerClickTextDraw(playerid, Text:clickedid) +{ + if(GetPVarInt(playerid, "vspawner_active") == 0) return 0; + + // Handle: They cancelled (with ESC) + if(clickedid == Text:INVALID_TEXT_DRAW) { + DestroySelectionMenu(playerid); + SetPVarInt(playerid, "vspawner_active", 0); + PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); + return 1; + } + + return 0; +} + +//------------------------------------------------ + +public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) +{ + if(GetPVarInt(playerid, "vspawner_active") == 0) return 0; + + new curpage = GetPVarInt(playerid, "vspawner_page"); + + // Handle: next button + if(playertextid == gNextButtonTextDrawId[playerid]) { + if(curpage < (GetNumberOfPages() - 1)) { + SetPVarInt(playerid, "vspawner_page", curpage + 1); + ShowPlayerModelPreviews(playerid); + UpdatePageTextDraw(playerid); + PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); + } else { + PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); + } + return 1; + } + + // Handle: previous button + if(playertextid == gPrevButtonTextDrawId[playerid]) { + if(curpage > 0) { + SetPVarInt(playerid, "vspawner_page", curpage - 1); + ShowPlayerModelPreviews(playerid); + UpdatePageTextDraw(playerid); + PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); + } else { + PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); + } + return 1; + } + + // Search in the array of textdraws used for the items + new x=0; + while(x != SELECTION_ITEMS) { + if(playertextid == gSelectionItems[playerid][x]) { + HandlePlayerItemSelection(playerid, x); + PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); + DestroySelectionMenu(playerid); + CancelSelectTextDraw(playerid); + SetPVarInt(playerid, "vspawner_active", 0); + return 1; + } + x++; + } + + return 0; +} + +//------------------------------------------------ + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new cmd[256+1]; + new idx; + + if(!IsPlayerAdmin(playerid)) return 0; + + cmd = strtok(cmdtext, idx); + + if(strcmp("/vspawner", cmd, true) == 0) + { + // If there was a previously created selection menu, destroy it + DestroySelectionMenu(playerid); + + SetPVarInt(playerid, "vspawner_active", 1); + //SetPVarInt(playerid, "vspawner_page", 0); // will reset the page back to the first + + CreateSelectionMenu(playerid); + SelectTextDraw(playerid, 0xACCBF1FF); + return 1; + } + + return 0; +} +//------------------------------------------------ diff --git a/gamemodes/bare.amx b/gamemodes/bare.amx new file mode 100644 index 0000000..298c7e8 Binary files /dev/null and b/gamemodes/bare.amx differ diff --git a/gamemodes/bare.pwn b/gamemodes/bare.pwn new file mode 100644 index 0000000..dc449ae --- /dev/null +++ b/gamemodes/bare.pwn @@ -0,0 +1,90 @@ +#include +#include +#include + +#pragma tabsize 0 + +main() +{ + print("\n----------------------------------"); + print(" Bare Script\n"); + print("----------------------------------\n"); +} + +public OnPlayerConnect(playerid) +{ + GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5); + return 1; +} + +public OnPlayerCommandText(playerid, cmdtext[]) +{ + new idx; + new cmd[256]; + + cmd = strtok(cmdtext, idx); + + if(strcmp(cmd, "/yadayada", true) == 0) { + return 1; + } + + return 0; +} + +public OnPlayerSpawn(playerid) +{ + SetPlayerInterior(playerid,0); + TogglePlayerClock(playerid,0); + return 1; +} + +public OnPlayerDeath(playerid, killerid, reason) +{ + return 1; +} + +SetupPlayerForClassSelection(playerid) +{ + SetPlayerInterior(playerid,14); + SetPlayerPos(playerid,258.4893,-41.4008,1002.0234); + SetPlayerFacingAngle(playerid, 270.0); + SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234); + SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234); +} + +public OnPlayerRequestClass(playerid, classid) +{ + SetupPlayerForClassSelection(playerid); + return 1; +} + +public OnGameModeInit() +{ + SetGameModeText("Bare Script"); + ShowPlayerMarkers(1); + ShowNameTags(1); + AllowAdminTeleport(1); + + AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1); + + return 1; +} + +strtok(const string[], &index) +{ + new length = strlen(string); + while ((index < length) && (string[index] <= ' ')) + { + index++; + } + + new offset = index; + new result[20]; + while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) + { + result[index - offset] = string[index]; + index++; + } + result[index - offset] = EOS; + return result; +} diff --git a/gamemodes/barron.amx b/gamemodes/barron.amx new file mode 100644 index 0000000..b7cfe2a Binary files /dev/null and b/gamemodes/barron.amx differ diff --git a/gamemodes/barron.pwn b/gamemodes/barron.pwn new file mode 100644 index 0000000..d66f5fe --- /dev/null +++ b/gamemodes/barron.pwn @@ -0,0 +1,264 @@ +// +// RC BARNSTORM - A demonstration vehicle vs vehicle script for SA-MP 0.2 +// -- by kyeman (SA-MP team) 2007 +// +// This script demonstrates the following :- +// - An automatic vehicle observer mode switchable via a key press. +// - Text drawing and the use of GTA ~k~ key constants. +// - Use of RC vehicles +// - Dynamic creation and destruction of vehicles +// - The OnPlayerKeyStateChange event/callback and determining +// if a key has just been pressed. +// - Bypassing SA-MP's class selection with SetSpawnInfo + +#include +#include +#include + +new gPlayerVehicles[MAX_PLAYERS]; // the vehicleid for the active playerid +new gPlayerObserving[MAX_PLAYERS]; // player observing which active player +new Text:txtObsHelper; + +new Float:gSpawnPositions[26][4] = { // positions where players in vehicles spawn +{-205.7703,-119.6655,2.4094,342.0546}, +{-202.1386,-54.1213,2.4111,95.6799}, +{-197.2334,7.5293,2.4034,16.0852}, +{-135.7348,61.7265,2.4112,354.3534}, +{-73.7883,73.4238,2.4082,260.5399}, +{-6.9850,27.9988,2.4112,201.7691}, +{0.6782,-16.0898,2.4076,161.7720}, +{-46.3365,-88.3937,2.4092,180.7382}, +{-72.4389,-127.2939,2.4107,113.5616}, +{-128.1940,-144.1725,2.4094,78.9676}, +{-266.0189,-50.6718,2.4125,223.8079}, +{-244.2617,-1.0468,2.1038,257.3333}, +{-93.3146,-32.4889,2.4085,186.0631}, +{-130.7054,-93.4983,2.4124,73.8375}, +{-117.4049,4.2989,2.4112,337.1284}, +{-26.1622,135.8739,2.4094,248.1580}, +{45.5705,86.7586,2.0753,147.3342}, +{54.9881,2.2997,1.1132,95.7173}, +{-248.9905,-119.3982,2.4083,303.7859}, +{-60.1321,55.5239,2.4038,325.2209}, +{-60.9184,47.9302,5.7706,342.8299}, +{-70.0303,-22.0071,2.4113,165.2789}, +{-138.3093,-83.2640,2.4152,4.0455}, +{-25.5989,94.6100,2.4041,150.8322}, +{-161.0327,-70.5945,2.4042,142.9221}, +{-54.8308,-139.6148,2.4119,258.7639} +}; + +//------------------------------------------------------------------------------------------------------ + +main() +{ + print("Running: RC BARNSTORM by kyeman 2007"); +} + +//------------------------------------------------ +// ObserverSwitchToNextVehicle +// Will increment the current observed player +// until it finds a new player with an active vehicle. + +ObserverSwitchToNextVehicle(playerid) +{ + new x=0; + while(x!=MAX_PLAYERS) { // MAX_PLAYERS iterations + gPlayerObserving[playerid]++; + if(gPlayerObserving[playerid] == MAX_PLAYERS) { + // we need to cycle back to the start + gPlayerObserving[playerid] = 0; + } + // see if the target player has a vehicle, + // if so assign this player to observe it + if(gPlayerVehicles[gPlayerObserving[playerid]] != 0) { + PlayerSpectateVehicle(playerid,gPlayerVehicles[gPlayerObserving[playerid]]); + return; + } + x++; + } + // didn't find any vehicles to observe. we'll have to default to last + PlayerSpectateVehicle(playerid,gPlayerVehicles[gPlayerObserving[playerid]]); +} + +//------------------------------------------------ +// IsKeyJustDown. Returns 1 if the key +// has just been pressed, 0 otherwise. + +IsKeyJustDown(key, newkeys, oldkeys) +{ + if((newkeys & key) && !(oldkeys & key)) return 1; + return 0; +} + +//------------------------------------------------ + +public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) +{ + if(gPlayerObserving[playerid] >= 0 && IsKeyJustDown(KEY_SPRINT,newkeys,oldkeys)) { + // They're requesting to spawn, so take them out of observer mode + // this will cause them to spawn automatically, using the SpawnInfo + // we previously forced upon them during OnPlayerRequestClass + TogglePlayerSpectating(playerid,0); + gPlayerObserving[playerid] = (-1); + SendClientMessage(playerid,0xFFFFFFFF,"Leaving spectate"); + return; + } + + if(gPlayerObserving[playerid] >= 0 && IsKeyJustDown(KEY_FIRE,newkeys,oldkeys)) { + // They're requesting to change observer to another vehicle. + ObserverSwitchToNextVehicle(playerid); + } +} + +//------------------------------------------------ + +public OnPlayerConnect(playerid) +{ + GameTextForPlayer(playerid,"~w~SA-MP: ~r~RC Barnstorm",5000,5); + + return 1; +} + +//------------------------------------------------ + +public OnPlayerDisconnect(playerid) +{ + if(gPlayerVehicles[playerid]) { + // Make sure their vehicle is destroyed when they leave. + DestroyVehicle(gPlayerVehicles[playerid]); + gPlayerVehicles[playerid] = 0; + } + return 0; +} + +//------------------------------------------------ +//rcbarron = 464 + +public OnPlayerSpawn(playerid) +{ + // Create their own vehicle and put them in + gPlayerVehicles[playerid] = CreateVehicle(464, + gSpawnPositions[playerid][0], + gSpawnPositions[playerid][1], + gSpawnPositions[playerid][2], + gSpawnPositions[playerid][3], + -1,-1,10); + + PutPlayerInVehicle(playerid,gPlayerVehicles[playerid],0); + //ForceClassSelection(playerid); // for next time they respawn + TextDrawHideForPlayer(playerid, txtObsHelper); + SetPlayerWorldBounds(playerid,200.0,-300.0,200.0,-200.0); + return 1; +} + +//------------------------------------------------ + +public OnPlayerDeath(playerid, killerid, reason) +{ + // We need to cleanup their vehicle + RemovePlayerFromVehicle(gPlayerVehicles[playerid]); + DestroyVehicle(gPlayerVehicles[playerid]); + gPlayerVehicles[playerid] = 0; + + // Send the death information to all clients + SendDeathMessage(killerid,playerid,reason); + + // If anyone was observing them, they'll have to switch to the next + new x=0; + while(x!=MAX_PLAYERS) { + if(x != playerid && gPlayerObserving[x] == playerid) { + ObserverSwitchToNextVehicle(x); + } + x++; + } + + return 1; +} + +//------------------------------------------------ + +public OnPlayerRequestClass(playerid, classid) +{ + // put them straight into observer mode, effectively + // bypassing class selection. + TogglePlayerSpectating(playerid,1); + ObserverSwitchToNextVehicle(playerid); + TextDrawShowForPlayer(playerid, txtObsHelper); + + // also force this dud spawn info upon them so that they + // have spawn information set. + SetSpawnInfo(playerid,0,0, + gSpawnPositions[playerid][0], + gSpawnPositions[playerid][1], + gSpawnPositions[playerid][2], + gSpawnPositions[playerid][3], + -1,-1,-1,-1,-1,-1); + + return 0; +} + +//------------------------------------------------ + +public OnGameModeInit() +{ + SetGameModeText("RC Barnstorm"); + + // General settings for the gamemode + ShowPlayerMarkers(0); + ShowNameTags(1); + SetWorldTime(7); + SetWeather(5); + + // Add a dud player class + AddPlayerClass(0,0.0,0.0,4.0,0.0,-1,-1,-1,-1,-1,-1); + + // Init our globals + new x=0; + while(x!=MAX_PLAYERS) { + gPlayerVehicles[x] = 0; + gPlayerObserving[x] = (-1); + x++; + } + + // Init our observer helper text display + txtObsHelper = TextDrawCreate(20.0, 400.0, + "Press ~b~~k~~PED_SPRINT~ ~w~to spawn~n~Press ~b~~k~~PED_FIREWEAPON~ ~w~to switch players"); + TextDrawUseBox(txtObsHelper, 0); + TextDrawFont(txtObsHelper, 2); + TextDrawSetShadow(txtObsHelper,0); + TextDrawSetOutline(txtObsHelper,1); + TextDrawBackgroundColor(txtObsHelper,0x000000FF); + TextDrawColor(txtObsHelper,0xFFFFFFFF); + + return 1; +} + +//------------------------------------------------ + +public OnPlayerUpdate(playerid) +{ + /* + new Keys,ud,lr; + + if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) { + GetPlayerKeys(playerid,Keys,ud,lr); + if(ud > 0) { + SendClientMessage(playerid, 0xFFFFFFFF, "DOWN"); + } + else if(ud < 0) { + SendClientMessage(playerid, 0xFFFFFFFF, "UP"); + } + + if(lr > 0) { + SendClientMessage(playerid, 0xFFFFFFFF, "RIGHT"); + } + else if(lr < 0) { + SendClientMessage(playerid, 0xFFFFFFFF, "LEFT"); + } + }*/ + + return 1; +} + +//------------------------------------------------ diff --git a/gamemodes/grandlarc.amx b/gamemodes/grandlarc.amx new file mode 100644 index 0000000..ec0f213 Binary files /dev/null and b/gamemodes/grandlarc.amx differ diff --git a/gamemodes/grandlarc.pwn b/gamemodes/grandlarc.pwn new file mode 100644 index 0000000..44c8d45 --- /dev/null +++ b/gamemodes/grandlarc.pwn @@ -0,0 +1,529 @@ +//---------------------------------------------------------- +// +// GRAND LARCENY 1.0 +// A freeroam gamemode for SA-MP 0.3 +// +//---------------------------------------------------------- + +#include +#include +#include +#include "../include/gl_common.inc" +#include "../include/gl_spawns.inc" + +#pragma tabsize 0 + +//---------------------------------------------------------- + +#define COLOR_WHITE 0xFFFFFFFF +#define COLOR_NORMAL_PLAYER 0xFFBB7777 + +#define CITY_LOS_SANTOS 0 +#define CITY_SAN_FIERRO 1 +#define CITY_LAS_VENTURAS 2 + +new total_vehicles_from_files=0; + +// Class selection globals +new gPlayerCitySelection[MAX_PLAYERS]; +new gPlayerHasCitySelected[MAX_PLAYERS]; +new gPlayerLastCitySelectionTick[MAX_PLAYERS]; + +new Text:txtClassSelHelper; +new Text:txtLosSantos; +new Text:txtSanFierro; +new Text:txtLasVenturas; + +//new thisanimid=0; +//new lastanimid=0; + +//---------------------------------------------------------- + +main() +{ + print("\n---------------------------------------"); + print("Running Grand Larceny - by the SA-MP team\n"); + print("---------------------------------------\n"); +} + +//---------------------------------------------------------- + +public OnPlayerConnect(playerid) +{ + GameTextForPlayer(playerid,"~w~Grand Larceny",3000,4); + SendClientMessage(playerid,COLOR_WHITE,"Welcome to {88AA88}G{FFFFFF}rand {88AA88}L{FFFFFF}arceny"); + + // class selection init vars + gPlayerCitySelection[playerid] = -1; + gPlayerHasCitySelected[playerid] = 0; + gPlayerLastCitySelectionTick[playerid] = GetTickCount(); + + //SetPlayerColor(playerid,COLOR_NORMAL_PLAYER); + + /* + Removes vending machines + RemoveBuildingForPlayer(playerid, 1302, 0.0, 0.0, 0.0, 6000.0); + RemoveBuildingForPlayer(playerid, 1209, 0.0, 0.0, 0.0, 6000.0); + RemoveBuildingForPlayer(playerid, 955, 0.0, 0.0, 0.0, 6000.0); + RemoveBuildingForPlayer(playerid, 1775, 0.0, 0.0, 0.0, 6000.0); + RemoveBuildingForPlayer(playerid, 1776, 0.0, 0.0, 0.0, 6000.0); + */ + + /* + new ClientVersion[32]; + GetPlayerVersion(playerid, ClientVersion, 32); + printf("Player %d reports client version: %s", playerid, ClientVersion);*/ + + return 1; +} + +//---------------------------------------------------------- + +public OnPlayerSpawn(playerid) +{ + if(IsPlayerNPC(playerid)) return 1; + + new randSpawn = 0; + + SetPlayerInterior(playerid,0); + TogglePlayerClock(playerid,0); + ResetPlayerMoney(playerid); + GivePlayerMoney(playerid, 30000); + + if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid]) { + randSpawn = random(sizeof(gRandomSpawns_LosSantos)); + SetPlayerPos(playerid, + gRandomSpawns_LosSantos[randSpawn][0], + gRandomSpawns_LosSantos[randSpawn][1], + gRandomSpawns_LosSantos[randSpawn][2]); + SetPlayerFacingAngle(playerid,gRandomSpawns_LosSantos[randSpawn][3]); + } + else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid]) { + randSpawn = random(sizeof(gRandomSpawns_SanFierro)); + SetPlayerPos(playerid, + gRandomSpawns_SanFierro[randSpawn][0], + gRandomSpawns_SanFierro[randSpawn][1], + gRandomSpawns_SanFierro[randSpawn][2]); + SetPlayerFacingAngle(playerid,gRandomSpawns_SanFierro[randSpawn][3]); + } + else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid]) { + randSpawn = random(sizeof(gRandomSpawns_LasVenturas)); + SetPlayerPos(playerid, + gRandomSpawns_LasVenturas[randSpawn][0], + gRandomSpawns_LasVenturas[randSpawn][1], + gRandomSpawns_LasVenturas[randSpawn][2]); + SetPlayerFacingAngle(playerid,gRandomSpawns_LasVenturas[randSpawn][3]); + } + + //SetPlayerColor(playerid,COLOR_NORMAL_PLAYER); + + /* + SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL_SILENCED,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_DESERT_EAGLE,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_SHOTGUN,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_SAWNOFF_SHOTGUN,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_SPAS12_SHOTGUN,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_MP5,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_AK47,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_M4,200); + SetPlayerSkillLevel(playerid,WEAPONSKILL_SNIPERRIFLE,200);*/ + + GivePlayerWeapon(playerid,WEAPON_COLT45,100); + //GivePlayerWeapon(playerid,WEAPON_MP5,100); + TogglePlayerClock(playerid, 0); + + return 1; +} + +//---------------------------------------------------------- + +public OnPlayerDeath(playerid, killerid, reason) +{ + new playercash; + + // if they ever return to class selection make them city + // select again first + gPlayerHasCitySelected[playerid] = 0; + + if(killerid == INVALID_PLAYER_ID) { + ResetPlayerMoney(playerid); + } else { + playercash = GetPlayerMoney(playerid); + if(playercash > 0) { + GivePlayerMoney(killerid, playercash); + ResetPlayerMoney(playerid); + } + } + return 1; +} + +//---------------------------------------------------------- + +ClassSel_SetupCharSelection(playerid) +{ + if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) { + SetPlayerInterior(playerid,11); + SetPlayerPos(playerid,508.7362,-87.4335,998.9609); + SetPlayerFacingAngle(playerid,0.0); + SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609); + SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609); + } + else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) { + SetPlayerInterior(playerid,3); + SetPlayerPos(playerid,-2673.8381,1399.7424,918.3516); + SetPlayerFacingAngle(playerid,181.0); + SetPlayerCameraPos(playerid,-2673.2776,1394.3859,918.3516); + SetPlayerCameraLookAt(playerid,-2673.8381,1399.7424,918.3516); + } + else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) { + SetPlayerInterior(playerid,3); + SetPlayerPos(playerid,349.0453,193.2271,1014.1797); + SetPlayerFacingAngle(playerid,286.25); + SetPlayerCameraPos(playerid,352.9164,194.5702,1014.1875); + SetPlayerCameraLookAt(playerid,349.0453,193.2271,1014.1797); + } + +} + +//---------------------------------------------------------- +// Used to init textdraws of city names + +ClassSel_InitCityNameText(Text:txtInit) +{ + TextDrawUseBox(txtInit, 0); + TextDrawLetterSize(txtInit,1.25,3.0); + TextDrawFont(txtInit, 0); + TextDrawSetShadow(txtInit,0); + TextDrawSetOutline(txtInit,1); + TextDrawColor(txtInit,0xEEEEEEFF); + TextDrawBackgroundColor(txtClassSelHelper,0x000000FF); +} + +//---------------------------------------------------------- + +ClassSel_InitTextDraws() +{ + // Init our observer helper text display + txtLosSantos = TextDrawCreate(10.0, 380.0, "Los Santos"); + ClassSel_InitCityNameText(txtLosSantos); + txtSanFierro = TextDrawCreate(10.0, 380.0, "San Fierro"); + ClassSel_InitCityNameText(txtSanFierro); + txtLasVenturas = TextDrawCreate(10.0, 380.0, "Las Venturas"); + ClassSel_InitCityNameText(txtLasVenturas); + + // Init our observer helper text display + txtClassSelHelper = TextDrawCreate(10.0, 415.0, + " Press ~b~~k~~GO_LEFT~ ~w~or ~b~~k~~GO_RIGHT~ ~w~to switch cities.~n~ Press ~r~~k~~PED_FIREWEAPON~ ~w~to select."); + TextDrawUseBox(txtClassSelHelper, 1); + TextDrawBoxColor(txtClassSelHelper,0x222222BB); + TextDrawLetterSize(txtClassSelHelper,0.3,1.0); + TextDrawTextSize(txtClassSelHelper,400.0,40.0); + TextDrawFont(txtClassSelHelper, 2); + TextDrawSetShadow(txtClassSelHelper,0); + TextDrawSetOutline(txtClassSelHelper,1); + TextDrawBackgroundColor(txtClassSelHelper,0x000000FF); + TextDrawColor(txtClassSelHelper,0xFFFFFFFF); +} + +//---------------------------------------------------------- + +ClassSel_SetupSelectedCity(playerid) +{ + if(gPlayerCitySelection[playerid] == -1) { + gPlayerCitySelection[playerid] = CITY_LOS_SANTOS; + } + + if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) { + SetPlayerInterior(playerid,0); + SetPlayerCameraPos(playerid,1630.6136,-2286.0298,110.0); + SetPlayerCameraLookAt(playerid,1887.6034,-1682.1442,47.6167); + + TextDrawShowForPlayer(playerid,txtLosSantos); + TextDrawHideForPlayer(playerid,txtSanFierro); + TextDrawHideForPlayer(playerid,txtLasVenturas); + } + else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) { + SetPlayerInterior(playerid,0); + SetPlayerCameraPos(playerid,-1300.8754,68.0546,129.4823); + SetPlayerCameraLookAt(playerid,-1817.9412,769.3878,132.6589); + + TextDrawHideForPlayer(playerid,txtLosSantos); + TextDrawShowForPlayer(playerid,txtSanFierro); + TextDrawHideForPlayer(playerid,txtLasVenturas); + } + else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) { + SetPlayerInterior(playerid,0); + SetPlayerCameraPos(playerid,1310.6155,1675.9182,110.7390); + SetPlayerCameraLookAt(playerid,2285.2944,1919.3756,68.2275); + + TextDrawHideForPlayer(playerid,txtLosSantos); + TextDrawHideForPlayer(playerid,txtSanFierro); + TextDrawShowForPlayer(playerid,txtLasVenturas); + } +} + +//---------------------------------------------------------- + +ClassSel_SwitchToNextCity(playerid) +{ + gPlayerCitySelection[playerid]++; + if(gPlayerCitySelection[playerid] > CITY_LAS_VENTURAS) { + gPlayerCitySelection[playerid] = CITY_LOS_SANTOS; + } + PlayerPlaySound(playerid,1052,0.0,0.0,0.0); + gPlayerLastCitySelectionTick[playerid] = GetTickCount(); + ClassSel_SetupSelectedCity(playerid); +} + +//---------------------------------------------------------- + +ClassSel_SwitchToPreviousCity(playerid) +{ + gPlayerCitySelection[playerid]--; + if(gPlayerCitySelection[playerid] < CITY_LOS_SANTOS) { + gPlayerCitySelection[playerid] = CITY_LAS_VENTURAS; + } + PlayerPlaySound(playerid,1053,0.0,0.0,0.0); + gPlayerLastCitySelectionTick[playerid] = GetTickCount(); + ClassSel_SetupSelectedCity(playerid); +} + +//---------------------------------------------------------- + +ClassSel_HandleCitySelection(playerid) +{ + new Keys,ud,lr; + GetPlayerKeys(playerid,Keys,ud,lr); + + if(gPlayerCitySelection[playerid] == -1) { + ClassSel_SwitchToNextCity(playerid); + return; + } + + // only allow new selection every ~500 ms + if( (GetTickCount() - gPlayerLastCitySelectionTick[playerid]) < 500 ) return; + + if(Keys & KEY_FIRE) { + gPlayerHasCitySelected[playerid] = 1; + TextDrawHideForPlayer(playerid,txtClassSelHelper); + TextDrawHideForPlayer(playerid,txtLosSantos); + TextDrawHideForPlayer(playerid,txtSanFierro); + TextDrawHideForPlayer(playerid,txtLasVenturas); + TogglePlayerSpectating(playerid,0); + return; + } + + if(lr > 0) { + ClassSel_SwitchToNextCity(playerid); + } + else if(lr < 0) { + ClassSel_SwitchToPreviousCity(playerid); + } +} + +//---------------------------------------------------------- + +public OnPlayerRequestClass(playerid, classid) +{ + if(IsPlayerNPC(playerid)) return 1; + + if(gPlayerHasCitySelected[playerid]) { + ClassSel_SetupCharSelection(playerid); + return 1; + } else { + if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING) { + TogglePlayerSpectating(playerid,1); + TextDrawShowForPlayer(playerid, txtClassSelHelper); + gPlayerCitySelection[playerid] = -1; + } + } + + return 0; +} + +//---------------------------------------------------------- + +public OnGameModeInit() +{ + SetGameModeText("Grand Larceny"); + ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL); + ShowNameTags(1); + SetNameTagDrawDistance(40.0); + EnableStuntBonusForAll(0); + DisableInteriorEnterExits(); + SetWeather(2); + SetWorldTime(11); + + //SetObjectsDefaultCameraCol(true); + //UsePlayerPedAnims(); + //ManualVehicleEngineAndLights(); + //LimitGlobalChatRadius(300.0); + + ClassSel_InitTextDraws(); + + // Player Class + AddPlayerClass(298,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(299,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(300,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(301,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(302,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(303,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(304,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(305,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(280,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(281,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(282,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(283,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(284,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(285,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(286,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(287,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(288,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(289,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(265,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(266,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(267,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(268,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(269,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(270,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(1,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(2,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(3,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(4,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(5,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(6,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(8,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(42,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(65,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + //AddPlayerClass(74,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(86,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(119,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(149,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(208,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(273,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(289,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + + AddPlayerClass(47,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(48,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(49,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(50,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(51,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(52,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(53,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(54,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(55,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(56,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(57,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(58,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(68,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(69,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(70,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(71,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(72,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(73,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(75,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(76,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(78,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(79,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(80,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(81,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(82,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(83,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(84,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(85,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(87,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(88,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(89,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(91,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(92,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(93,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(95,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(96,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(97,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(98,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + AddPlayerClass(99,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); + + // SPECIAL + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/trains.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/pilots.txt"); + + // LAS VENTURAS + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_law.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_airport.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_gen.txt"); + + // SAN FIERRO + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_law.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_airport.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_gen.txt"); + + // LOS SANTOS + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_airport.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_inner.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_outer.txt"); + + // OTHER AREAS + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/whetstone.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/bone.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/flint.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/tierra.txt"); + total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/red_county.txt"); + + printf("Total vehicles from files: %d",total_vehicles_from_files); + + return 1; +} + +//---------------------------------------------------------- + +public OnPlayerUpdate(playerid) +{ + if(!IsPlayerConnected(playerid)) return 0; + if(IsPlayerNPC(playerid)) return 1; + + // changing cities by inputs + if( !gPlayerHasCitySelected[playerid] && + GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ) { + ClassSel_HandleCitySelection(playerid); + return 1; + } + + // No weapons in interiors + //if(GetPlayerInterior(playerid) != 0 && GetPlayerWeapon(playerid) != 0) { + //SetPlayerArmedWeapon(playerid,0); // fists + //return 0; // no syncing until they change their weapon + //} + + // Don't allow minigun + if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN) { + Kick(playerid); + return 0; + } + + /* No jetpacks allowed + if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) { + Kick(playerid); + return 0; + }*/ + + /* For testing animations + new msg[128+1]; + new animlib[32+1]; + new animname[32+1]; + + thisanimid = GetPlayerAnimationIndex(playerid); + if(lastanimid != thisanimid) + { + GetAnimationName(thisanimid,animlib,32,animname,32); + format(msg, 128, "anim(%d,%d): %s %s", lastanimid, thisanimid, animlib, animname); + lastanimid = thisanimid; + SendClientMessage(playerid, 0xFFFFFFFF, msg); + }*/ + + return 1; +} + +//---------------------------------------------------------- diff --git a/gamemodes/rivershell.amx b/gamemodes/rivershell.amx new file mode 100644 index 0000000..41b9c55 Binary files /dev/null and b/gamemodes/rivershell.amx differ diff --git a/gamemodes/rivershell.pwn b/gamemodes/rivershell.pwn new file mode 100644 index 0000000..aac4f03 --- /dev/null +++ b/gamemodes/rivershell.pwn @@ -0,0 +1,630 @@ +//--------------------------------------------------------- +// +// Rivershell v2 by Kye - 2006-2013 +// +//--------------------------------------------------------- + +#include +#include +#include + +// Global stuff and defines for our gamemode. + +static gTeam[MAX_PLAYERS]; // Tracks the team assignment for each player + +#define OBJECTIVE_VEHICLE_GREEN 2 +#define OBJECTIVE_VEHICLE_BLUE 1 +#define TEAM_GREEN 1 +#define TEAM_BLUE 2 +#define OBJECTIVE_COLOR 0xE2C063FF +#define TEAM_GREEN_COLOR 0x77CC77FF +#define TEAM_BLUE_COLOR 0x7777DDFF +#define CAPS_TO_WIN 5 +#define ALLOW_RESPAWN_AFTER_N_SECONDS 20 + +#define SPECTATE_STATE_NONE 0 +#define SPECTATE_STATE_PLAYER 1 +#define SPECTATE_STATE_FIXED 2 + +#define SPECTATE_MODE_NONE 0 +#define SPECTATE_MODE_PLAYER 1 +#define SPECTATE_MODE_VEHICLE 2 + +new gObjectiveReached = 0; // Stops the winner logic reentering itself. +new gObjectiveGreenPlayer=(-1); // Tracks which green player has the vehicle. +new gObjectiveBluePlayer=(-1); // Tracks which blue player has the vehicle. + +// number of times the vehicle has been captured by each team +new gGreenTimesCapped=0; +new gBlueTimesCapped=0; + +// forward declarations for the PAWN compiler (not really needed, but there for the sake of clarity) +forward SetPlayerToTeamColor(playerid); +forward SetupPlayerForClassSelection(playerid); +forward SetPlayerTeamFromClass(playerid,classid); +forward ExitTheGameMode(); + +//--------------------------------------------------------- + +main() +{ + print("\n----------------------------------"); + print(" Rivershell by Kye 2006-2013\n"); + print("----------------------------------\n"); +} +//--------------------------------------------------------- + +public SetPlayerToTeamColor(playerid) +{ + if(gTeam[playerid] == TEAM_GREEN) { + SetPlayerColor(playerid, TEAM_GREEN_COLOR); // green + } else if(gTeam[playerid] == TEAM_BLUE) { + SetPlayerColor(playerid, TEAM_BLUE_COLOR); // blue + } +} +//--------------------------------------------------------- + +public SetupPlayerForClassSelection(playerid) +{ + // Set the player's orientation when they're selecting a class. + SetPlayerPos(playerid,1984.4445,157.9501,55.9384); + SetPlayerCameraPos(playerid,1984.4445,160.9501,55.9384); + SetPlayerCameraLookAt(playerid,1984.4445,157.9501,55.9384); + SetPlayerFacingAngle(playerid,0.0); +} + +//--------------------------------------------------------- + +public SetPlayerTeamFromClass(playerid,classid) +{ + // Set their team number based on the class they selected. + if(classid == 0 || classid == 1) { + SetPlayerTeam(playerid, TEAM_GREEN); + gTeam[playerid] = TEAM_GREEN; + } + else if(classid == 2 || classid == 3) { + SetPlayerTeam(playerid, TEAM_BLUE); + gTeam[playerid] = TEAM_BLUE; + } +} + +//--------------------------------------------------------- + +public ExitTheGameMode() +{ + PlaySoundForAll(1186, 0.0, 0.0, 0.0); // Stops the music + //printf("Exiting Game Mode"); + GameModeExit(); +} + +//--------------------------------------------------------- + +public OnPlayerStateChange(playerid, newstate, oldstate) +{ + new vehicleid; + + if(newstate == PLAYER_STATE_DRIVER) + { + vehicleid = GetPlayerVehicleID(playerid); + + if(gTeam[playerid] == TEAM_GREEN && vehicleid == OBJECTIVE_VEHICLE_GREEN) + { // It's the objective vehicle + SetPlayerColor(playerid,OBJECTIVE_COLOR); + GameTextForPlayer(playerid,"~w~Take the ~y~boat ~w~back to the ~r~spawn!",3000,5); + SetPlayerCheckpoint(playerid, 2135.7368, -179.8811, -0.5323, 10.0); + gObjectiveGreenPlayer = playerid; + } + + if(gTeam[playerid] == TEAM_BLUE && vehicleid == OBJECTIVE_VEHICLE_BLUE) + { // It's the objective vehicle + SetPlayerColor(playerid,OBJECTIVE_COLOR); + GameTextForPlayer(playerid,"~w~Take the ~y~boat ~w~back to the ~r~spawn!",3000,5); + SetPlayerCheckpoint(playerid, 2329.4226, 532.7426, 0.5862, 10.0); + gObjectiveBluePlayer = playerid; + } + } + else if(newstate == PLAYER_STATE_ONFOOT) + { + if(playerid == gObjectiveGreenPlayer) { + gObjectiveGreenPlayer = (-1); + SetPlayerToTeamColor(playerid); + DisablePlayerCheckpoint(playerid); + } + + if(playerid == gObjectiveBluePlayer) { + gObjectiveBluePlayer = (-1); + SetPlayerToTeamColor(playerid); + DisablePlayerCheckpoint(playerid); + } + } + + return 1; +} + +//--------------------------------------------------------- + +public OnGameModeInit() +{ + SetGameModeText("Rivershell"); + + ShowPlayerMarkers(0); + ShowNameTags(1); + SetWorldTime(17); + SetWeather(11); + UsePlayerPedAnims(); + EnableVehicleFriendlyFire(); + SetNameTagDrawDistance(110.0); + DisableInteriorEnterExits(); + + // Green classes + AddPlayerClass(162,2117.0129,-224.4389,8.15,0.0,31,100,29,200,34,10); + AddPlayerClass(157,2148.6606,-224.3336,8.15,347.1396,31,100,29,200,34,10); + + // Blue classes + AddPlayerClass(154,2352.9873,580.3051,7.7813,178.1424,31,100,29,200,34,10); + AddPlayerClass(138,2281.1504,567.6248,7.7813,163.7289,31,100,29,200,34,10); + + // Objective vehicles + CreateVehicle(453, 2184.7156, -188.5401, -0.0239, 0.0000, 114, 1, 100); // gr reefer + CreateVehicle(453, 2380.0542, 535.2582, -0.0272, 178.4999, 79, 7, 100); // bl reefer + + // Green Dhingys + CreateVehicle(473, 2096.0833, -168.7771, 0.3528, 4.5000, 114, 1, 100); + CreateVehicle(473, 2103.2510, -168.7598, 0.3528, 3.1800, 114, 1, 100); + CreateVehicle(473, 2099.4966, -168.8216, 0.3528, 2.8200, 114, 1, 100); + CreateVehicle(473, 2107.1143, -168.7798, 0.3528, 3.1800, 114, 1, 100); + CreateVehicle(473, 2111.0674, -168.7609, 0.3528, 3.1800, 114, 1, 100); + CreateVehicle(473, 2114.8933, -168.7898, 0.3528, 3.1800, 114, 1, 100); + CreateVehicle(473, 2167.2217, -169.0570, 0.3528, 3.1800, 114, 1, 100); + CreateVehicle(473, 2170.4294, -168.9724, 0.3528, 3.1800, 114, 1, 100); + CreateVehicle(473, 2173.7952, -168.9217, 0.3528, 3.1800, 114, 1, 100); + CreateVehicle(473, 2177.0386, -168.9767, 0.3528, 3.1800, 114, 1, 100); + CreateVehicle(473, 2161.5786, -191.9538, 0.3528, 89.1000, 114, 1, 100); + CreateVehicle(473, 2161.6394, -187.2925, 0.3528, 89.1000, 114, 1, 100); + CreateVehicle(473, 2161.7610, -183.0225, 0.3528, 89.1000, 114, 1, 100); + CreateVehicle(473, 2162.0283, -178.5106, 0.3528, 89.1000, 114, 1, 100); + // Green Mavericks + CreateVehicle(487, 2088.7905, -227.9593, 8.3662, 0.0000, 114, 1, 100); + CreateVehicle(487, 2204.5991, -225.3703, 8.2400, 0.0000, 114, 1, 100); + + // Blue Dhingys + CreateVehicle(473, 2370.3198, 518.3151, 0.1240, 180.3600, 79, 7, 100); + CreateVehicle(473, 2362.6484, 518.3978, 0.0598, 180.3600, 79, 7, 100); + CreateVehicle(473, 2358.6550, 518.2167, 0.2730, 180.3600, 79, 7, 100); + CreateVehicle(473, 2366.5544, 518.2680, 0.1080, 180.3600, 79, 7, 100); + CreateVehicle(473, 2354.6321, 518.1960, 0.3597, 180.3600, 79, 7, 100); + CreateVehicle(473, 2350.7449, 518.1929, 0.3597, 180.3600, 79, 7, 100); + CreateVehicle(473, 2298.8977, 518.4470, 0.3597, 180.3600, 79, 7, 100); + CreateVehicle(473, 2295.6118, 518.3963, 0.3597, 180.3600, 79, 7, 100); + CreateVehicle(473, 2292.3237, 518.4249, 0.3597, 180.3600, 79, 7, 100); + CreateVehicle(473, 2289.0901, 518.4363, 0.3597, 180.3600, 79, 7, 100); + CreateVehicle(473, 2304.8232, 539.7859, 0.3597, 270.5998, 79, 7, 100); + CreateVehicle(473, 2304.6936, 535.0454, 0.3597, 270.5998, 79, 7, 100); + CreateVehicle(473, 2304.8245, 530.3308, 0.3597, 270.5998, 79, 7, 100); + CreateVehicle(473, 2304.8142, 525.7471, 0.3597, 270.5998, 79, 7, 100); + + // Blue Mavericks + CreateVehicle(487, 2260.2637, 578.5220, 8.1223, 182.3401, 79, 7, 100); + CreateVehicle(487, 2379.9792, 580.0323, 8.0178, 177.9601, 79, 7, 100); + + // Green Base Section + CreateMapObject(9090, 2148.64, -222.88, -20.60, 0.00, 0.00, 179.70); + // Green resupply hut + CreateMapObject(12991, 2140.83, -235.13, 7.13, 0.00, 0.00, -89.94); + + // Blue Base Section + CreateMapObject(9090, 2317.09, 572.27, -20.97, 0.00, 0.00, 0.00); + // Blue resupply hut + CreateMapObject(12991, 2318.73, 590.96, 6.75, 0.00, 0.00, 89.88); + + // General mapping + CreateMapObject(12991, 2140.83, -235.13, 7.13, 0.00, 0.00, -89.94); + CreateMapObject(19300, 2137.33, -237.17, 46.61, 0.00, 0.00, 180.00); + CreateMapObject(12991, 2318.73, 590.96, 6.75, 0.00, 0.00, 89.88); + CreateMapObject(19300, 2325.41, 587.93, 47.37, 0.00, 0.00, 180.00); + CreateMapObject(12991, 2140.83, -235.13, 7.13, 0.00, 0.00, -89.94); + CreateMapObject(12991, 2318.73, 590.96, 6.75, 0.00, 0.00, 89.88); + CreateMapObject(12991, 2140.83, -235.13, 7.13, 0.00, 0.00, -89.94); + CreateMapObject(12991, 2318.73, 590.96, 6.75, 0.00, 0.00, 89.88); + CreateMapObject(18228, 1887.93, -59.78, -2.14, 0.00, 0.00, 20.34); + CreateMapObject(17031, 1990.19, 541.37, -22.32, 0.00, 0.00, 0.00); + CreateMapObject(18227, 2000.82, 494.15, -7.53, 11.70, -25.74, 154.38); + CreateMapObject(17031, 1992.35, 539.80, -2.97, 9.12, 30.66, 0.00); + CreateMapObject(17031, 1991.88, 483.77, -0.66, -2.94, -5.22, 12.78); + CreateMapObject(17029, 2070.57, -235.87, -6.05, -7.20, 4.08, 114.30); + CreateMapObject(17029, 2056.50, -228.77, -19.67, 14.16, 19.68, 106.56); + CreateMapObject(17029, 2074.00, -205.33, -18.60, 16.02, 60.60, 118.86); + CreateMapObject(17029, 2230.39, -242.59, -11.41, 5.94, 7.56, 471.24); + CreateMapObject(17029, 2252.53, -213.17, -20.81, 18.90, -6.30, -202.38); + CreateMapObject(17029, 2233.04, -234.08, -19.00, 21.84, -8.88, -252.06); + CreateMapObject(17027, 2235.05, -201.49, -11.90, -11.94, -4.08, 136.32); + CreateMapObject(17029, 2226.11, -237.07, -2.45, 8.46, 2.10, 471.24); + CreateMapObject(4368, 2433.79, 446.26, 4.67, -8.04, -9.30, 61.02); + CreateMapObject(4368, 2031.23, 489.92, -13.20, -8.04, -9.30, -108.18); + CreateMapObject(17031, 2458.36, 551.10, -6.95, 0.00, 0.00, 0.00); + CreateMapObject(17031, 2465.37, 511.35, -7.70, 0.00, 0.00, 0.00); + CreateMapObject(17031, 2474.80, 457.71, -5.17, 0.00, 0.00, 172.74); + CreateMapObject(17031, 2466.03, 426.28, -5.17, 0.00, 0.00, 0.00); + CreateMapObject(791, 2310.45, -229.38, 7.41, 0.00, 0.00, 0.00); + CreateMapObject(791, 2294.00, -180.15, 7.41, 0.00, 0.00, 60.90); + CreateMapObject(791, 2017.50, -305.30, 7.29, 0.00, 0.00, 60.90); + CreateMapObject(791, 2106.45, -279.86, 20.05, 0.00, 0.00, 60.90); + CreateMapObject(706, 2159.13, -263.71, 19.22, 356.86, 0.00, -17.18); + CreateMapObject(706, 2055.75, -291.53, 13.98, 356.86, 0.00, -66.50); + CreateMapObject(791, 1932.65, -315.88, 6.77, 0.00, 0.00, -35.76); + CreateMapObject(790, 2429.40, 575.79, 10.42, 0.00, 0.00, 3.14); + CreateMapObject(790, 2403.40, 581.56, 10.42, 0.00, 0.00, 29.48); + CreateMapObject(791, 2083.44, 365.48, 13.19, 356.86, 0.00, -1.95); + CreateMapObject(791, 2040.15, 406.02, 13.33, 356.86, 0.00, -1.95); + CreateMapObject(791, 1995.36, 588.10, 7.50, 356.86, 0.00, -1.95); + CreateMapObject(791, 2126.11, 595.15, 5.99, 0.00, 0.00, -35.82); + CreateMapObject(791, 2188.35, 588.90, 6.04, 0.00, 0.00, 0.00); + CreateMapObject(791, 2068.56, 595.58, 5.99, 0.00, 0.00, 52.62); + CreateMapObject(698, 2385.32, 606.16, 9.79, 0.00, 0.00, 34.62); + CreateMapObject(698, 2309.29, 606.92, 9.79, 0.00, 0.00, -54.54); + CreateMapObject(790, 2347.14, 619.77, 9.94, 0.00, 0.00, 3.14); + CreateMapObject(698, 2255.28, 606.94, 9.79, 0.00, 0.00, -92.76); + CreateMapObject(4298, 2121.37, 544.12, -5.74, -10.86, 6.66, 3.90); + CreateMapObject(4368, 2273.18, 475.02, -15.30, 4.80, 8.10, 266.34); + CreateMapObject(18227, 2232.38, 451.61, -30.71, -18.54, -6.06, 154.38); + CreateMapObject(17031, 2228.15, 518.87, -16.51, 13.14, -1.32, -20.10); + CreateMapObject(17031, 2230.42, 558.52, -18.38, -2.94, -5.22, 12.78); + CreateMapObject(17031, 2228.97, 573.62, 5.17, 17.94, -15.60, -4.08); + CreateMapObject(17029, 2116.67, -87.71, -2.31, 5.94, 7.56, 215.22); + CreateMapObject(17029, 2078.66, -83.87, -27.30, 13.02, -53.94, -0.30); + CreateMapObject(17029, 2044.80, -36.91, -9.26, -13.74, 27.90, 293.76); + CreateMapObject(17029, 2242.41, 426.16, -15.43, -21.54, 22.26, 154.80); + CreateMapObject(17029, 2220.06, 450.07, -34.78, -1.32, 10.20, -45.84); + CreateMapObject(17029, 2252.49, 439.08, -19.47, -41.40, 20.16, 331.86); + CreateMapObject(17031, 2241.41, 431.93, -5.62, -2.22, -4.80, 53.64); + CreateMapObject(17029, 2141.10, -81.30, -2.41, 5.94, 7.56, 39.54); + CreateMapObject(17031, 2277.07, 399.31, -1.65, -2.22, -4.80, -121.74); + CreateMapObject(17026, 2072.75, -224.40, -5.25, 0.00, 0.00, -41.22); + + // Ramps + CreateMapObject(1632, 2131.97, 110.24, 0.00, 0.00, 0.00, 153.72); + CreateMapObject(1632, 2124.59, 113.69, 0.00, 0.00, 0.00, 157.56); + CreateMapObject(1632, 2116.31, 116.44, 0.00, 0.00, 0.00, 160.08); + CreateMapObject(1632, 2113.22, 108.48, 0.00, 0.00, 0.00, 340.20); + CreateMapObject(1632, 2121.21, 105.21, 0.00, 0.00, 0.00, 340.20); + CreateMapObject(1632, 2127.84, 102.06, 0.00, 0.00, 0.00, 334.68); + CreateMapObject(1632, 2090.09, 40.90, 0.00, 0.00, 0.00, 348.36); + CreateMapObject(1632, 2098.73, 39.12, 0.00, 0.00, 0.00, 348.36); + CreateMapObject(1632, 2107.17, 37.94, 0.00, 0.00, 0.00, 348.36); + CreateMapObject(1632, 2115.88, 36.47, 0.00, 0.00, 0.00, 348.36); + CreateMapObject(1632, 2117.46, 45.86, 0.00, 0.00, 0.00, 529.20); + CreateMapObject(1632, 2108.98, 46.95, 0.00, 0.00, 0.00, 529.20); + CreateMapObject(1632, 2100.42, 48.11, 0.00, 0.00, 0.00, 526.68); + CreateMapObject(1632, 2091.63, 50.02, 0.00, 0.00, 0.00, 526.80); + + return 1; +} + +//--------------------------------------------------------- + +public OnPlayerConnect(playerid) +{ + SetPlayerColor(playerid,0x888888FF); + GameTextForPlayer(playerid,"~r~SA-MP: ~w~Rivershell",2000,5); + RemoveNeededBuildingsForPlayer(playerid); + + return 1; +} + +//--------------------------------------------------------- + +public OnPlayerRequestClass(playerid, classid) +{ + SetupPlayerForClassSelection(playerid); + SetPlayerTeamFromClass(playerid,classid); + + if(classid == 0 || classid == 1) { + GameTextForPlayer(playerid,"~g~GREEN ~w~TEAM",1000,5); + } else if(classid == 2 || classid == 3) { + GameTextForPlayer(playerid,"~b~BLUE ~w~TEAM",1000,5); + } + + return 1; +} + +//--------------------------------------------------------- + +public OnPlayerSpawn(playerid) +{ + // Wait a bit before allowing them to respawn. Switch to spectate mode. + if( GetPVarInt(playerid, "LastDeathTick") != 0 && + GetTickCount() - GetPVarInt(playerid, "LastDeathTick") < (ALLOW_RESPAWN_AFTER_N_SECONDS * 1000) ) + { + SendClientMessage(playerid, 0xFFAAEEEE, "Waiting to respawn...."); + TogglePlayerSpectating(playerid, 1); + + // If the last killer id is valid, we should try setting it now to avoid any camera lag switching to spectate. + new LastKillerId = GetPVarInt(playerid, "LastKillerId"); + + if( IsPlayerConnected(LastKillerId) && + (GetPlayerState(LastKillerId) == PLAYER_STATE_ONFOOT || + GetPlayerState(LastKillerId) == PLAYER_STATE_DRIVER || + GetPlayerState(LastKillerId) == PLAYER_STATE_PASSENGER) ) + { + SpectatePlayer(playerid, LastKillerId); + SetPVarInt(playerid, "SpectateState", SPECTATE_STATE_PLAYER); + } + + return 1; + } + + SetPlayerToTeamColor(playerid); + + if(gTeam[playerid] == TEAM_GREEN) { + GameTextForPlayer(playerid, + "Defend the ~g~GREEN ~w~team's ~y~Reefer~n~~w~Capture the ~b~BLUE ~w~team's ~y~Reefer", + 6000,5); + } + else if(gTeam[playerid] == TEAM_BLUE) { + GameTextForPlayer(playerid, + "Defend the ~b~BLUE ~w~team's ~y~Reefer~n~~w~Capture the ~g~GREEN ~w~team's ~y~Reefer", + 6000,5); + } + + SetPlayerHealth(playerid, 100.0); + SetPlayerArmour(playerid, 100.0); + SetPlayerWorldBounds(playerid, 2500.0, 1850.0, 631.2963, -454.9898); + + SetPVarInt(playerid, "SpectateState", SPECTATE_STATE_NONE); + SetPVarInt(playerid, "SpectateMode", SPECTATE_MODE_NONE); + + return 1; +} + +//--------------------------------------------------------- + +public OnPlayerEnterCheckpoint(playerid) +{ + new playervehicleid = GetPlayerVehicleID(playerid); + + if(gObjectiveReached) return; + + if(playervehicleid == OBJECTIVE_VEHICLE_GREEN && gTeam[playerid] == TEAM_GREEN) + { // Green OBJECTIVE REACHED. + gGreenTimesCapped++; + SetPlayerScore(playerid,GetPlayerScore(playerid)+5); + + if(gGreenTimesCapped==CAPS_TO_WIN) { + GameTextForAll("~g~GREEN ~w~team wins!",3000,5); + gObjectiveReached = 1; PlaySoundForAll(1185, 0.0, 0.0, 0.0); + SetTimer("ExitTheGameMode", 6000, 0); // Set up a timer to exit this mode. + } else { + GameTextForAll("~g~GREEN ~w~team captured the ~y~boat!",3000,5); + SetVehicleToRespawn(OBJECTIVE_VEHICLE_GREEN); + } + return; + } + else if(playervehicleid == OBJECTIVE_VEHICLE_BLUE && gTeam[playerid] == TEAM_BLUE) + { // Blue OBJECTIVE REACHED. + gBlueTimesCapped++; + SetPlayerScore(playerid,GetPlayerScore(playerid)+5); + + if(gBlueTimesCapped==CAPS_TO_WIN) { + GameTextForAll("~b~BLUE ~w~team wins!",3000,5); + gObjectiveReached = 1; PlaySoundForAll(1185, 0.0, 0.0, 0.0); + SetTimer("ExitTheGameMode", 6000, 0); // Set up a timer to exit this mode. + } else { + GameTextForAll("~b~BLUE ~w~team captured the ~y~boat!",3000,5); + SetVehicleToRespawn(OBJECTIVE_VEHICLE_BLUE); + } + return; + } +} + +//--------------------------------------------------------- + +public OnPlayerDeath(playerid, killerid, reason) +{ + if(killerid == INVALID_PLAYER_ID) { + SendDeathMessage(INVALID_PLAYER_ID,playerid,reason); + } else { + if(gTeam[killerid] != gTeam[playerid]) { + // Valid kill + SendDeathMessage(killerid,playerid,reason); + SetPlayerScore(killerid,GetPlayerScore(killerid)+1); + } + else { + // Team kill + SendDeathMessage(killerid,playerid,reason); + } + } + + SetPVarInt(playerid, "LastDeathTick", GetTickCount()); + SetPVarInt(playerid, "LastKillerId", killerid); + + return 1; +} + +//--------------------------------- + +public OnVehicleStreamIn(vehicleid, forplayerid) +{ + // As the vehicle streams in, player team dependant params are applied. They can't be + // applied to vehicles that don't exist in the player's world. + + if(vehicleid == OBJECTIVE_VEHICLE_BLUE) { + if(gTeam[forplayerid] == TEAM_GREEN) { + SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_BLUE,forplayerid,1,1); // objective; locked + } + else if(gTeam[forplayerid] == TEAM_BLUE) { + SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_BLUE,forplayerid,1,0); // objective; unlocked + } + } + else if(vehicleid == OBJECTIVE_VEHICLE_GREEN) { + if(gTeam[forplayerid] == TEAM_BLUE) { + SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_GREEN,forplayerid,1,1); // objective; locked + } + else if(gTeam[forplayerid] == TEAM_GREEN) { + SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_GREEN,forplayerid,1,0); // objective; unlocked + } + } + + return 1; + //printf("GameMode: VehicleStreamIn(%d,%d)",vehicleid,forplayerid); +} + +//--------------------------------- + +public OnVehicleStreamOut(vehicleid, forplayerid) +{ + return 1; + //printf("GameMode: VehicleStreamOut(%d,%d)",vehicleid,forplayerid); +} + +//--------------------------------- + +public OnPlayerUpdate(playerid) +{ + if(!IsPlayerConnected(playerid)) return 0; + if(IsPlayerNPC(playerid)) return 1; + + if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) { + if(GetPVarInt(playerid, "LastDeathTick") == 0) { + TogglePlayerSpectating(playerid, 0); + return 1; + } + // Allow respawn after an arbitrary time has passed + if(GetTickCount() - GetPVarInt(playerid, "LastDeathTick") > (ALLOW_RESPAWN_AFTER_N_SECONDS * 1000)) { + TogglePlayerSpectating(playerid, 0); + return 1; + } + HandleSpectating(playerid); + return 1; + } + + // Check the resupply huts + if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { + if(IsPlayerInRangeOfPoint(playerid, 2.5, 2140.83, -235.13, 7.13) || IsPlayerInRangeOfPoint(playerid, 2.5, 2318.73, 590.96, 6.75)) { + DoResupply(playerid); + } + } + + return 1; +} + +//--------------------------------- + +PlaySoundForAll(soundid, Float:x, Float:y, Float:z) +{ + for (new i=0; i 30000) { + SetPVarInt(playerid, "LastResupply", GetTickCount()); + ResetPlayerWeapons(playerid); + GivePlayerWeapon(playerid,31,100); + GivePlayerWeapon(playerid,29,200); + GivePlayerWeapon(playerid,34,10); + SetPlayerHealth(playerid, 100.0); + SetPlayerArmour(playerid, 100.0); + GameTextForPlayer(playerid,"Resupplied", 2000, 5); + PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0); + } +} + +//--------------------------------- + diff --git a/gamemodes/timertest.amx b/gamemodes/timertest.amx new file mode 100644 index 0000000..003ec2f Binary files /dev/null and b/gamemodes/timertest.amx differ diff --git a/gamemodes/timertest.pwn b/gamemodes/timertest.pwn new file mode 100644 index 0000000..02821eb --- /dev/null +++ b/gamemodes/timertest.pwn @@ -0,0 +1,36 @@ +#include + +forward OneSecTimer(); + +new lasttick = 0; + +main() +{ + print("\n----------------------------------"); + print(" This is a blank GameModeScript"); + print("----------------------------------\n"); +} + +public OnGameModeInit() +{ + // Set timer of 1 second. + SetTimer("OneSecTimer", 1000, 1); + print("GameModeInit()"); + SetGameModeText("Timer Test"); + AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); + return 1; +} + +public OneSecTimer() { + + if(lasttick == 0) { + lasttick = GetTickCount(); + return; + } + new sText[256]; + format(sText,sizeof(sText),"GetTickCountOffset = %d",GetTickCount() - lasttick); + print(sText); + SendClientMessageToAll(0xFF0000, sText); + lasttick = GetTickCount(); +} + diff --git a/include/gl_common.inc b/include/gl_common.inc new file mode 100644 index 0000000..c985f66 --- /dev/null +++ b/include/gl_common.inc @@ -0,0 +1,241 @@ +//---------------------------------------------------------- +// +// GRAND LARCENY common functions include. +// +//---------------------------------------------------------- + +stock LoadStaticVehiclesFromFile(const filename[]) +{ + new File:file_ptr; + new line[256]; + new var_from_line[64]; + new vehicletype; + new Float:SpawnX; + new Float:SpawnY; + new Float:SpawnZ; + new Float:SpawnRot; + new Color1, Color2; + new index; + new vehicles_loaded; + + file_ptr = fopen(filename,filemode:io_read); + if(!file_ptr) return 0; + + vehicles_loaded = 0; + + while(fread(file_ptr,line,256) > 0) + { + index = 0; + + // Read type + index = token_by_delim(line,var_from_line,',',index); + if(index == (-1)) continue; + vehicletype = strval(var_from_line); + if(vehicletype < 400 || vehicletype > 611) continue; + + // Read X, Y, Z, Rotation + index = token_by_delim(line,var_from_line,',',index+1); + if(index == (-1)) continue; + SpawnX = floatstr(var_from_line); + + index = token_by_delim(line,var_from_line,',',index+1); + if(index == (-1)) continue; + SpawnY = floatstr(var_from_line); + + index = token_by_delim(line,var_from_line,',',index+1); + if(index == (-1)) continue; + SpawnZ = floatstr(var_from_line); + + index = token_by_delim(line,var_from_line,',',index+1); + if(index == (-1)) continue; + SpawnRot = floatstr(var_from_line); + + // Read Color1, Color2 + index = token_by_delim(line,var_from_line,',',index+1); + if(index == (-1)) continue; + Color1 = strval(var_from_line); + + index = token_by_delim(line,var_from_line,';',index+1); + Color2 = strval(var_from_line); + + //printf("%d,%.2f,%.2f,%.2f,%.4f,%d,%d",vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2); + + AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2,(30*60)); // respawn 30 minutes + + /*new numplate_test[32+1]; + format(numplate_test,32,"GRLC{44AA33}%d",vid); + SetVehicleNumberPlate(vid, numplate_test);*/ + + vehicles_loaded++; + } + + fclose(file_ptr); + printf("Loaded %d vehicles from: %s",vehicles_loaded,filename); + return vehicles_loaded; +} + +//---------------------------------------------------------- + +stock strtok(const string[], &index) +{ + new length = strlen(string); + while ((index < length) && (string[index] <= ' ')) + { + index++; + } + + new offset = index; + new result[20]; + while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) + { + result[index - offset] = string[index]; + index++; + } + result[index - offset] = EOS; + return result; +} + +//------------------------------------------------ + +stock strrest(const string[], &index) +{ + new length = strlen(string); + while ((index < length) && (string[index] <= ' ')) + { + index++; + } + new offset = index; + new result[128]; + while ((index < length) && ((index - offset) < (sizeof(result) - 1))) + { + result[index - offset] = string[index]; + index++; + } + result[index - offset] = EOS; + return result; +} + +//---------------------------------------------------------- +// Tokenise by a delimiter +// Return string and index of the end determined by the +// provided delimiter in delim + +stock token_by_delim(const string[], return_str[], delim, start_index) +{ + new x=0; + while(string[start_index] != EOS && string[start_index] != delim) { + return_str[x] = string[start_index]; + x++; + start_index++; + } + return_str[x] = EOS; + if(string[start_index] == EOS) start_index = (-1); + return start_index; +} + +//---------------------------------------------------------- + +stock isNumeric(const string[]) +{ + new length=strlen(string); + if (length==0) return false; + for (new i = 0; i < length; i++) + { + if ( + (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-' + || (string[i]=='-' && i!=0) // A '-' but not at first. + || (string[i]=='+' && i!=0) // A '+' but not at first. + ) return false; + } + if (length==1 && (string[0]=='-' || string[0]=='+')) return false; + return true; +} + +//---------------------------------------------------------- + +stock IsKeyJustDown(key, newkeys, oldkeys) +{ + if((newkeys & key) && !(oldkeys & key)) return 1; + return 0; +} + +//---------------------------------------------------------- + +stock PlaySoundForAll(soundid, Float:x, Float:y, Float:z) +{ + for(new i=0; i=0 && userid < MAX_PLAYERS) + { + if(IsPlayerConnected(userid)) return userid; + return RETURN_USER_FAILURE; + } + } + + // They entered [part of] a name or the id search failed (check names just incase) + new len = strlen(text[pos]); + new count = 0; + new name[MAX_PLAYER_NAME+1]; + + for(new i = 0; i < MAX_PLAYERS; i++) + { + if(IsPlayerConnected(i)) + { + GetPlayerName(i, name, sizeof(name)); + if(strcmp(name, text[pos], true, len) == 0) // Check segment of name + { + if(len == strlen(name)) { // Exact match + return i; + } + else { // Partial match + count++; + userid = i; + } + } + } + } + + if(!count) return RETURN_USER_FAILURE; + if(count > 1) return RETURN_USER_MULTIPLE; + + return userid; +} + +//---------------------------------------------------------- \ No newline at end of file diff --git a/include/gl_messages.inc b/include/gl_messages.inc new file mode 100644 index 0000000..7afa65e --- /dev/null +++ b/include/gl_messages.inc @@ -0,0 +1,166 @@ +// +// +// SA-MP Roleplay style chat module for SA-MP 0.3 +// (c) 2012 SA-MP Team +// All rights reserved +// + +#define GENERAL_COLOR 0xEEEEEEFF +#define LOCAL_TALK_COLOR 0xD0D0D0FF +#define SPEECH_BUBBLE_COLOR 0xEEEEEEFF +#define ACTION_COLOR 0xC2A2DAAA +#define CMD_USAGE_COLOR 0xBFC0C2FF +#define MEGAPHONE_COLOR 0xFFFF00AA +#define WHISPER_COLOR 0xFFFF00AA +#define OOC_COLOR 0xE0FFFFAA +#define ADMIN_ACTION_COLOR 0xDAA2ACAA + +#define TALK_DISTANCE 30.0 +#define SHOUT_DISTANCE 60.0 +#define LOW_DISTANCE 5.0 +#define ACTION_DISTANCE 30.0 +#define MEGAPHONE_DISTANCE 70.0 + +#define CHAT_BUBBLE_TIME 6000 + +#define ACTION_ME 1 +#define ACTION_DO 2 + +//--------------------------------------------- +// Send a chat message to this player + +stock PlayerMessage(playerid, color, message[]) +{ + SendClientMessage(playerid, color, message); +} + +//--------------------------------------------- +// Send a chat message to all players + +stock GlobalMessage(color, message[]) +{ + SendClientMessageToAll(color, message); +} + +//--------------------------------------------- + +stock CmdUsageMessage(playerid, message[]) +{ + new msg[256+1]; + format(msg,256,"[{BFC0C2}usage{EEEEEE}] %s", message); + SendClientMessage(playerid, GENERAL_COLOR, msg); +} + +//--------------------------------------------- + +stock CmdErrorMessage(playerid, message[]) +{ + new msg[256+1]; + format(msg,256,"[{E0C0C0}error{EEEEEE}] %s", message); + SendClientMessage(playerid, GENERAL_COLOR, msg); +} + +//--------------------------------------------- + +stock CmdAdminMessage(playerid, message[]) +{ + new msg[256+1]; + format(msg,256,"[{5050EE}admin{EEEEEE}] %s", message); + SendClientMessage(playerid, GENERAL_COLOR, msg); +} + +//--------------------------------------------- + +stock AdminActionMessage(playerid, message[]) +{ + PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); + SendClientMessage(playerid, ADMIN_ACTION_COLOR, message); +} + +//--------------------------------------------- +// Send a chat message to players in distance of playerid +// This includes the origin player. + +stock LocalMessage(Float:dist, playerid, color, message[], chatbubble=0) +{ + if(!strlen(message)) return; + + if(IsPlayerConnected(playerid)) + { + new Float:fPlayerX, Float:fPlayerY, Float:fPlayerZ; + new Float:fPlayerToPlayerDist; + + // send to the origin player + PlayerMessage(playerid, color, message); + + // if it requires a chat bubble, show it. + if(chatbubble) { + SetPlayerChatBubble(playerid, message, color, dist, CHAT_BUBBLE_TIME); + } + + GetPlayerPos(playerid, fPlayerX, fPlayerY, fPlayerZ); + + for(new i = 0; i < MAX_PLAYERS; i++) { // for every player + if(IsPlayerConnected(i) && (i != playerid) && IsPlayerStreamedIn(playerid,i)) { + fPlayerToPlayerDist = GetPlayerDistanceFromPoint(i, fPlayerX, fPlayerY, fPlayerZ); + if(fPlayerToPlayerDist < dist) { // receiving player is within the specified distance + PlayerMessage(i, color, message); + } + } + } + } +} + +//--------------------------------------------- +// This will send a local talk message and automatically grey-fade it. +// This includes the origin player. + +stock TalkMessage(Float:dist, playerid, prefix[], message[]) +{ + new PlayerName[MAX_PLAYER_NAME+1]; + new Msg[256+1]; + new MsgWithName[256+1]; + + if(!strlen(message)) return; + + if(IsPlayerConnected(playerid)) + { + new Float:fPlayerX, Float:fPlayerY, Float:fPlayerZ; + new Float:fPlayerToPlayerDist; + new Float:fNormDistance; + new ColorScale; + new ColorValue; + + GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); + if(strlen(prefix)) { + format(Msg, sizeof(Msg), "%s %s", prefix, message); + } else { + format(Msg, sizeof(Msg), "%s", message); + } + + format(MsgWithName, sizeof(MsgWithName), "%s: %s", PlayerName, Msg); + + SetPlayerChatBubble(playerid, Msg, SPEECH_BUBBLE_COLOR, dist, CHAT_BUBBLE_TIME); + + // Send to originating player + PlayerMessage(playerid, LOCAL_TALK_COLOR, MsgWithName); + + GetPlayerPos(playerid, fPlayerX, fPlayerY, fPlayerZ); + + for(new i = 0; i < MAX_PLAYERS; i++) { // for every player + if(IsPlayerConnected(i) && (i != playerid) && IsPlayerStreamedIn(playerid,i)) { + fPlayerToPlayerDist = GetPlayerDistanceFromPoint(i, fPlayerX, fPlayerY, fPlayerZ); + if(fPlayerToPlayerDist < dist) { // receiving player is within the specified distance + // get normalized distance to create a fade. + fNormDistance = 1.0 - (fPlayerToPlayerDist / dist); + if(fNormDistance > 0.75) ColorScale = 220; + else ColorScale = floatround(96.0 + (128.0 * fNormDistance)); + ColorValue = 0x000000FF | ColorScale << 24 | ColorScale << 16 | ColorScale << 8; + PlayerMessage(i, ColorValue, MsgWithName); + } + } + } + } +} + +//--------------------------------------------- \ No newline at end of file diff --git a/include/gl_spawns.inc b/include/gl_spawns.inc new file mode 100644 index 0000000..51159d3 --- /dev/null +++ b/include/gl_spawns.inc @@ -0,0 +1,138 @@ +// Some player spawn points around the 3 main cities of San Andreas. +// Thanks to krisk, Popz and Woet. + +// Police dept spawns LS/SF/LV. +new Float:gPoliceSpawns[3][4] = { +{1568.2250,-1693.5483,5.8906,177.0983}, +{-1604.8442,732.9442,-5.2344,37.6041}, +{2343.4553,2455.5994,14.9688,96.5022} +}; + +// Medical dept spawns LS/SF/LV. +new Float:gMedicalSpawns[3][4] = { +{1568.2250,-1693.5483,5.8906,177.0983}, +{-1604.8442,732.9442,-5.2344,37.6041}, +{1609.5922,1820.9641,10.8280,348.1614} +}; + +// Army spawns LS/SF/LV. +new Float:gArmySpawns[3][4] = { +{2786.2183,-2436.7859,13.6340,82.3043}, +{-1308.4493,504.9661,11.1953,132.5}, +{272.6040,1989.7307,17.6406,268.3605} +}; + +new Float:gRandomSpawns_LosSantos[][4] = { +{1751.1097,-2106.4529,13.5469,183.1979}, // El-Corona - Outside random house +{2652.6418,-1989.9175,13.9988,182.7107}, // Random house in willowfield - near playa de seville and stadium +{2489.5225,-1957.9258,13.5881,2.3440}, // Hotel in willowfield - near cluckin bell +{2689.5203,-1695.9354,10.0517,39.5312}, // Outside stadium - lots of cars +{2770.5393,-1628.3069,12.1775,4.9637}, // South in east beach - north of stadium - carparks nearby +{2807.9282,-1176.8883,25.3805,173.6018}, // North in east beach - near apartments +{2552.5417,-958.0850,82.6345,280.2542}, // Random house north of Las Colinas +{2232.1309,-1159.5679,25.8906,103.2939}, // Jefferson motel +{2388.1003,-1279.8933,25.1291,94.3321}, // House south of pig pen +{2481.1885,-1536.7186,24.1467,273.4944}, // East LS - near clucking bell and car wash +{2495.0720,-1687.5278,13.5150,359.6696}, // Outside CJ's house - lots of cars nearby +{2306.8252,-1675.4340,13.9221,2.6271}, // House in ganton - lots of cars nearby +{2191.8403,-1455.8251,25.5391,267.9925}, // House in south jefferson - lots of cars nearby +{1830.1359,-1092.1849,23.8656,94.0113}, // Mulholland intersection carpark +{2015.3630,-1717.2535,13.5547,93.3655}, // Idlewood house +{1654.7091,-1656.8516,22.5156,177.9729}, // Right next to PD +{1219.0851,-1812.8058,16.5938,190.0045}, // Conference Center +{1508.6849,-1059.0846,25.0625,1.8058}, // Across the street of BANK - lots of cars in intersection carpark +{1421.0819,-885.3383,50.6531,3.6516}, // Outside house in vinewood +{1133.8237,-1272.1558,13.5469,192.4113}, // Near hospital +{1235.2196,-1608.6111,13.5469,181.2655}, // Backalley west of mainstreet +{590.4648,-1252.2269,18.2116,25.0473}, // Outside "BAnk of San Andreas" +{842.5260,-1007.7679,28.4185,213.9953}, // North of Graveyard +{911.9332,-1232.6490,16.9766,5.2999}, // LS Film Studio +{477.6021,-1496.6207,20.4345,266.9252}, // Rodeo Place +{255.4621,-1366.3256,53.1094,312.0852}, // Outside propery in richman +{281.5446,-1261.4562,73.9319,305.0017}, // Another richman property +{790.1918,-839.8533,60.6328,191.9514}, // Mulholland house +{1299.1859,-801.4249,84.1406,269.5274}, // Maddoggs +{1240.3170,-2036.6886,59.9575,276.4659}, // Verdant Bluffs +{2215.5181,-2627.8174,13.5469,273.7786}, // Ocean docks 1 +{2509.4346,-2637.6543,13.6453,358.3565} // Ocean Docks spawn 2 +}; + +new Float:gRandomSpawns_LasVenturas[][4] = { +{1435.8024,2662.3647,11.3926,1.1650}, // Northern train station +{1457.4762,2773.4868,10.8203,272.2754}, // Northern golf club +{1739.6390,2803.0569,14.2735,285.3929}, // Northern housing estate 1 +{1870.3096,2785.2471,14.2734,42.3102}, // Northern housing estate 2 +{1959.7142,2754.6863,10.8203,181.4731}, // Northern house 1 +{2314.2556,2759.4504,10.8203,93.2711}, // Northern industrial estate 1 +{2216.5674,2715.0334,10.8130,267.6540}, // Northern industrial estate 2 +{2101.4192,2678.7874,10.8130,92.0607}, // Northern near railway line +{1951.1090,2660.3877,10.8203,180.8461}, // Northern house 2 +{1666.6949,2604.9861,10.8203,179.8495}, // Northern house 3 +{2808.3367,2421.5107,11.0625,136.2060}, // Northern shopping centre +{2633.3203,2349.7061,10.6719,178.7175}, // V-Rock +{2606.6348,2161.7490,10.8203,88.7508}, // South V-Rock +{2616.5286,2100.6226,10.8158,177.7834}, // North Ammunation 1 +{2491.8816,2397.9370,10.8203,266.6003}, // North carpark 1 +{2531.7891,2530.3223,21.8750,91.6686}, // North carpark 2 +{2340.6677,2530.4324,10.8203,177.8630}, // North Pizza Stack +{2097.6855,2491.3313,14.8390,181.8117}, // Emerald Isle +{1893.1000,2423.2412,11.1782,269.4385}, // Souvenir shop +{1698.9330,2241.8320,10.8203,357.8584}, // Northern casino +{1479.4559,2249.0769,11.0234,306.3790}, // Baseball stadium 1 +{1298.1548,2083.4016,10.8127,256.7034}, // Baseball stadium 2 +{1117.8785,2304.1514,10.8203,81.5490}, // North carparks +{1108.9878,1705.8639,10.8203,0.6785}, // Dirtring racing 1 +{1423.9780,1034.4188,10.8203,90.9590}, // Sumo +{1537.4377,752.0641,11.0234,271.6893}, // Church +{1917.9590,702.6984,11.1328,359.2682}, // Southern housing estate +{2089.4785,658.0414,11.2707,357.3572}, // Southern house 1 +{2489.8286,928.3251,10.8280,67.2245}, // Wedding chapel +{2697.4717,856.4916,9.8360,267.0983}, // Southern construction site +{2845.6104,1288.1444,11.3906,3.6506}, // Southern train station +{2437.9370,1293.1442,10.8203,86.3830}, // Wedding chapel (near Pyramid) +{2299.5430,1451.4177,10.8203,269.1287}, // Carpark (near Pyramid) +{2214.3008,2041.9165,10.8203,268.7626}, // Central parking lot +{2005.9174,2152.0835,10.8203,270.1372}, // Central motel +{2222.1042,1837.4220,10.8203,88.6461}, // Clowns Pocket +{2025.6753,1916.4363,12.3382,272.5852}, // The Visage +{2087.9902,1516.5336,10.8203,48.9300}, // Royal Casino +{2172.1624,1398.7496,11.0625,91.3783}, // Auto Bahn +{2139.1841,987.7975,10.8203,0.2315}, // Come-a-lot +{1860.9672,1030.2910,10.8203,271.6988}, // Behind 4 Dragons +{1673.2345,1316.1067,10.8203,177.7294}, // Airport carpark +{1412.6187,2000.0596,14.7396,271.3568} // South baseball stadium houses +}; + +new Float:gRandomSpawns_SanFierro[][4] = { +{-2723.4639,-314.8138,7.1839,43.5562}, // golf course spawn +{-2694.5344,64.5550,4.3359,95.0190}, // in front of a house +{-2458.2000,134.5419,35.1719,303.9446}, // hotel +{-2796.6589,219.5733,7.1875,88.8288}, // house +{-2706.5261,397.7129,4.3672,179.8611}, // park +{-2866.7683,691.9363,23.4989,286.3060}, // house +{-2764.9543,785.6434,52.7813,357.6817}, // donut shop +{-2660.9402,883.2115,79.7738,357.4440}, // house +{-2861.0796,1047.7109,33.6068,188.2750}, // parking lot +{-2629.2009,1383.1367,7.1833,179.7006}, // parking lot at the bridge +{-2079.6802,1430.0189,7.1016,177.6486}, // pier +{-1660.2294,1382.6698,9.8047,136.2952}, // pier 69 +{-1674.1964,430.3246,7.1797,226.1357}, // gas station] +{-1954.9982,141.8080,27.1747,277.7342}, // train station +{-1956.1447,287.1091,35.4688,90.4465}, // car shop +{-1888.1117,615.7245,35.1719,128.4498}, // random +{-1922.5566,886.8939,35.3359,272.1293}, // random +{-1983.3458,1117.0645,53.1243,271.2390}, // church +{-2417.6458,970.1491,45.2969,269.3676}, // gas station +{-2108.0171,902.8030,76.5792,5.7139}, // house +{-2097.5664,658.0771,52.3672,270.4487}, // random +{-2263.6650,393.7423,34.7708,136.4152}, // random +{-2287.5027,149.1875,35.3125,266.3989}, // baseball parking lot +{-2039.3571,-97.7205,35.1641,7.4744}, // driving school +{-1867.5022,-141.9203,11.8984,22.4499}, // factory +{-1537.8992,116.0441,17.3226,120.8537}, // docks ship +{-1708.4763,7.0187,3.5489,319.3260}, // docks hangar +{-1427.0858,-288.9430,14.1484,137.0812}, // airport +{-2173.0654,-392.7444,35.3359,237.0159}, // stadium +{-2320.5286,-180.3870,35.3135,179.6980}, // burger shot +{-2930.0049,487.2518,4.9141,3.8258} // harbor +}; \ No newline at end of file diff --git a/include/vehicleutil.inc b/include/vehicleutil.inc new file mode 100644 index 0000000..5ca1147 --- /dev/null +++ b/include/vehicleutil.inc @@ -0,0 +1,76 @@ +// SA-MP Vehicle States Helper Functions +// (c) 2012 SA-MP Team +// All rights reserved. + +// VehicleParamsEx toggle helpers +stock ToggleVehicleEngine(vid) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(engine == VEHICLE_PARAMS_UNSET || engine == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); + else SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective); +} +stock ToggleVehicleLights(vid) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(lights == VEHICLE_PARAMS_UNSET || lights == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective); + else SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective); +} +stock ToggleVehicleDoorsLocked(vid) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(doors == VEHICLE_PARAMS_UNSET || doors == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective); + else SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective); +} +stock ToggleVehicleHood(vid) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(bonnet == VEHICLE_PARAMS_UNSET || bonnet == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective); + else SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective); +} +stock ToggleVehicleTrunk(vid) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(boot == VEHICLE_PARAMS_UNSET || boot == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective); + else SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective); +} +// VehicleParamsEx state setter helpers +stock SetVehicleEngineState(vid, setstate) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(setstate) SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); + else SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective); +} +stock SetVehicleLightsState(vid, setstate) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(setstate) SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective); + else SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective); +} +stock SetVehicleDoorsLockedState(vid, setstate) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(setstate) SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective); + else SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective); +} +stock SetVehicleHoodState(vid, setstate) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(setstate) SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective); + else SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective); +} +stock SetVehicleTrunkState(vid, setstate) +{ + new engine,lights,alarm,doors,bonnet,boot,objective; + GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective); + if(setstate) SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective); + else SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective); +} \ No newline at end of file diff --git a/npcmodes/at400_ls.amx b/npcmodes/at400_ls.amx new file mode 100644 index 0000000..6b094d2 Binary files /dev/null and b/npcmodes/at400_ls.amx differ diff --git a/npcmodes/at400_ls.pwn b/npcmodes/at400_ls.pwn new file mode 100644 index 0000000..4e84f7f --- /dev/null +++ b/npcmodes/at400_ls.pwn @@ -0,0 +1,58 @@ +// +// A Driver NPC that goes around a path continuously +// Kye 2009 +// + +#include + +#define NUM_PLAYBACK_FILES 3 +new gPlaybackFileCycle=0; + +//------------------------------------------ + +main(){} + +//------------------------------------------ + +NextPlayback() +{ + // Reset the cycle count if we reach the max + if(gPlaybackFileCycle==NUM_PLAYBACK_FILES) gPlaybackFileCycle = 0; + + if(gPlaybackFileCycle==0) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_ls_to_lv_x1"); + } + else if(gPlaybackFileCycle==1) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_lv_to_sf_x1"); + } + else if(gPlaybackFileCycle==2) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_sf_to_ls_x1"); + } + + gPlaybackFileCycle++; +} + + +//------------------------------------------ + +public OnRecordingPlaybackEnd() +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCEnterVehicle(vehicleid, seatid) +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + StopRecordingPlayback(); + gPlaybackFileCycle = 0; +} + +//------------------------------------------ diff --git a/npcmodes/at400_lv.amx b/npcmodes/at400_lv.amx new file mode 100644 index 0000000..86c127d Binary files /dev/null and b/npcmodes/at400_lv.amx differ diff --git a/npcmodes/at400_lv.pwn b/npcmodes/at400_lv.pwn new file mode 100644 index 0000000..21e5b82 --- /dev/null +++ b/npcmodes/at400_lv.pwn @@ -0,0 +1,58 @@ +// +// A Driver NPC that goes around a path continuously +// Kye 2009 +// + +#include + +#define NUM_PLAYBACK_FILES 3 +new gPlaybackFileCycle=0; + +//------------------------------------------ + +main(){} + +//------------------------------------------ + +NextPlayback() +{ + // Reset the cycle count if we reach the max + if(gPlaybackFileCycle==NUM_PLAYBACK_FILES) gPlaybackFileCycle = 0; + + if(gPlaybackFileCycle==0) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_lv_to_sf_x1"); + } + else if(gPlaybackFileCycle==1) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_sf_to_ls_x1"); + } + else if(gPlaybackFileCycle==2) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_ls_to_lv_x1"); + } + + gPlaybackFileCycle++; +} + + +//------------------------------------------ + +public OnRecordingPlaybackEnd() +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCEnterVehicle(vehicleid, seatid) +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + StopRecordingPlayback(); + gPlaybackFileCycle = 0; +} + +//------------------------------------------ diff --git a/npcmodes/at400_sf.amx b/npcmodes/at400_sf.amx new file mode 100644 index 0000000..e9c5d03 Binary files /dev/null and b/npcmodes/at400_sf.amx differ diff --git a/npcmodes/at400_sf.pwn b/npcmodes/at400_sf.pwn new file mode 100644 index 0000000..1d70753 --- /dev/null +++ b/npcmodes/at400_sf.pwn @@ -0,0 +1,58 @@ +// +// A Driver NPC that goes around a path continuously +// Kye 2009 +// + +#include + +#define NUM_PLAYBACK_FILES 3 +new gPlaybackFileCycle=0; + +//------------------------------------------ + +main(){} + +//------------------------------------------ + +NextPlayback() +{ + // Reset the cycle count if we reach the max + if(gPlaybackFileCycle==NUM_PLAYBACK_FILES) gPlaybackFileCycle = 0; + + if(gPlaybackFileCycle==0) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_sf_to_ls_x1"); + } + else if(gPlaybackFileCycle==1) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_ls_to_lv_x1"); + } + else if(gPlaybackFileCycle==2) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"at400_lv_to_sf_x1"); + } + + gPlaybackFileCycle++; +} + + +//------------------------------------------ + +public OnRecordingPlaybackEnd() +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCEnterVehicle(vehicleid, seatid) +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + StopRecordingPlayback(); + gPlaybackFileCycle = 0; +} + +//------------------------------------------ diff --git a/npcmodes/mat_test.amx b/npcmodes/mat_test.amx new file mode 100644 index 0000000..a0029d5 Binary files /dev/null and b/npcmodes/mat_test.amx differ diff --git a/npcmodes/mat_test.pwn b/npcmodes/mat_test.pwn new file mode 100644 index 0000000..53f960f --- /dev/null +++ b/npcmodes/mat_test.pwn @@ -0,0 +1,41 @@ +// +// A Driver NPC that goes around a path continuously +// Kye 2009 +// + +#include + +//------------------------------------------ + +main(){} + +//------------------------------------------ + +NextPlayback() +{ + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"car8761"); +} + + +//------------------------------------------ + +public OnRecordingPlaybackEnd() +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCEnterVehicle(vehicleid, seatid) +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + StopRecordingPlayback(); +} + +//------------------------------------------ diff --git a/npcmodes/npcidle.amx b/npcmodes/npcidle.amx new file mode 100644 index 0000000..3374f60 Binary files /dev/null and b/npcmodes/npcidle.amx differ diff --git a/npcmodes/npcidle.pwn b/npcmodes/npcidle.pwn new file mode 100644 index 0000000..d8f82a9 --- /dev/null +++ b/npcmodes/npcidle.pwn @@ -0,0 +1,15 @@ +// +// NPC Test Script +// Kye 2009 +// + +#include + +//------------------------------------------ + +main() +{ + printf("npcidle: running"); +} + +//------------------------------------------ diff --git a/npcmodes/npctest.amx b/npcmodes/npctest.amx new file mode 100644 index 0000000..c26ca77 Binary files /dev/null and b/npcmodes/npctest.amx differ diff --git a/npcmodes/npctest.pwn b/npcmodes/npctest.pwn new file mode 100644 index 0000000..50f4965 --- /dev/null +++ b/npcmodes/npctest.pwn @@ -0,0 +1,166 @@ +// +// NPC Test Script +// Kye 2009 +// + +#include + +forward TimerTest(); + +//------------------------------------------ + +main() +{ + printf("npctest: main()"); +} + +//------------------------------------------ + +public OnNPCModeInit() +{ + printf("npctest: OnNPCModeInit"); + SetTimer("TimerTest",10000,1); +} + +//------------------------------------------ + +public OnNPCModeExit() +{ + printf("npctest: OnNPCModeExit"); +} + +//------------------------------------------ + +public TimerTest() +{ + //new ticker = GetTickCount() - g_LastTick; + //printf("npctest: timer (%d)ms", ticker); + //g_LastTick = GetTickCount(); + + new msg[256]; + new name[64]; + new Float:X,Float:Y,Float:Z; + new Float:Distance; + new x; + new num_streamed_in = 0; + new num_connected = 0; + + x=0; + while(x!=MAX_PLAYERS) { + if(IsPlayerConnected(x)) { + num_connected++; + if(IsPlayerStreamedIn(x)) { + num_streamed_in++; + GetPlayerName(x,name,64); + GetPlayerPos(x,X,Y,Z); + GetDistanceFromMeToPoint(X,Y,Z,Distance); + format(msg,256,"I see %s @ %f units with state:%d health:%d armour:%d weapon:%d", + name,Distance,GetPlayerState(x),GetPlayerHealth(x),GetPlayerArmour(x),GetPlayerArmedWeapon(x)); + SendChat(msg); + + if(GetPlayerState(x) == PLAYER_STATE_DRIVER) { + format(msg,256,"I see %s driving vehicle: %d",name,GetPlayerVehicleID(x)); + SendChat(msg); + } + + } + } + x++; + } + + format(msg,256,"I have %d connected players with %d streamed in",num_connected,num_streamed_in); + SendChat(msg); + + SendCommand("/me waits around patiently"); + SendCommand("/groundsit"); + +} + +//------------------------------------------ + +public OnNPCConnect(myplayerid) +{ + printf("npctest: OnNPCConnect(My playerid=%d)", myplayerid); +} + +//------------------------------------------ + +public OnNPCDisconnect(reason[]) +{ + printf("npctest: OnNPCDisconnect(reason=%s)", reason); +} + +//------------------------------------------ + +public OnNPCSpawn() +{ + printf("npctest: OnNPCSpawn"); +} + +//------------------------------------------ + +public OnNPCEnterVehicle(vehicleid, seatid) +{ + printf("npctest: OnNPCEnterVehicle(vehicleid=%d,seatid=%d)", vehicleid, seatid); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + printf("npctest: OnNPCExitVehicle"); +} + +//------------------------------------------ + +public OnClientMessage(color, text[]) +{ + printf("npctest: OnClientMessage(color=%d, text=%s)", color, text); +} + +//------------------------------------------ + +public OnPlayerDeath(playerid) +{ + printf("npctest: OnPlayerDeath(playerid=%d)", playerid); +} + +//------------------------------------------ + +public OnPlayerText(playerid, text[]) +{ + printf("npctest: (CHAT)(from=%d, text=%s)", playerid, text); +} + +//------------------------------------------ + +public OnPlayerStreamIn(playerid) +{ + printf("npctest: OnPlayerStreamIn(playerid=%d)", playerid); +} + +//------------------------------------------ + +public OnPlayerStreamOut(playerid) +{ + printf("npctest: OnPlayerStreamOut(playerid=%d)", playerid); +} + +//------------------------------------------ + +public OnVehicleStreamIn(vehicleid) +{ + printf("npctest: OnVehicleStreamIn(vehicleid=%d)", vehicleid); +} + +//------------------------------------------ + +public OnVehicleStreamOut(vehicleid) +{ + printf("npctest: OnVehicleStreamOut(vehicleid=%d)", vehicleid); +} + +//------------------------------------------ + + + diff --git a/npcmodes/onfoot_test.amx b/npcmodes/onfoot_test.amx new file mode 100644 index 0000000..932fc4f Binary files /dev/null and b/npcmodes/onfoot_test.amx differ diff --git a/npcmodes/onfoot_test.pwn b/npcmodes/onfoot_test.pwn new file mode 100644 index 0000000..f79076e --- /dev/null +++ b/npcmodes/onfoot_test.pwn @@ -0,0 +1,38 @@ +// +// + +#include + +//------------------------------------------ + +main(){} + +//------------------------------------------ + +NextPlayback() +{ + StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"shotrun"); +} + +//------------------------------------------ + +public OnRecordingPlaybackEnd() +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCSpawn() +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + StopRecordingPlayback(); +} + +//------------------------------------------ diff --git a/npcmodes/recordings/animtest1.rec b/npcmodes/recordings/animtest1.rec new file mode 100644 index 0000000..6711962 Binary files /dev/null and b/npcmodes/recordings/animtest1.rec differ diff --git a/npcmodes/recordings/animtest2.rec b/npcmodes/recordings/animtest2.rec new file mode 100644 index 0000000..48addd0 Binary files /dev/null and b/npcmodes/recordings/animtest2.rec differ diff --git a/npcmodes/recordings/at400_ls_to_lv_x1.rec b/npcmodes/recordings/at400_ls_to_lv_x1.rec new file mode 100644 index 0000000..8d292ae Binary files /dev/null and b/npcmodes/recordings/at400_ls_to_lv_x1.rec differ diff --git a/npcmodes/recordings/at400_lv_to_sf_x1.rec b/npcmodes/recordings/at400_lv_to_sf_x1.rec new file mode 100644 index 0000000..5c6379d Binary files /dev/null and b/npcmodes/recordings/at400_lv_to_sf_x1.rec differ diff --git a/npcmodes/recordings/at400_sf_to_ls_x1.rec b/npcmodes/recordings/at400_sf_to_ls_x1.rec new file mode 100644 index 0000000..d8de16c Binary files /dev/null and b/npcmodes/recordings/at400_sf_to_ls_x1.rec differ diff --git a/npcmodes/recordings/shotrun.rec b/npcmodes/recordings/shotrun.rec new file mode 100644 index 0000000..1dd7497 Binary files /dev/null and b/npcmodes/recordings/shotrun.rec differ diff --git a/npcmodes/recordings/train_ls_to_sf1.rec b/npcmodes/recordings/train_ls_to_sf1.rec new file mode 100644 index 0000000..de9b8d5 Binary files /dev/null and b/npcmodes/recordings/train_ls_to_sf1.rec differ diff --git a/npcmodes/recordings/train_lv_to_ls1.rec b/npcmodes/recordings/train_lv_to_ls1.rec new file mode 100644 index 0000000..de8d1be Binary files /dev/null and b/npcmodes/recordings/train_lv_to_ls1.rec differ diff --git a/npcmodes/recordings/train_sf_to_lv1.rec b/npcmodes/recordings/train_sf_to_lv1.rec new file mode 100644 index 0000000..07bc405 Binary files /dev/null and b/npcmodes/recordings/train_sf_to_lv1.rec differ diff --git a/npcmodes/taxi_ls_test.amx b/npcmodes/taxi_ls_test.amx new file mode 100644 index 0000000..f63f89f Binary files /dev/null and b/npcmodes/taxi_ls_test.amx differ diff --git a/npcmodes/taxi_ls_test.pwn b/npcmodes/taxi_ls_test.pwn new file mode 100644 index 0000000..fe64d50 --- /dev/null +++ b/npcmodes/taxi_ls_test.pwn @@ -0,0 +1,127 @@ +// +// A test driver NPC with very basic AI +// Kye 2009 +// + +#include + +new gStoppedForTraffic = 0; +new gPlaybackActive = 0; + +public ScanTimer(); + +#define AHEAD_OF_CAR_DISTANCE 11.0 +#define SCAN_RADIUS 11.0 + +//------------------------------------------ + +main(){} + +//------------------------------------------ + +stock GetXYInfrontOfMe(Float:distance, &Float:x, &Float:y) +{ + new Float:z, Float:angle; + GetMyPos(x,y,z); + GetMyFacingAngle(angle); + x += (distance * floatsin(-angle, degrees)); + y += (distance * floatcos(-angle, degrees)); +} + +//------------------------------------------ + +public OnNPCModeInit() +{ + SetTimer("ScanTimer",200,1); +} + +//------------------------------------------ + +LookForAReasonToPause() +{ + new Float:X,Float:Y,Float:Z; + new x=0; + + GetMyPos(X,Y,Z); + GetXYInfrontOfMe(AHEAD_OF_CAR_DISTANCE,X,Y); + + while(x!=MAX_PLAYERS) { + if(IsPlayerConnected(x) && IsPlayerStreamedIn(x)) { + if( GetPlayerState(x) == PLAYER_STATE_DRIVER || + GetPlayerState(x) == PLAYER_STATE_ONFOOT ) + { + if(IsPlayerInRangeOfPoint(x,SCAN_RADIUS,X,Y,Z)) { + return 1; + } + } + } + x++; + } + + //new msg[256]; + //new Float:angle; + //GetMyFacingAngle(angle); + //format(msg,256,"My yaw/heading = %f",angle); + //SendChat(msg); + + return 0; +} + + +//------------------------------------------ + +public ScanTimer() +{ + //new ticker = GetTickCount() - g_LastTick; + //printf("npctest: timer (%d)ms", ticker); + //g_LastTick = GetTickCount(); + + new ReasonToPause = LookForAReasonToPause(); + + if(ReasonToPause && !gStoppedForTraffic) + { + //SendChat("I'm pausing"); + PauseRecordingPlayback(); + gStoppedForTraffic = 1; + } + else if(!ReasonToPause && gStoppedForTraffic) + { + //SendChat("I'm resuming"); + ResumeRecordingPlayback(); + gStoppedForTraffic = 0; + } +} + + +//------------------------------------------ + +StartPlayback() +{ + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"taxi_test_1282"); + gStoppedForTraffic = 0; + gPlaybackActive = 1; +} + + +//------------------------------------------ + +public OnRecordingPlaybackEnd() +{ + StartPlayback(); +} + +//------------------------------------------ + +public OnNPCEnterVehicle(vehicleid, seatid) +{ + StartPlayback(); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + StopRecordingPlayback(); +} + +//------------------------------------------ diff --git a/npcmodes/train_ls.amx b/npcmodes/train_ls.amx new file mode 100644 index 0000000..c80dbca Binary files /dev/null and b/npcmodes/train_ls.amx differ diff --git a/npcmodes/train_ls.pwn b/npcmodes/train_ls.pwn new file mode 100644 index 0000000..aeff91c --- /dev/null +++ b/npcmodes/train_ls.pwn @@ -0,0 +1,58 @@ +// +// A Driver NPC that goes around a path continuously +// Kye 2009 +// + +#include + +#define NUM_PLAYBACK_FILES 3 +new gPlaybackFileCycle=0; + +//------------------------------------------ + +main(){} + +//------------------------------------------ + +NextPlayback() +{ + // Reset the cycle count if we reach the max + if(gPlaybackFileCycle==NUM_PLAYBACK_FILES) gPlaybackFileCycle = 0; + + if(gPlaybackFileCycle==0) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"train_ls_to_sf1"); + } + else if(gPlaybackFileCycle==1) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"train_sf_to_lv1"); + } + else if(gPlaybackFileCycle==2) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"train_lv_to_ls1"); + } + + gPlaybackFileCycle++; +} + + +//------------------------------------------ + +public OnRecordingPlaybackEnd() +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCEnterVehicle(vehicleid, seatid) +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + StopRecordingPlayback(); + gPlaybackFileCycle = 0; +} + +//------------------------------------------ diff --git a/npcmodes/train_lv.amx b/npcmodes/train_lv.amx new file mode 100644 index 0000000..6f48c48 Binary files /dev/null and b/npcmodes/train_lv.amx differ diff --git a/npcmodes/train_lv.pwn b/npcmodes/train_lv.pwn new file mode 100644 index 0000000..62e2ff2 --- /dev/null +++ b/npcmodes/train_lv.pwn @@ -0,0 +1,61 @@ +// +// A Driver NPC that goes around a path continuously +// Kye 2009 +// + +#include + +#define NUM_PLAYBACK_FILES 3 +new gPlaybackFileCycle=0; + +//------------------------------------------ + +main(){} + +//------------------------------------------ + +NextPlayback() +{ + // Reset the cycle count if we reach the max + if(gPlaybackFileCycle==NUM_PLAYBACK_FILES) gPlaybackFileCycle = 0; + + if(gPlaybackFileCycle==0) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"train_lv_to_ls1"); + //SendChat("I'm leaving LV for LS station."); + } + else if(gPlaybackFileCycle==1) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"train_ls_to_sf1"); + //SendChat("I'm leaving LS for SF station."); + } + else if(gPlaybackFileCycle==2) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"train_sf_to_lv1"); + //SendChat("I'm leaving SF for LV station."); + } + + gPlaybackFileCycle++; +} + + +//------------------------------------------ + +public OnRecordingPlaybackEnd() +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCEnterVehicle(vehicleid, seatid) +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + StopRecordingPlayback(); + gPlaybackFileCycle = 0; +} + +//------------------------------------------ diff --git a/npcmodes/train_sf.amx b/npcmodes/train_sf.amx new file mode 100644 index 0000000..fadf516 Binary files /dev/null and b/npcmodes/train_sf.amx differ diff --git a/npcmodes/train_sf.pwn b/npcmodes/train_sf.pwn new file mode 100644 index 0000000..f2e129b --- /dev/null +++ b/npcmodes/train_sf.pwn @@ -0,0 +1,58 @@ +// +// A Driver NPC that goes around a path continuously +// Kye 2009 +// + +#include + +#define NUM_PLAYBACK_FILES 3 +new gPlaybackFileCycle=0; + +//------------------------------------------ + +main(){} + +//------------------------------------------ + +NextPlayback() +{ + // Reset the cycle count if we reach the max + if(gPlaybackFileCycle==NUM_PLAYBACK_FILES) gPlaybackFileCycle = 0; + + if(gPlaybackFileCycle==0) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"train_sf_to_lv1"); + } + else if(gPlaybackFileCycle==1) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"train_lv_to_ls1"); + } + else if(gPlaybackFileCycle==2) { + StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"train_ls_to_sf1"); + } + + gPlaybackFileCycle++; +} + + +//------------------------------------------ + +public OnRecordingPlaybackEnd() +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCEnterVehicle(vehicleid, seatid) +{ + NextPlayback(); +} + +//------------------------------------------ + +public OnNPCExitVehicle() +{ + StopRecordingPlayback(); + gPlaybackFileCycle = 0; +} + +//------------------------------------------ diff --git a/pawno/include/a_actor.inc b/pawno/include/a_actor.inc new file mode 100644 index 0000000..eda5712 --- /dev/null +++ b/pawno/include/a_actor.inc @@ -0,0 +1,34 @@ +/* SA-MP Actor Functions + * + * (c) Copyright 2015, SA-MP Team + * + */ + +#if defined _actor_included + #endinput +#endif +#define _actor_included +#pragma library actors + +native CreateActor(modelid, Float:X, Float:Y, Float:Z, Float:Rotation); +native DestroyActor(actorid); + +native IsActorStreamedIn(actorid, forplayerid); + +native SetActorVirtualWorld(actorid, vworld); +native GetActorVirtualWorld(actorid); + +native ApplyActorAnimation(actorid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time); +native ClearActorAnimations(actorid); + +native SetActorPos(actorid, Float:X, Float:Y, Float:Z); +native GetActorPos(actorid, &Float:X, &Float:Y, &Float:Z); +native SetActorFacingAngle(actorid, Float:ang); +native GetActorFacingAngle(actorid, &Float:ang); + +native SetActorHealth(actorid, Float:health); +native GetActorHealth(actorid, &Float:health); +native SetActorInvulnerable(actorid, invulnerable = true); +native IsActorInvulnerable(actorid); + +native IsValidActor(actorid); \ No newline at end of file diff --git a/pawno/include/a_http.inc b/pawno/include/a_http.inc new file mode 100644 index 0000000..be43bdc --- /dev/null +++ b/pawno/include/a_http.inc @@ -0,0 +1,24 @@ + /* SA-MP threaded HTTP/1.0 client for pawn + * + * (c) Copyright 2010, SA-MP Team + * + */ + +// HTTP requests +#define HTTP_GET 1 +#define HTTP_POST 2 +#define HTTP_HEAD 3 + +// HTTP error response codes +// These codes compliment ordinary HTTP response codes returned in 'response_code' +// (10x) (20x OK) (30x Moved) (40x Unauthorised) (50x Server Error) +#define HTTP_ERROR_BAD_HOST 1 +#define HTTP_ERROR_NO_SOCKET 2 +#define HTTP_ERROR_CANT_CONNECT 3 +#define HTTP_ERROR_CANT_WRITE 4 +#define HTTP_ERROR_CONTENT_TOO_BIG 5 +#define HTTP_ERROR_MALFORMED_RESPONSE 6 + +native HTTP(index, type, url[], data[], callback[]); + +// example HTTP callback: public MyHttpResponse(index, response_code, data[]) { ... } \ No newline at end of file diff --git a/pawno/include/a_npc.inc b/pawno/include/a_npc.inc new file mode 100644 index 0000000..9d7f11f --- /dev/null +++ b/pawno/include/a_npc.inc @@ -0,0 +1,190 @@ +/* SA-MP NPC Functions + * + * (c) Copyright 2009, SA-MP Team + * + */ + +#if defined _samp_included + #endinput +#endif +#define _samp_included +#pragma library samp + +#pragma tabsize 4 + +#include +#include +#include +#include +#include