Browse Source

initial commit

master
Niels Peretzke 5 years ago
commit
a113c2d258
185 changed files with 22663 additions and 0 deletions
  1. +3
    -0
      .gitignore.txt
  2. BIN
      announce.exe
  3. BIN
      filterscripts/a51_base.amx
  4. +422
    -0
      filterscripts/a51_base.pwn
  5. BIN
      filterscripts/adminspec.amx
  6. +121
    -0
      filterscripts/adminspec.pwn
  7. BIN
      filterscripts/attachments.amx
  8. +383
    -0
      filterscripts/attachments.pwn
  9. BIN
      filterscripts/base.amx
  10. +151
    -0
      filterscripts/base.pwn
  11. BIN
      filterscripts/baseaf.amx
  12. +234
    -0
      filterscripts/baseaf.pwn
  13. BIN
      filterscripts/cargoship.amx
  14. +216
    -0
      filterscripts/cargoship.pwn
  15. BIN
      filterscripts/dillimore_gas.amx
  16. +161
    -0
      filterscripts/dillimore_gas.pwn
  17. BIN
      filterscripts/ferriswheel.amx
  18. +135
    -0
      filterscripts/ferriswheel.pwn
  19. BIN
      filterscripts/flymode.amx
  20. +265
    -0
      filterscripts/flymode.pwn
  21. BIN
      filterscripts/fsdebug.amx
  22. +2108
    -0
      filterscripts/fsdebug.pwn
  23. BIN
      filterscripts/gl_actions.amx
  24. +371
    -0
      filterscripts/gl_actions.pwn
  25. BIN
      filterscripts/gl_chat.amx
  26. +293
    -0
      filterscripts/gl_chat.pwn
  27. BIN
      filterscripts/gl_chatbubble.amx
  28. +63
    -0
      filterscripts/gl_chatbubble.pwn
  29. BIN
      filterscripts/gl_mapicon.amx
  30. +70
    -0
      filterscripts/gl_mapicon.pwn
  31. BIN
      filterscripts/gl_npcs.amx
  32. +161
    -0
      filterscripts/gl_npcs.pwn
  33. BIN
      filterscripts/gl_property.amx
  34. +835
    -0
      filterscripts/gl_property.pwn
  35. BIN
      filterscripts/gl_realtime.amx
  36. +162
    -0
      filterscripts/gl_realtime.pwn
  37. BIN
      filterscripts/http_test.amx
  38. +39
    -0
      filterscripts/http_test.pwn
  39. BIN
      filterscripts/iradio.amx
  40. +59
    -0
      filterscripts/iradio.pwn
  41. BIN
      filterscripts/kylies_barn.amx
  42. +138
    -0
      filterscripts/kylies_barn.pwn
  43. BIN
      filterscripts/ls_apartments1.amx
  44. +770
    -0
      filterscripts/ls_apartments1.pwn
  45. BIN
      filterscripts/ls_beachside.amx
  46. +743
    -0
      filterscripts/ls_beachside.pwn
  47. BIN
      filterscripts/ls_elevator.amx
  48. +509
    -0
      filterscripts/ls_elevator.pwn
  49. BIN
      filterscripts/ls_mall.amx
  50. +220
    -0
      filterscripts/ls_mall.pwn
  51. BIN
      filterscripts/ls_prisonwalls.amx
  52. +404
    -0
      filterscripts/ls_prisonwalls.pwn
  53. BIN
      filterscripts/ls_wellsfargo.amx
  54. +139
    -0
      filterscripts/ls_wellsfargo.pwn
  55. BIN
      filterscripts/maxips.amx
  56. +52
    -0
      filterscripts/maxips.pwn
  57. BIN
      filterscripts/menutest.amx
  58. +53
    -0
      filterscripts/menutest.pwn
  59. BIN
      filterscripts/modular_houses.amx
  60. +363
    -0
      filterscripts/modular_houses.pwn
  61. BIN
      filterscripts/modular_island.amx
  62. +194
    -0
      filterscripts/modular_island.pwn
  63. BIN
      filterscripts/netstats.amx
  64. +70
    -0
      filterscripts/netstats.pwn
  65. BIN
      filterscripts/npc_record.amx
  66. +75
    -0
      filterscripts/npc_record.pwn
  67. BIN
      filterscripts/ospawner.amx
  68. +416
    -0
      filterscripts/ospawner.pwn
  69. BIN
      filterscripts/pirateship.amx
  70. +177
    -0
      filterscripts/pirateship.pwn
  71. BIN
      filterscripts/pnetstats.amx
  72. +78
    -0
      filterscripts/pnetstats.pwn
  73. BIN
      filterscripts/pnetstats2.amx
  74. +99
    -0
      filterscripts/pnetstats2.pwn
  75. BIN
      filterscripts/safe_animated.amx
  76. +212
    -0
      filterscripts/safe_animated.pwn
  77. BIN
      filterscripts/samp_anims.amx
  78. +65
    -0
      filterscripts/samp_anims.pwn
  79. BIN
      filterscripts/sf_building1.amx
  80. +176
    -0
      filterscripts/sf_building1.pwn
  81. BIN
      filterscripts/sf_zombotech.amx
  82. +664
    -0
      filterscripts/sf_zombotech.pwn
  83. BIN
      filterscripts/skinchanger.amx
  84. +366
    -0
      filterscripts/skinchanger.pwn
  85. BIN
      filterscripts/stunt_island.amx
  86. +1092
    -0
      filterscripts/stunt_island.pwn
  87. BIN
      filterscripts/test_cmds.amx
  88. +1952
    -0
      filterscripts/test_cmds.pwn
  89. BIN
      filterscripts/vspawner.amx
  90. +387
    -0
      filterscripts/vspawner.pwn
  91. BIN
      gamemodes/bare.amx
  92. +90
    -0
      gamemodes/bare.pwn
  93. BIN
      gamemodes/barron.amx
  94. +264
    -0
      gamemodes/barron.pwn
  95. BIN
      gamemodes/grandlarc.amx
  96. +529
    -0
      gamemodes/grandlarc.pwn
  97. BIN
      gamemodes/rivershell.amx
  98. +630
    -0
      gamemodes/rivershell.pwn
  99. BIN
      gamemodes/timertest.amx
  100. +36
    -0
      gamemodes/timertest.pwn

+ 3
- 0
.gitignore.txt View File

@ -0,0 +1,3 @@
*.exe
samp-license.txt
server-readme.txt

BIN
announce.exe View File


BIN
filterscripts/a51_base.amx View File


+ 422
- 0
filterscripts/a51_base.pwn View File

@ -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 <a_samp>
// 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;
}

BIN
filterscripts/adminspec.amx View File


+ 121
- 0
filterscripts/adminspec.pwn View File

@ -0,0 +1,121 @@
//
// ADMIN SPECTATE FILTER SCRIPT
// kye 2007
//
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>
#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;
}
//------------------------------------------------------------------------------------------------------

BIN
filterscripts/attachments.amx View File


+ 383
- 0
filterscripts/attachments.pwn View File

@ -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 <a_samp>
#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<MAX_PLAYER_ATTACHED_OBJECTS;x++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, x)) format(string, sizeof(string), "%s%d (Used)\n", string, x);
else format(string, sizeof(string), "%s%d\n", string, x);
}
ShowPlayerDialog(playerid, DIALOG_ATTACH_INDEX_SELECTION, DIALOG_STYLE_LIST, \
"{FF0000}Attachment Modification - Index Selection", string, "Select", "Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_ATTACH_INDEX_SELECTION:
{
if(response)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, listitem))
{
ShowPlayerDialog(playerid, DIALOG_ATTACH_EDITREPLACE, DIALOG_STYLE_MSGBOX, \
"{FF0000}Attachment Modification", "Do you wish to edit the attachment in that slot, or delete it?", "Edit", "Delete");
}
else
{
new string[4000+1];
for(new x;x<sizeof(AttachmentObjects);x++)
{
format(string, sizeof(string), "%s%s\n", string, AttachmentObjects[x][attachname]);
}
ShowPlayerDialog(playerid, DIALOG_ATTACH_MODEL_SELECTION, DIALOG_STYLE_LIST, \
"{FF0000}Attachment Modification - Model Selection", string, "Select", "Cancel");
}
SetPVarInt(playerid, "AttachmentIndexSel", listitem);
}
return 1;
}
case DIALOG_ATTACH_EDITREPLACE:
{
if(response) EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
else RemovePlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
DeletePVar(playerid, "AttachmentIndexSel");
return 1;
}
case DIALOG_ATTACH_MODEL_SELECTION:
{
if(response)
{
if(GetPVarInt(playerid, "AttachmentUsed") == 1) EditAttachedObject(playerid, listitem);
else
{
SetPVarInt(playerid, "AttachmentModelSel", AttachmentObjects[listitem][attachmodel]);
new string[256+1];
for(new x;x<sizeof(AttachmentBones);x++)
{
format(string, sizeof(string), "%s%s\n", string, AttachmentBones[x]);
}
ShowPlayerDialog(playerid, DIALOG_ATTACH_BONE_SELECTION, DIALOG_STYLE_LIST, \
"{FF0000}Attachment Modification - Bone Selection", string, "Select", "Cancel");
}
}
else DeletePVar(playerid, "AttachmentIndexSel");
return 1;
}
case DIALOG_ATTACH_BONE_SELECTION:
{
if(response)
{
SetPlayerAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"), GetPVarInt(playerid, "AttachmentModelSel"), listitem+1);
EditAttachedObject(playerid, GetPVarInt(playerid, "AttachmentIndexSel"));
SendClientMessage(playerid, 0xFFFFFFFF, "Hint: Use {FFFF00}~k~~PED_SPRINT~{FFFFFF} to look around.");
}
DeletePVar(playerid, "AttachmentIndexSel");
DeletePVar(playerid, "AttachmentModelSel");
return 1;
}
}
return 0;
}
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 )
{
new debug_string[256+1];
format(debug_string,256,"SetPlayerAttachedObject(playerid,%d,%d,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f)",
index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
print(debug_string);
SendClientMessage(playerid, 0xFFFFFFFF, debug_string);
SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
SendClientMessage(playerid, 0xFFFFFFFF, "You finished editing an attached object");
return 1;
}

BIN
filterscripts/base.amx View File


+ 151
- 0
filterscripts/base.pwn View File

@ -0,0 +1,151 @@
//
// Base FS
// Contains /pm /kick /ban commands.
//
#include <a_samp>
#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;
}

BIN
filterscripts/baseaf.amx View File


+ 234
- 0
filterscripts/baseaf.pwn View File

@ -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 # <message>
#include <a_samp>
#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 #<message>.
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;
}
//-----------------------------------------------

BIN
filterscripts/cargoship.amx View File


+ 216
- 0
filterscripts/cargoship.pwn View File

@ -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 <a_samp>
#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;
}
//-------------------------------------------------

BIN
filterscripts/dillimore_gas.amx View File


+ 161
- 0
filterscripts/dillimore_gas.pwn View File

@ -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 <a_samp>
// -----------------------------------------------------------------------------
// 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;
}

BIN
filterscripts/ferriswheel.amx View File


+ 135
- 0
filterscripts/ferriswheel.pwn View File

@ -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 <a_samp>
#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;
}
//-------------------------------------------------

BIN
filterscripts/flymode.amx View File


+ 265
- 0
filterscripts/flymode.pwn View File

@ -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 <a_samp>
// 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<MAX_PLAYERS; x++)
{
if(noclipdata[x][cameramode] == CAMERA_MODE_FLY) CancelFlyMode(x);
}
return 1;
}
//--------------------------------------------------
public OnPlayerConnect(playerid)
{
// Reset the data belonging to this player slot
noclipdata[playerid][cameramode] = CAMERA_MODE_NONE;
noclipdata[playerid][lrold] = 0;
noclipdata[playerid][udold] = 0;
noclipdata[playerid][mode] = 0;
noclipdata[playerid][lastmove] = 0;
noclipdata[playerid][accelmul] = 0.0;
return 1;
}
//--------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/flymode", true))
{
// Place the player in and out of edit mode
if(GetPVarType(playerid, "FlyMode")) CancelFlyMode(playerid);
else FlyMode(playerid);
return 1;
}
return 0;
}
//--------------------------------------------------
public OnPlayerUpdate(playerid)
{
if(noclipdata[playerid][cameramode] == CAMERA_MODE_FLY)
{
new keys,ud,lr;
GetPlayerKeys(playerid,keys,ud,lr);
if(noclipdata[playerid][mode] && (GetTickCount() - noclipdata[playerid][lastmove] > 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;
}
//--------------------------------------------------

BIN
filterscripts/fsdebug.amx View File


+ 2108
- 0
filterscripts/fsdebug.pwn
File diff suppressed because it is too large
View File


BIN
filterscripts/gl_actions.amx View File


+ 371
- 0
filterscripts/gl_actions.pwn View File

@ -0,0 +1,371 @@
//-------------------------------------------------
//
// Generic Special Actions And Anims
// kyeman 2007
//
//-------------------------------------------------
#include <a_samp>
#include <core>
#include <float>
#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

BIN
filterscripts/gl_chat.amx View File


+ 293
- 0
filterscripts/gl_chat.pwn View File

@ -0,0 +1,293 @@
//
//
// SA-MP Roleplay style chat module for Grand Larceny
// (c) 2012 SA-MP Team
// All rights reserved
//
#include <a_samp>
#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;
}
//---------------------------------------------

BIN
filterscripts/gl_chatbubble.amx View File


+ 63
- 0
filterscripts/gl_chatbubble.pwn View File

@ -0,0 +1,63 @@
//
// Example use of chat above player's head
//
#include <a_samp>
#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
}
//------------------------------------------------

BIN
filterscripts/gl_mapicon.amx View File


+ 70
- 0
filterscripts/gl_mapicon.pwn View File

@ -0,0 +1,70 @@
//-------------------------------------------------
//
// These are the default map icons from San Andreas
// Cluckin Bell, Ammu, Burgershot etc
//
// Kye 2010
//
//-------------------------------------------------
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>
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;
}

BIN
filterscripts/gl_npcs.amx View File


+ 161
- 0
filterscripts/gl_npcs.pwn View File

@ -0,0 +1,161 @@
//-------------------------------------------------
//
// NPC initialisation for Grand Larceny
//
//-------------------------------------------------
#pragma tabsize 0
#include <a_samp>
//-------------------------------------------------
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

BIN
filterscripts/gl_property.amx View File


+ 835
- 0
filterscripts/gl_property.pwn View File

@ -0,0 +1,835 @@
//-------------------------------------------------------
//
// GRAND LARCENY Property creation and management script
//
// by damospiderman 2008
//
//-------------------------------------------------------
#include <a_samp>
#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;
}
/***********************************************************************
***********************************************************************/

BIN
filterscripts/gl_realtime.amx View File


+ 162
- 0
filterscripts/gl_realtime.pwn View File

@ -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 <a_samp>
#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;
}

BIN
filterscripts/http_test.amx View File


+ 39
- 0
filterscripts/http_test.pwn View File

@ -0,0 +1,39 @@
//------------------------------------------------
#include <a_samp>
#include <a_http>
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;
}
//------------------------------------------------

BIN
filterscripts/iradio.amx View File


+ 59
- 0
filterscripts/iradio.pwn View File

@ -0,0 +1,59 @@
//-------------------------------------------------
// Internet radio example
// (c) 2011 SA-MP Team
//-------------------------------------------------
#pragma tabsize 0
#include <a_samp>
//-------------------------------------------------
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;
}
//-------------------------------------------------

BIN
filterscripts/kylies_barn.amx View File


+ 138
- 0
filterscripts/kylies_barn.pwn View File

@ -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 <a_samp>
// -----------------------------------------------------------------------------
// 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;
}

BIN
filterscripts/ls_apartments1.amx View File


+ 770
- 0
filterscripts/ls_apartments1.pwn View File

@ -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 <a_samp>
// 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);
}

BIN
filterscripts/ls_beachside.amx View File


+ 743
- 0
filterscripts/ls_beachside.pwn View File

@ -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 <a_samp>
// 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]);
}

BIN
filterscripts/ls_elevator.amx View File


+ 509
- 0
filterscripts/ls_elevator.pwn View File

@ -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 <a_samp>
#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]);

BIN
filterscripts/ls_mall.amx View File


+ 220
- 0
filterscripts/ls_mall.pwn View File

@ -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 <a_samp>
#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;
}

BIN
filterscripts/ls_prisonwalls.amx View File


+ 404
- 0
filterscripts/ls_prisonwalls.pwn View File

@ -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 <a_samp>
// 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;
}

BIN
filterscripts/ls_wellsfargo.amx View File


+ 139
- 0
filterscripts/ls_wellsfargo.pwn View File

@ -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 <a_samp>
// -----------------------------------------------------------------------------
// 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;
}

BIN
filterscripts/maxips.amx View File


+ 52
- 0
filterscripts/maxips.pwn View File

@ -0,0 +1,52 @@
// maxips FS limits the number of players connecting from a
// single IP address.
#include <a_samp>
#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_PLAYERS; x++) {
if(IsPlayerConnected(x)) {
GetPlayerIp(x,against_ip,32);
if(!strcmp(against_ip,test_ip)) ip_count++;
}
}
return ip_count;
}
//---------------------------------------------
public OnPlayerConnect(playerid)
{
new connecting_ip[32+1];
GetPlayerIp(playerid,connecting_ip,32);
new num_players_on_ip = GetNumberOfPlayersOnThisIP(connecting_ip);
if(num_players_on_ip > 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;
}
//---------------------------------------------

BIN
filterscripts/menutest.amx View File


+ 53
- 0
filterscripts/menutest.pwn View File

@ -0,0 +1,53 @@
// Test menu functionality filterscipt
#include <a_samp>
#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;
}

BIN
filterscripts/modular_houses.amx View File


+ 363
- 0
filterscripts/modular_houses.pwn View File

@ -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 <a_samp>
// -----------------------------------------------------------------------------
// 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;
}

BIN
filterscripts/modular_island.amx View File


+ 194
- 0
filterscripts/modular_island.pwn View File

@ -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 <a_samp>
// -----------------------------------------------------------------------------
// 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;
}

BIN
filterscripts/netstats.amx View File


+ 70
- 0
filterscripts/netstats.pwn View File

@ -0,0 +1,70 @@
//
// Admin netstats display
//
#include <a_samp>
#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;
}
//------------------------------------------------

BIN
filterscripts/npc_record.amx View File


+ 75
- 0
filterscripts/npc_record.pwn View File

@ -0,0 +1,75 @@
//-------------------------------------------------
//
// Recording player data for NPC playback
// Kye 2009
//
//-------------------------------------------------
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>
#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

BIN
filterscripts/ospawner.amx View File


+ 416
- 0
filterscripts/ospawner.pwn View File

@ -0,0 +1,416 @@
//
// Admin spawner using previews. For SA-MP 0.3x and above.
// - Kye 2012
//
#include <a_samp>
#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 <g>
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;
}
//------------------------------------------------

BIN
filterscripts/pirateship.amx View File


+ 177
- 0
filterscripts/pirateship.pwn View File

@ -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 <a_samp>
#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;
}
//-------------------------------------------------

BIN
filterscripts/pnetstats.amx View File


+ 78
- 0
filterscripts/pnetstats.pwn View File

@ -0,0 +1,78 @@
//
// Admin player netstats display
//
#include <a_samp>
#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;
}
//------------------------------------------------

BIN
filterscripts/pnetstats2.amx View File


+ 99
- 0
filterscripts/pnetstats2.pwn View File

@ -0,0 +1,99 @@
//
// Admin player netstats display
// Using NetStats_* functions.
//
// -Rcon login admin then:
// /pnetstats2 (playerid)
//
#include <a_samp>
#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;
}
//------------------------------------------------

BIN
filterscripts/safe_animated.amx View File


+ 212
- 0
filterscripts/safe_animated.pwn View File

@ -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 <a_samp>
// ------------------------------------------------------------------------------
// 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;
}

BIN
filterscripts/samp_anims.amx View File


+ 65
- 0
filterscripts/samp_anims.pwn View File

@ -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 <a_samp>
// ------------------------------------------------------------------------------
// 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;
}

BIN
filterscripts/sf_building1.amx View File


+ 176
- 0
filterscripts/sf_building1.pwn View File

@ -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 <a_samp>
// -----------------------------------------------------------------------------
// 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;
}

BIN
filterscripts/sf_zombotech.amx View File


+ 664
- 0
filterscripts/sf_zombotech.pwn View File

@ -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 <a_samp>
// 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]);

BIN
filterscripts/skinchanger.amx View File


+ 366
- 0
filterscripts/skinchanger.pwn View File

@ -0,0 +1,366 @@
//
// Admin player skin changer using previews. For SA-MP 0.3x and above.
// - Kye 2012
//
#include <a_samp>
#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 <g>
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;
}
//------------------------------------------------

BIN
filterscripts/stunt_island.amx View File


+ 1092
- 0
filterscripts/stunt_island.pwn
File diff suppressed because it is too large
View File


BIN
filterscripts/test_cmds.amx View File


+ 1952
- 0
filterscripts/test_cmds.pwn
File diff suppressed because it is too large
View File


BIN
filterscripts/vspawner.amx View File


+ 387
- 0
filterscripts/vspawner.pwn View File

@ -0,0 +1,387 @@
//
// Admin vehicle spawner using previews. For SA-MP 0.3x and above.
// - Kye 2012
//
#include <a_samp>
#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 <g>
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;
}
//------------------------------------------------

BIN
gamemodes/bare.amx View File


+ 90
- 0
gamemodes/bare.pwn View File

@ -0,0 +1,90 @@
#include <a_samp>
#include <core>
#include <float>
#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;
}

BIN
gamemodes/barron.amx View File


+ 264
- 0
gamemodes/barron.pwn View File

@ -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 <a_samp>
#include <core>
#include <float>
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;
}
//------------------------------------------------

BIN
gamemodes/grandlarc.amx View File


+ 529
- 0
gamemodes/grandlarc.pwn View File

@ -0,0 +1,529 @@
//----------------------------------------------------------
//
// GRAND LARCENY 1.0
// A freeroam gamemode for SA-MP 0.3
//
//----------------------------------------------------------
#include <a_samp>
#include <core>
#include <float>
#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;
}
//----------------------------------------------------------

BIN
gamemodes/rivershell.amx View File


+ 630
- 0
gamemodes/rivershell.pwn View File

@ -0,0 +1,630 @@
//---------------------------------------------------------
//
// Rivershell v2 by Kye - 2006-2013
//
//---------------------------------------------------------
#include <a_samp>
#include <core>
#include <float>
// 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<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
PlayerPlaySound(i, soundid, x, y, z);
}
}
}
//---------------------------------
CreateMapObject(modelid, Float:fX, Float:fY, Float:fZ, Float:fRX, Float:fRY, Float:fRZ)
{
return CreateObject(modelid, fX, fY, fZ, fRX, fRY, fRZ, 500.0);
}
//---------------------------------
RemoveNeededBuildingsForPlayer(playerid)
{
if(GetPVarInt(playerid,"BuildingsRemoved") == 0) {
RemoveBuildingForPlayer(playerid, 9090, 2317.0859, 572.2656, -20.9688, 10.0);
RemoveBuildingForPlayer(playerid, 9091, 2317.0859, 572.2656, -20.9688, 10.0);
RemoveBuildingForPlayer(playerid, 13483, 2113.5781, -96.7344, 0.9844, 0.25);
RemoveBuildingForPlayer(playerid, 12990, 2113.5781, -96.7344, 0.9844, 0.25);
RemoveBuildingForPlayer(playerid, 935, 2119.8203, -84.4063, -0.0703, 0.25);
RemoveBuildingForPlayer(playerid, 1369, 2104.0156, -105.2656, 1.7031, 0.25);
RemoveBuildingForPlayer(playerid, 935, 2122.3750, -83.3828, 0.4609, 0.25);
RemoveBuildingForPlayer(playerid, 935, 2119.5313, -82.8906, -0.1641, 0.25);
RemoveBuildingForPlayer(playerid, 935, 2120.5156, -79.0859, 0.2188, 0.25);
RemoveBuildingForPlayer(playerid, 935, 2119.4688, -69.7344, 0.2266, 0.25);
RemoveBuildingForPlayer(playerid, 935, 2119.4922, -73.6172, 0.1250, 0.25);
RemoveBuildingForPlayer(playerid, 935, 2117.8438, -67.8359, 0.1328, 0.25);
SetPVarInt(playerid,"BuildingsRemoved",1);
}
}
//---------------------------------
SpectatePlayer(playerid, specplayerid)
{
if(GetPlayerState(specplayerid) == PLAYER_STATE_ONFOOT) {
if(GetPVarInt(playerid, "SpectateMode") != SPECTATE_MODE_PLAYER) {
PlayerSpectatePlayer(playerid, specplayerid);
SetPVarInt(playerid, "SpectateMode", SPECTATE_MODE_PLAYER);
}
}
else if( GetPlayerState(specplayerid) == PLAYER_STATE_DRIVER ||
GetPlayerState(specplayerid) == PLAYER_STATE_PASSENGER )
{
if(GetPVarInt(playerid, "SpectateMode") != SPECTATE_MODE_VEHICLE) {
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
SetPVarInt(playerid, "SpectateMode", SPECTATE_MODE_VEHICLE);
}
}
}
//---------------------------------
SpectateFixedPosition(playerid)
{
if(gTeam[playerid] == TEAM_GREEN) {
SetPlayerCameraPos(playerid, 2221.5820, -273.9985, 61.7806);
SetPlayerCameraLookAt(playerid, 2220.9978, -273.1861, 61.4606);
}
else {
SetPlayerCameraPos(playerid, 2274.8467, 591.3257, 30.1311);
SetPlayerCameraLookAt(playerid, 2275.0503, 590.3463, 29.9460);
}
}
//---------------------------------
HandleSpectating(playerid)
{
new LastKillerId = GetPVarInt(playerid, "LastKillerId");
// Make sure the killer player is still active in the world
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);
}
else
{
// Else switch to the fixed position camera
if(GetPVarInt(playerid, "SpectateState") != SPECTATE_STATE_FIXED) {
SpectateFixedPosition(playerid);
SetPVarInt(playerid, "SpectateState", SPECTATE_STATE_FIXED);
}
}
}
//---------------------------------
DoResupply(playerid)
{
new iLastResupplyTime = GetPVarInt(playerid, "LastResupply");
if(iLastResupplyTime == 0 || (GetTickCount() - iLastResupplyTime) > 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);
}
}
//---------------------------------

BIN
gamemodes/timertest.amx View File


+ 36
- 0
gamemodes/timertest.pwn View File

@ -0,0 +1,36 @@
#include <a_samp>
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();
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save